Merge branch 'preview'

This commit is contained in:
ccbikai 2025-05-16 19:02:40 +08:00
commit c76ab39538
307 changed files with 301 additions and 209 deletions

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View file

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -18,6 +18,9 @@ const route = useRoute()
<TabsTrigger value="/dashboard/analysis"> <TabsTrigger value="/dashboard/analysis">
{{ $t('nav.analysis') }} {{ $t('nav.analysis') }}
</TabsTrigger> </TabsTrigger>
<!-- <TabsTrigger value="/dashboard/realtime">
{{ $t('nav.realtime') }}
</TabsTrigger> -->
</TabsList> </TabsList>
</Tabs> </Tabs>
<slot name="left" /> <slot name="left" />

View file

@ -74,8 +74,8 @@ onBeforeMount(() => {
</DashboardNav> </DashboardNav>
<DashboardFilters v-if="!link" @change="changeFilter" /> <DashboardFilters v-if="!link" @change="changeFilter" />
</div> </div>
<DashboardCounters /> <DashboardAnalysisCounters />
<DashboardViews /> <DashboardAnalysisViews />
<DashboardMetrics /> <DashboardAnalysisMetrics />
</main> </main>
</template> </template>

View file

@ -31,7 +31,7 @@ defineProps({
:value="rawTabs[index]" :value="rawTabs[index]"
class="flex-1" class="flex-1"
> >
<DashboardMetricsMetric <DashboardAnalysisMetricsMetric
:type="rawTabs[index]" :type="rawTabs[index]"
:name="tab" :name="tab"
class="h-full" class="h-full"

View file

@ -20,28 +20,28 @@ const translatedTabs = computed(() => ({
<template> <template>
<main class="grid gap-8 lg:grid-cols-12"> <main class="grid gap-8 lg:grid-cols-12">
<LazyDashboardMetricsLocations class="col-span-1 lg:col-span-8" /> <LazyDashboardAnalysisMetricsLocations class="col-span-1 lg:col-span-8" />
<DashboardMetricsGroup <DashboardAnalysisMetricsGroup
class="lg:col-span-4" class="lg:col-span-4"
:tabs="translatedTabs.location" :tabs="translatedTabs.location"
:raw-tabs="tabs.location" :raw-tabs="tabs.location"
/> />
<DashboardMetricsGroup <DashboardAnalysisMetricsGroup
class="lg:col-span-6" class="lg:col-span-6"
:tabs="translatedTabs.referer" :tabs="translatedTabs.referer"
:raw-tabs="tabs.referer" :raw-tabs="tabs.referer"
/> />
<DashboardMetricsGroup <DashboardAnalysisMetricsGroup
class="lg:col-span-6" class="lg:col-span-6"
:tabs="translatedTabs.time" :tabs="translatedTabs.time"
:raw-tabs="tabs.time" :raw-tabs="tabs.time"
/> />
<DashboardMetricsGroup <DashboardAnalysisMetricsGroup
class="lg:col-span-6" class="lg:col-span-6"
:tabs="translatedTabs.device" :tabs="translatedTabs.device"
:raw-tabs="tabs.device" :raw-tabs="tabs.device"
/> />
<DashboardMetricsGroup <DashboardAnalysisMetricsGroup
class="lg:col-span-6" class="lg:col-span-6"
:tabs="translatedTabs.browser" :tabs="translatedTabs.browser"
:raw-tabs="tabs.browser" :raw-tabs="tabs.browser"

View file

@ -39,7 +39,7 @@ defineProps({
<div <div
class="flex-1 leading-5 truncate font-mediums" class="flex-1 leading-5 truncate font-mediums"
> >
<DashboardMetricsName <DashboardAnalysisMetricsName
:name="metric.name" :name="metric.name"
:type="type" :type="type"
/> />

View file

@ -61,7 +61,7 @@ onBeforeUnmount(() => {
<template> <template>
<Card class="flex flex-col"> <Card class="flex flex-col">
<template v-if="metrics.length"> <template v-if="metrics.length">
<DashboardMetricsList <DashboardAnalysisMetricsList
class="flex-1" class="flex-1"
:metrics="top6" :metrics="top6"
:type="type" :type="type"
@ -83,7 +83,7 @@ onBeforeUnmount(() => {
<DialogHeader> <DialogHeader>
<DialogTitle>{{ name }}</DialogTitle> <DialogTitle>{{ name }}</DialogTitle>
</DialogHeader> </DialogHeader>
<DashboardMetricsList <DashboardAnalysisMetricsList
class="overflow-y-auto" class="overflow-y-auto"
:metrics="metrics" :metrics="metrics"
:type="type" :type="type"

View file

@ -10,19 +10,28 @@ defineProps({
}, },
}) })
const locale = useI18n().locale
function formatName(name, type) { function formatName(name, type) {
if (!name || typeof Intl === 'undefined') if (!name || typeof Intl === 'undefined')
return name return name
try { try {
if (type === 'country') { if (type === 'country') {
const regionNames = new Intl.DisplayNames(['en'], { type: 'region' }) const regionNames = new Intl.DisplayNames([locale.value], { type: 'region' })
return `${getFlag(name)} ${regionNames.of(name)}` return `${getFlag(name)} ${regionNames.of(name)}`
} }
if (type === 'language') { if (type === 'language') {
const languageNames = new Intl.DisplayNames(['en'], { type: 'language' }) const languageNames = new Intl.DisplayNames([locale.value], { type: 'language' })
return languageNames.of(name) return languageNames.of(name)
} }
// TODO: Add support for timezone
// if (type === 'timezone' && typeof Intl.TimeZone === 'function') {
// const tz = new Intl.TimeZone(name)
// return tz.getDisplayName(locale.value, { type: 'long' })
// }
return name return name
} }
catch (e) { catch (e) {
@ -36,15 +45,15 @@ function formatName(name, type) {
<TooltipProvider> <TooltipProvider>
<Tooltip> <Tooltip>
<TooltipTrigger class="w-full text-left"> <TooltipTrigger class="w-full text-left">
<DashboardMetricsNameReferer <DashboardAnalysisMetricsNameReferer
v-if="name && type === 'referer'" v-if="name && type === 'referer'"
:name="name" :name="name"
/> />
<DashboardMetricsNameSlug <DashboardAnalysisMetricsNameSlug
v-else-if="name && type === 'slug'" v-else-if="name && type === 'slug'"
:name="name" :name="name"
/> />
<DashboardMetricsNameIcon <DashboardAnalysisMetricsNameIcon
v-else-if="name && ['os', 'browser', 'browserType', 'device', 'deviceType'].includes(type)" v-else-if="name && ['os', 'browser', 'browserType', 'device', 'deviceType'].includes(type)"
:name="name" :name="name"
:type="type" :type="type"

View file

@ -1,6 +1,6 @@
<script setup> <script setup>
import { DependencyType } from '@/components/ui/auto-form/interface' import { DependencyType } from '@/components/ui/auto-form/interface'
import { LinkSchema, nanoid } from '@/schemas/link' import { LinkSchema, nanoid } from '@@/schemas/link'
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import { Shuffle, Sparkles } from 'lucide-vue-next' import { Shuffle, Sparkles } from 'lucide-vue-next'
import { useForm } from 'vee-validate' import { useForm } from 'vee-validate'

View file

@ -0,0 +1,10 @@
<template>
<main class="space-y-6">
<div class="flex flex-col gap-6 sm:gap-2 sm:flex-row sm:justify-between">
<DashboardNav />
</div>
<div>
Realtime
</div>
</main>
</template>

Some files were not shown because too many files have changed in this diff Show more