refactor(stage-*): analytics with better structure, added useBuildInfo
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { defineInvoke, defineInvokeHandler } from '@moeru/eventa'
|
||||
import { useContextBridge } from '@proj-airi/stage-ui/composables'
|
||||
import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
|
||||
import { useDisplayModelsStore } from '@proj-airi/stage-ui/stores/display-models'
|
||||
import { useModsServerChannelStore } from '@proj-airi/stage-ui/stores/mods/api/channel-server'
|
||||
import { useAiriCardStore } from '@proj-airi/stage-ui/stores/modules/airi-card'
|
||||
@@ -27,6 +28,7 @@ const router = useRouter()
|
||||
const route = useRoute()
|
||||
const cardStore = useAiriCardStore()
|
||||
const serverChannelStore = useModsServerChannelStore()
|
||||
const analyticsStore = useSharedAnalyticsStore()
|
||||
|
||||
watch(language, () => {
|
||||
i18n.locale.value = language.value
|
||||
@@ -39,6 +41,7 @@ onMounted(() => updateThemeColor())
|
||||
|
||||
// FIXME: store settings to file
|
||||
onMounted(async () => {
|
||||
analyticsStore.initialize()
|
||||
cardStore.initialize()
|
||||
onboardingStore.initializeSetupCheck()
|
||||
|
||||
|
||||
@@ -2,13 +2,9 @@ import type { Plugin } from 'vue'
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
|
||||
import Tres from '@tresjs/core'
|
||||
import buildTime from '~build/time'
|
||||
|
||||
import { autoAnimatePlugin } from '@formkit/auto-animate/vue'
|
||||
import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
|
||||
import { MotionPlugin } from '@vueuse/motion'
|
||||
import { abbreviatedSha, branch } from '~build/git'
|
||||
import { version } from '~build/package'
|
||||
import { createPinia } from 'pinia'
|
||||
import { setupLayouts } from 'virtual:generated-layouts'
|
||||
import { createApp } from 'vue'
|
||||
@@ -42,15 +38,6 @@ import '@fontsource/sniglet'
|
||||
|
||||
const pinia = createPinia()
|
||||
|
||||
// Initialize analytics
|
||||
const analyticsStore = useSharedAnalyticsStore(pinia)
|
||||
analyticsStore.initialize({
|
||||
version: version ?? 'dev',
|
||||
commit: abbreviatedSha,
|
||||
branch,
|
||||
builtOn: buildTime.toISOString(),
|
||||
})
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
// TODO: vite-plugin-vue-layouts is long deprecated, replace with another layout solution
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { OnboardingDialog, ToasterRoot } from '@proj-airi/stage-ui/components'
|
||||
import { useContextBridge } from '@proj-airi/stage-ui/composables'
|
||||
import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
|
||||
import { useDisplayModelsStore } from '@proj-airi/stage-ui/stores/display-models'
|
||||
import { useModsServerChannelStore } from '@proj-airi/stage-ui/stores/mods/api/channel-server'
|
||||
import { useAiriCardStore } from '@proj-airi/stage-ui/stores/modules/airi-card'
|
||||
@@ -30,6 +31,7 @@ const serverChannelStore = useModsServerChannelStore()
|
||||
const { shouldShowSetup } = storeToRefs(onboardingStore)
|
||||
const { isDark } = useTheme()
|
||||
const cardStore = useAiriCardStore()
|
||||
const analyticsStore = useSharedAnalyticsStore()
|
||||
|
||||
const primaryColor = computed(() => {
|
||||
return isDark.value
|
||||
@@ -67,6 +69,7 @@ watch(settings.themeColorsHueDynamic, () => {
|
||||
|
||||
// Initialize first-time setup check when app mounts
|
||||
onMounted(async () => {
|
||||
analyticsStore.initialize()
|
||||
cardStore.initialize()
|
||||
|
||||
onboardingStore.initializeSetupCheck()
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { AboutContent, AboutDialog } from '@proj-airi/stage-ui/components'
|
||||
import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics/index'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useBuildInfo } from '@proj-airi/stage-ui/composables'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const show = ref(false)
|
||||
const analyticsStore = useSharedAnalyticsStore()
|
||||
const { buildInfo } = storeToRefs(analyticsStore)
|
||||
const buildInfo = useBuildInfo()
|
||||
|
||||
const aboutLinks = [
|
||||
{ label: 'Home', href: 'https://airi.moeru.ai/docs/', icon: 'i-solar:home-smile-outline' },
|
||||
|
||||
@@ -2,14 +2,10 @@ import type { Plugin } from 'vue'
|
||||
import type { Router, RouteRecordRaw } from 'vue-router'
|
||||
|
||||
import Tres from '@tresjs/core'
|
||||
import buildTime from '~build/time'
|
||||
import NProgress from 'nprogress'
|
||||
|
||||
import { autoAnimatePlugin } from '@formkit/auto-animate/vue'
|
||||
import { useSharedAnalyticsStore } from '@proj-airi/stage-ui/stores/analytics'
|
||||
import { MotionPlugin } from '@vueuse/motion'
|
||||
import { abbreviatedSha, branch } from '~build/git'
|
||||
import { version } from '~build/package'
|
||||
import { createPinia } from 'pinia'
|
||||
import { setupLayouts } from 'virtual:generated-layouts'
|
||||
import { createApp } from 'vue'
|
||||
@@ -31,15 +27,6 @@ import 'uno.css'
|
||||
|
||||
const pinia = createPinia()
|
||||
|
||||
// Initialize analytics
|
||||
const analyticsStore = useSharedAnalyticsStore(pinia)
|
||||
analyticsStore.initialize({
|
||||
version: version ?? 'dev',
|
||||
commit: abbreviatedSha,
|
||||
branch,
|
||||
builtOn: buildTime.toISOString(),
|
||||
})
|
||||
|
||||
// TODO: vite-plugin-vue-layouts is long deprecated, replace with another layout solution
|
||||
const routeRecords = setupLayouts(routes as RouteRecordRaw[])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user