Files
ntspi-app/resources/js/Pages/Dashboard/Components/shared/AnalyticsReferrers.vue
T
F4ilji d6c0f48d48 feat(analytics): add site analytics with grouped navigation sections
- Add Analytics container: models, tasks, jobs, controllers, routes, services
- Add analytics config with section groups (structure, institute, content, services)
- Add database tables: analytics_sessions, analytics_hits, analytics_daily_stats
- Add frontend: Analytics page, section detail, chart, overview, navigation components
- Add consent banner and JS tracking service (sendBeacon + Inertia listener)
- Add permission sync for view_analytics, view_any_analytic
- Fix trailing slash URL matching in GetNavigationSectionsTask
- Fix event propagation on expand arrows in navigation sections
- Fix RecordVisitJob to not depend on dropped analytics_geo_cache table
- Replace plain text views/visitors with badge-style icons
- Group navigation sections by category with separate blocks
- Add config-driven non-CMS sections (faculties, divisions, DPO, journals)
- Remove Events, TV, Sveden from analytics sections
2026-09-18 22:18:04 +05:00

37 lines
1.1 KiB
Vue

<template>
<div class="space-y-2">
<div v-if="items.length === 0" class="text-xs text-muted-foreground-1 py-4 text-center">Нет данных</div>
<div v-for="item in items" :key="item.source" class="group">
<div class="flex items-center justify-between mb-1">
<span class="text-xs font-medium text-foreground truncate">{{ item.source }}</span>
<span class="text-xs text-muted-foreground-1 ml-2 flex-shrink-0">{{ item.hits }}</span>
</div>
<div class="h-1.5 bg-muted-hover rounded-full overflow-hidden">
<div
class="h-full bg-primary/60 rounded-full transition-all"
:style="{ width: getWidth(item.hits) + '%' }"
></div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'AnalyticsReferrers',
props: {
items: { type: Array, required: true },
},
computed: {
maxHits() {
return Math.max(...this.items.map(i => i.hits), 1);
},
},
methods: {
getWidth(hits) {
return Math.max((hits / this.maxHits) * 100, 2);
},
},
};
</script>