Scaffolded from the Ladill mini/events extraction pattern: multi-file transfers, retention controls, public landing pages, analytics, and Gitea deploy workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
2.7 KiB
PHP
53 lines
2.7 KiB
PHP
<x-user-layout>
|
|
<x-slot name="title">Analytics</x-slot>
|
|
<div class="space-y-6">
|
|
<div>
|
|
<h1 class="text-xl font-semibold text-slate-900">Analytics</h1>
|
|
<p class="mt-1 text-sm text-slate-500">Downloads per transfer over the last 30 days.</p>
|
|
</div>
|
|
|
|
<div class="rounded-2xl border border-slate-200 bg-white p-6">
|
|
<p class="text-xs font-medium uppercase tracking-wide text-slate-400">Downloads (30 days)</p>
|
|
<p class="mt-1 text-3xl font-semibold text-slate-900">{{ number_format($downloads30d) }}</p>
|
|
</div>
|
|
|
|
<div class="grid gap-6 lg:grid-cols-2">
|
|
<div class="rounded-2xl border border-slate-200 bg-white">
|
|
<div class="border-b border-slate-100 px-6 py-4">
|
|
<h2 class="font-semibold text-slate-900">Top transfers</h2>
|
|
</div>
|
|
@if($topTransfers->isEmpty())
|
|
<p class="px-6 py-8 text-sm text-slate-500">No download data yet.</p>
|
|
@else
|
|
<div class="divide-y divide-slate-100">
|
|
@foreach($topTransfers as $item)
|
|
<div class="flex items-center justify-between px-6 py-4">
|
|
<a href="{{ route('transfer.transfers.show', $item) }}" class="font-medium text-indigo-600 hover:text-indigo-800">{{ $item->title }}</a>
|
|
<span class="text-sm text-slate-600">{{ number_format($item->downloads_total) }}</span>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="rounded-2xl border border-slate-200 bg-white">
|
|
<div class="border-b border-slate-100 px-6 py-4">
|
|
<h2 class="font-semibold text-slate-900">Recent downloads</h2>
|
|
</div>
|
|
@if($recentDownloads->isEmpty())
|
|
<p class="px-6 py-8 text-sm text-slate-500">No downloads recorded yet.</p>
|
|
@else
|
|
<div class="divide-y divide-slate-100">
|
|
@foreach($recentDownloads as $event)
|
|
<div class="px-6 py-4">
|
|
<p class="text-sm font-medium text-slate-900">{{ $event->file?->original_name ?? 'Transfer' }}</p>
|
|
<p class="text-xs text-slate-500">{{ $event->transfer->title }} · {{ $event->downloaded_at->diffForHumans() }}</p>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-user-layout>
|