feat(households): hane seçici, ayarlar, admin hane yönetimi ve hane-yok sayfası
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import { House } from "lucide-react";
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { tr } from "@/i18n/tr";
|
||||
import { getHouseholdContext } from "@/lib/dal";
|
||||
|
||||
export const metadata: Metadata = { title: tr.households.noHousehold.title };
|
||||
|
||||
/** Hiçbir haneye üye olmayan kullanıcılar (ör. hanesi olmayan admin) buraya yönlenir. */
|
||||
export default async function NoHouseholdPage() {
|
||||
const ctx = await getHouseholdContext();
|
||||
if (!ctx) redirect("/login");
|
||||
if (ctx.household) redirect("/dashboard");
|
||||
const t = tr.households.noHousehold;
|
||||
return (
|
||||
<div className="flex flex-1 items-center justify-center">
|
||||
<Card className="max-w-md">
|
||||
<CardHeader>
|
||||
<span className="mb-2 flex size-12 items-center justify-center rounded-full bg-primary/10 text-primary">
|
||||
<House className="size-6" />
|
||||
</span>
|
||||
<CardTitle className="text-xl">{t.title}</CardTitle>
|
||||
<CardDescription>{t.description}</CardDescription>
|
||||
</CardHeader>
|
||||
{ctx.user.role === "admin" ? (
|
||||
<CardContent className="flex flex-col items-start gap-3">
|
||||
<p className="text-sm text-muted-foreground">{t.adminHint}</p>
|
||||
<Button asChild>
|
||||
<Link href="/admin/haneler">{t.adminLink}</Link>
|
||||
</Button>
|
||||
</CardContent>
|
||||
) : null}
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user