Files
butcem/src/features/recurring/components/overdue-banner.tsx
T

33 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { TriangleAlert } from "lucide-react";
import Link from "next/link";
import { Button } from "@/components/ui/button";
import { tr } from "@/i18n/tr";
import { countOverdue, ensureHorizon } from "../service";
import { toObjectId } from "@/lib/object-id";
/** Dashboard: vadesi geçmiş onaylanmamış planlı işlemler uyarısı (Bölüm 6.7). */
export async function OverdueBanner({
userId,
householdId,
}: {
userId: string;
householdId: string;
}) {
const hid = toObjectId(householdId);
if (hid) await ensureHorizon(hid);
const n = await countOverdue(userId, householdId);
if (!n) return null;
return (
<div
role="status"
className="flex flex-wrap items-center gap-3 rounded-xl border border-expense/30 bg-expense/10 p-3 text-sm"
>
<TriangleAlert className="size-4 shrink-0 text-expense" aria-hidden />
<span className="flex-1">{tr.recurring.overdueBanner(n)}</span>
<Button asChild size="sm" variant="outline">
<Link href="/planli">{tr.recurring.overdueLink}</Link>
</Button>
</div>
);
}