3cd8d98324
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { PageHeader } from "@/components/page-header";
|
|
import { ContactsView } from "@/features/contacts/components/contacts-view";
|
|
import { listContacts } from "@/features/contacts/service";
|
|
import { openInKindByContact } from "@/features/in-kind/service";
|
|
import { hasHouseholdRole } from "@/features/households/roles";
|
|
import { tr } from "@/i18n/tr";
|
|
import { requireActiveHousehold } from "@/lib/dal";
|
|
|
|
export const metadata: Metadata = { title: tr.contacts.title };
|
|
|
|
export default async function ContactsPage() {
|
|
const { user, household } = await requireActiveHousehold("viewer");
|
|
const [data, inKind] = await Promise.all([
|
|
listContacts(user.id, household.id),
|
|
openInKindByContact(user.id, household.id),
|
|
]);
|
|
if (!data) notFound();
|
|
return (
|
|
<>
|
|
<PageHeader title={tr.contacts.title} description={tr.contacts.description} />
|
|
<ContactsView
|
|
data={data}
|
|
inKind={Object.fromEntries(inKind)}
|
|
canWrite={hasHouseholdRole(household.role, "member")}
|
|
/>
|
|
</>
|
|
);
|
|
}
|