import { ClipboardCheck, Clock } from "lucide-react"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { tr } from "@/i18n/tr"; import { formatStock } from "@/shared/stock"; import { getStock } from "../service"; const t = tr.stock; const LIMIT = 5; /** Dashboard: eşiğin altındaki ürünler, SKT'si yaklaşan partiler, sayımı gelen kategoriler. */ export async function LowStockCard({ userId, householdId, }: { userId: string; householdId: string; }) { const data = await getStock(userId, householdId); if (!data || (!data.suggestions.length && !data.expiring.length && !data.countDue.length)) return null; const low = data.suggestions.slice(0, LIMIT); const expiring = data.expiring.slice(0, Math.max(0, LIMIT - low.length) || 2); return ( {t.dashboard.title} {t.dashboard.description( data.suggestions.length, data.expiring.length, data.countDue.length, )} {data.suggestions.length > low.length ? (

{t.dashboard.more(data.suggestions.length - low.length)}

) : null}
); }