forked from didirus/AstralRinth
Offline mode (#403)
* offline mode * fixes, mixpanels, etc * changes * prettier * rev * actions
This commit is contained in:
@@ -93,7 +93,7 @@ import {
|
||||
Button,
|
||||
} from 'omorphia'
|
||||
import { ref } from 'vue'
|
||||
import mixpanel from 'mixpanel-browser'
|
||||
import { mixpanel_track } from '@/helpers/mixpanel'
|
||||
|
||||
const props = defineProps({
|
||||
project: {
|
||||
@@ -112,7 +112,7 @@ const nextImage = () => {
|
||||
expandedGalleryIndex.value = 0
|
||||
}
|
||||
expandedGalleryItem.value = props.project.gallery[expandedGalleryIndex.value]
|
||||
mixpanel.track('GalleryImageNext', {
|
||||
mixpanel_track('GalleryImageNext', {
|
||||
project_id: props.project.id,
|
||||
url: expandedGalleryItem.value.url,
|
||||
})
|
||||
@@ -124,7 +124,7 @@ const previousImage = () => {
|
||||
expandedGalleryIndex.value = props.project.gallery.length - 1
|
||||
}
|
||||
expandedGalleryItem.value = props.project.gallery[expandedGalleryIndex.value]
|
||||
mixpanel.track('GalleryImagePrevious', {
|
||||
mixpanel_track('GalleryImagePrevious', {
|
||||
project_id: props.project.id,
|
||||
url: expandedGalleryItem.value,
|
||||
})
|
||||
@@ -135,7 +135,7 @@ const expandImage = (item, index) => {
|
||||
expandedGalleryIndex.value = index
|
||||
zoomedIn.value = false
|
||||
|
||||
mixpanel.track('GalleryImageExpand', {
|
||||
mixpanel_track('GalleryImageExpand', {
|
||||
project_id: props.project.id,
|
||||
url: item.url,
|
||||
})
|
||||
|
||||
@@ -267,7 +267,7 @@ import dayjs from 'dayjs'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ref, shallowRef, watch } from 'vue'
|
||||
import { installVersionDependencies } from '@/helpers/utils'
|
||||
import { installVersionDependencies, isOffline } from '@/helpers/utils'
|
||||
import InstallConfirmModal from '@/components/ui/InstallConfirmModal.vue'
|
||||
import ModInstallModal from '@/components/ui/ModInstallModal.vue'
|
||||
import { useBreadcrumbs } from '@/store/breadcrumbs'
|
||||
@@ -276,7 +276,7 @@ import { useFetch } from '@/helpers/fetch.js'
|
||||
import { handleError } from '@/store/notifications.js'
|
||||
import { convertFileSrc } from '@tauri-apps/api/tauri'
|
||||
import ContextMenu from '@/components/ui/ContextMenu.vue'
|
||||
import mixpanel from 'mixpanel-browser'
|
||||
import { mixpanel_track } from '@/helpers/mixpanel'
|
||||
|
||||
const route = useRoute()
|
||||
const breadcrumbs = useBreadcrumbs()
|
||||
@@ -297,6 +297,8 @@ const instance = ref(null)
|
||||
const installed = ref(false)
|
||||
const installedVersion = ref(null)
|
||||
|
||||
const offline = ref(await isOffline())
|
||||
|
||||
async function fetchProjectData() {
|
||||
;[
|
||||
data.value,
|
||||
@@ -325,7 +327,7 @@ async function fetchProjectData() {
|
||||
: null
|
||||
}
|
||||
|
||||
await fetchProjectData()
|
||||
if (!offline.value) await fetchProjectData()
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
@@ -392,7 +394,7 @@ async function install(version) {
|
||||
data.value.icon_url
|
||||
).catch(handleError)
|
||||
|
||||
mixpanel.track('PackInstall', {
|
||||
mixpanel_track('PackInstall', {
|
||||
id: data.value.id,
|
||||
version_id: queuedVersionData.id,
|
||||
title: data.value.title,
|
||||
@@ -434,7 +436,7 @@ async function install(version) {
|
||||
await installMod(instance.value.path, selectedVersion.id).catch(handleError)
|
||||
await installVersionDependencies(instance.value, queuedVersionData)
|
||||
installedVersion.value = selectedVersion.id
|
||||
mixpanel.track('ProjectInstall', {
|
||||
mixpanel_track('ProjectInstall', {
|
||||
loader: instance.value.metadata.loader,
|
||||
game_version: instance.value.metadata.game_version,
|
||||
id: data.value.id,
|
||||
@@ -458,7 +460,7 @@ async function install(version) {
|
||||
await installMod(instance.value.path, queuedVersionData.id).catch(handleError)
|
||||
await installVersionDependencies(instance.value, queuedVersionData)
|
||||
installedVersion.value = queuedVersionData.id
|
||||
mixpanel.track('ProjectInstall', {
|
||||
mixpanel_track('ProjectInstall', {
|
||||
loader: instance.value.metadata.loader,
|
||||
game_version: instance.value.metadata.game_version,
|
||||
id: data.value.id,
|
||||
|
||||
Reference in New Issue
Block a user