limit recent orders visibility to last 3
All checks were successful
Staging Build / build (push) Successful in 3m26s
All checks were successful
Staging Build / build (push) Successful in 3m26s
This commit is contained in:
@@ -74,63 +74,62 @@ export function AdminRecentOrders() {
|
|||||||
return () => clearInterval(interval)
|
return () => clearInterval(interval)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7 bg-[#020617]/85 p-4 rounded-xl">
|
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7 bg-[#020617]/85 p-4 rounded-xl">
|
||||||
<div className="rounded-xl border border-white/5 bg-[#020617]/85 overflow-hidden backdrop-blur-xl col-span-4">
|
<div className="rounded-xl border border-white/5 bg-[#020617]/85 overflow-hidden backdrop-blur-xl col-span-4">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle className="text-white">Übersicht (letzte 6 Monate)</CardTitle>
|
<CardTitle className="text-white">Übersicht (letzte 6 Monate)</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="pl-2">
|
<CardContent className="pl-2">
|
||||||
<RevenueChart data={chartData} />
|
<RevenueChart data={chartData} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col gap-4 bg-[#020617]/85 p-4 rounded-xl border border-white/5 col-span-3">
|
<div className="flex flex-col gap-4 bg-[#020617]/85 p-4 rounded-xl border border-white/5 col-span-3">
|
||||||
<div className="flex flex-row items-center justify-between pb-3">
|
<div className="flex flex-row items-center justify-between pb-3">
|
||||||
<h3 className="font-semibold text-lg text-white">Neue Bestellungen</h3>
|
<h3 className="font-semibold text-lg text-white">Neue Bestellungen</h3>
|
||||||
<span className="text-[10px] text-slate-500">
|
<span className="text-[10px] text-slate-500">
|
||||||
Aktualisiert: {lastChecked.toLocaleTimeString('de-DE')}
|
Aktualisiert: {lastChecked.toLocaleTimeString('de-DE')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-3 max-h-96 overflow-y-auto">
|
<div className="space-y-3 max-h-96 overflow-y-auto">
|
||||||
{orders.length === 0 ? (
|
{orders.length === 0 ? (
|
||||||
<p className="text-slate-500 text-sm italic text-center py-8">Noch keine Bestellungen</p>
|
<p className="text-slate-500 text-sm italic text-center py-8">Noch keine Bestellungen</p>
|
||||||
) : (
|
) : (
|
||||||
orders.slice(0, 5).map(order => {
|
orders.slice(0, 3).map(order => {
|
||||||
const isNew = newOrderIds.has(order.id)
|
const isNew = newOrderIds.has(order.id)
|
||||||
const customerName =
|
const customerName =
|
||||||
order.customer_data?.company_name ||
|
order.customer_data?.company_name ||
|
||||||
`${order.customer_data?.first_name ?? ''} ${order.customer_data?.last_name ?? ''}`.trim() ||
|
`${order.customer_data?.first_name ?? ''} ${order.customer_data?.last_name ?? ''}`.trim() ||
|
||||||
'Unbekannt'
|
'Unbekannt'
|
||||||
return (
|
return (
|
||||||
<Link key={order.id} href="/admin/orders" className="block">
|
<Link key={order.id} href="/admin/orders" className="block">
|
||||||
<div
|
<div
|
||||||
className={`flex items-center gap-3 p-3 rounded-lg transition-all duration-500 ${
|
className={`flex items-center gap-3 p-3 rounded-lg transition-all duration-500 ${isNew
|
||||||
isNew
|
? 'bg-primary/10 border border-primary/30 shadow-[0_0_12px_rgba(59,130,246,0.2)]'
|
||||||
? 'bg-primary/10 border border-primary/30 shadow-[0_0_12px_rgba(59,130,246,0.2)]'
|
: 'bg-[#020617]/20 hover:bg-[#020617]/30 border border-white/5'
|
||||||
: 'bg-[#020617]/20 hover:bg-[#020617]/30 border border-white/5'
|
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-bold shrink-0">
|
<div className="w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-bold shrink-0">
|
||||||
{customerName.slice(0, 2).toUpperCase()}
|
{customerName.slice(0, 2).toUpperCase()}
|
||||||
</div>
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<p className="text-sm font-medium text-white truncate">{customerName}</p>
|
|
||||||
<p className="text-xs text-slate-500 font-mono">#{order.order_number}</p>
|
|
||||||
</div>
|
|
||||||
<div className="text-right shrink-0 space-y-1">
|
|
||||||
<p className="font-medium text-white text-sm">
|
|
||||||
{new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(order.total_price)}
|
|
||||||
</p>
|
|
||||||
<Badge className={`text-[10px] ${statusClass[order.status] ?? ''}`}>{statusLabel[order.status] ?? order.status}</Badge>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
<div className="flex-1 min-w-0">
|
||||||
)
|
<p className="text-sm font-medium text-white truncate">{customerName}</p>
|
||||||
})
|
<p className="text-xs text-slate-500 font-mono">#{order.order_number}</p>
|
||||||
)}
|
</div>
|
||||||
</div>
|
<div className="text-right shrink-0 space-y-1">
|
||||||
|
<p className="font-medium text-white text-sm">
|
||||||
|
{new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(order.total_price)}
|
||||||
|
</p>
|
||||||
|
<Badge className={`text-[10px] ${statusClass[order.status] ?? ''}`}>{statusLabel[order.status] ?? order.status}</Badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user