Add hero section to My Links index with wallet stats and balance gate.
Deploy Ladill Link / deploy (push) Successful in 41s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-04 23:53:41 +00:00
co-authored by Cursor
parent 5e87debe32
commit 99a0cdb013
2 changed files with 63 additions and 11 deletions
@@ -32,10 +32,15 @@ class LinkController extends Controller
->latest()
->paginate(20);
$wallet = $account->getOrCreateLinkWallet();
return view('links.index', [
'links' => $links,
'wallet' => $wallet,
'balance' => $this->billing->balanceCedis($account),
'canCreate' => $this->billing->canCreate($account),
'pricePerLink' => \App\Models\LinkWallet::pricePerLink(),
'topupUrl' => ladill_account_url('wallet'),
]);
}
+57 -10
View File
@@ -1,21 +1,68 @@
<x-user-layout>
<x-slot name="title">My Links</x-slot>
<div class="mx-auto max-w-5xl space-y-6">
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div>
<h1 class="text-2xl font-semibold text-slate-900">My Links</h1>
<p class="mt-1 text-sm text-slate-500">Create and manage your ladl.link short URLs</p>
<div class="space-y-6"
x-data="balanceGate({
balance: @js((float) $balance),
price: @js((float) $pricePerLink),
topupUrl: @js($topupUrl),
href: @js(route('user.links.create')),
})">
@foreach(['success', 'error'] as $flash)
@if(session($flash))
<div class="rounded-lg border px-4 py-3 {{ $flash === 'success' ? 'border-emerald-200 bg-emerald-50 text-emerald-700' : 'border-red-200 bg-red-50 text-red-700' }}">
<p class="text-sm">{{ session($flash) }}</p>
</div>
<a href="{{ route('user.links.create') }}"
class="btn-primary inline-flex items-center justify-center">
@endif
@endforeach
<div class="relative overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="absolute inset-0 bg-gradient-to-br from-emerald-50/80 via-white to-teal-50/60"></div>
<div class="relative px-6 py-8 sm:px-10">
<div class="flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between">
<div class="max-w-xl">
<div class="inline-flex items-center gap-1.5 rounded-full bg-emerald-100 px-3 py-1 text-xs font-semibold text-emerald-700">
Short links · Click analytics · ladl.link
</div>
<h1 class="mt-3 text-2xl font-bold tracking-tight text-slate-900 sm:text-3xl">My Links</h1>
<p class="mt-2 text-sm leading-6 text-slate-600">
Create branded short URLs on ladl.link, track clicks, and manage destinations from one place.
</p>
<div class="mt-6">
<button type="button"
@click="goOrTopup($event)"
class="btn-primary">
<svg class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15"/></svg>
Create link
</a>
</button>
</div>
</div>
<div class="overflow-hidden rounded-xl border border-slate-200 bg-white">
<div class="scrollbar-hide flex snap-x snap-mandatory gap-3 overflow-x-auto pb-2 sm:grid sm:grid-cols-3 sm:overflow-visible sm:pb-0 lg:gap-4" style="-ms-overflow-style:none;scrollbar-width:none;">
<div class="mobile-stats-card shrink-0 snap-start rounded-xl border border-slate-200 bg-white/90 px-4 py-3 text-center backdrop-blur-sm">
<p class="whitespace-nowrap text-xl font-bold text-slate-900 sm:text-2xl">GHS {{ number_format($balance, 2) }}</p>
<p class="mt-0.5 whitespace-nowrap text-[11px] font-medium text-slate-500">Account balance</p>
</div>
<div class="mobile-stats-card shrink-0 snap-start rounded-xl border border-slate-200 bg-white/90 px-4 py-3 text-center backdrop-blur-sm">
<p class="whitespace-nowrap text-xl font-bold text-slate-900 sm:text-2xl">{{ number_format($links->total()) }}</p>
<p class="mt-0.5 whitespace-nowrap text-[11px] font-medium text-slate-500">Links</p>
</div>
<div class="mobile-stats-card shrink-0 snap-start rounded-xl border border-slate-200 bg-white/90 px-4 py-3 text-center backdrop-blur-sm">
<p class="whitespace-nowrap text-xl font-bold text-slate-900 sm:text-2xl">{{ number_format($wallet->clicks_total) }}</p>
<p class="mt-0.5 whitespace-nowrap text-[11px] font-medium text-slate-500">Total clicks</p>
</div>
</div>
</div>
</div>
</div>
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<div class="border-b border-slate-100 px-6 py-4">
<h2 class="text-sm font-semibold text-slate-900">All links</h2>
</div>
@if($links->isEmpty())
<div class="px-6 py-12 text-center">
<p class="text-slate-500">No links yet. Create your first short link on ladl.link.</p>
<p class="text-sm text-slate-500">No links yet. Create your first short link on ladl.link.</p>
</div>
@else
<table class="min-w-full divide-y divide-slate-100">