Files

505 lines
27 KiB
TypeScript

import { useState } from "react";
import { useTranslation } from "react-i18next";
import { fileTypeLabelKey } from "~/utils/files/fileTypeLabel";
import type { ProjectSignaturePanelVM, ProjectSubAreasScreenVM } from "@hivegrid/view-models";
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
import { Button } from "~/ui/components/Button";
import { ButtonGroup } from "~/ui/components/ButtonGroup";
import { Card } from "~/ui/components/Card";
import { EmptyState } from "~/ui/components/EmptyState";
import { Select } from "~/ui/components/Select";
import { Table } from "~/ui/components/Table";
import { Tabs } from "~/ui/components/Tabs";
import { TextInput } from "~/ui/components/TextInput";
import { APP_TIME_ZONE } from "~/locale/format";
import { ProjectSignaturePanel } from "~/components/screens/signature/ProjectSignaturePanel";
import { AppLink } from "~/components/app/AppLink";
export type ProjectOperationSubmit = (intent: string, fields?: Record<string, string>) => void;
export type ProjectSubAreasPanelProps = {
vm: ProjectSubAreasScreenVM;
signature: ProjectSignaturePanelVM;
submitting: boolean;
errorKey?: string | null;
/** User picker options for the member add form (route supplies the tenant directory). */
userOptions?: readonly { id: string; label: string }[];
actions: {
onSubmit: ProjectOperationSubmit;
onOpenChat: (href: string) => void;
/** Chunked PDF upload for the signature wizard (injected by the route). */
uploadPdf?: (file: File) => Promise<{ id: string; displayName: string }>;
};
};
type SubAreaTab = "members" | "appointments" | "invoices" | "checklists" | "tasks" | "materials" | "documents";
const DATETIME_INPUT_TYPE = "datetime-local" as unknown as "text";
const DATE_INPUT_TYPE = "date" as unknown as "text";
const mutedText = "text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary";
const headingText = "text-body-large-0 font-body-large-0 text-text-neutral-primary";
function formatDateTime(value: string | null, language: string): string {
if (!value) return "—";
return new Intl.DateTimeFormat(language, { timeZone: APP_TIME_ZONE, dateStyle: "medium", timeStyle: "short" }).format(new Date(value));
}
function formatDate(value: string | null, language: string): string {
if (!value) return "—";
return new Intl.DateTimeFormat(language, { timeZone: APP_TIME_ZONE, dateStyle: "medium" }).format(new Date(value));
}
function submitFields(submit: ProjectOperationSubmit, intent: string, fields: Record<string, string>) {
submit(intent, fields);
}
export function ProjectSubAreasPanel(props: ProjectSubAreasPanelProps) {
const { t, i18n } = useTranslation();
const submit = props.actions.onSubmit;
const [member, setMember] = useState({ principalType: "user", userId: "", groupId: "", rolle: "monteur" });
const [taskDraft, setTaskDraft] = useState("");
const [appointment, setAppointment] = useState({ titel: "", startAt: "", endAt: "", assignedToUserId: "" });
const [invoice, setInvoice] = useState({ betrag: "", datum: "", faelligAm: "", dateiId: "" });
const [checklist, setChecklist] = useState({ titel: "", typ: "generisch" });
const [itemDrafts, setItemDrafts] = useState<Record<string, string>>({});
const [invoiceStatuses, setInvoiceStatuses] = useState<Record<string, string>>({});
const [activeTab, setActiveTab] = useState<SubAreaTab>("members");
if (props.vm.status !== "ready") return null;
const data = props.vm.data;
return (
<div className="flex flex-col gap-6" data-ui-id="ui.projects.operations">
<div className="flex flex-wrap items-center justify-between gap-3">
<div className="flex flex-col gap-1">
<span className={headingText}>{t("projects.operations.title")}</span>
<span className={mutedText}>{data.projectNumber} · {data.projectName}</span>
</div>
<AppLink href={data.acceptanceHref} className="text-body-default-medium-0 font-body-default-medium-0 text-brand-brand-text-default hover:underline" data-ui-id="ui.projects.operations.acceptance-link">
{t("projects.actions.openAcceptance")}
</AppLink>
</div>
{props.errorKey ? <BadgeFeedback farbe="subtle-negative">{t(props.errorKey)}</BadgeFeedback> : null}
{data.requiresAcceptanceProtocol ? <BadgeFeedback farbe="subtle-warning">{t("projects.operations.acceptanceRequired")}</BadgeFeedback> : null}
{data.openDefects > 0 ? <BadgeFeedback farbe="subtle-warning">{t("projects.subAreas.openDefects", { count: data.openDefects })}</BadgeFeedback> : null}
{data.chat ? (
<Card data-ui-id="ui.projects.operations.chat">
<ButtonGroup align="space-between">
<ButtonGroup align="stack">
<span className={headingText}>{t("projects.chat.title")}</span>
<span className={mutedText}>{t(data.chat.isArchived ? "projects.chat.archived" : data.chat.canWrite ? "projects.chat.active" : "projects.chat.readOnly")}</span>
</ButtonGroup>
<Button variant="tertiary" onClick={() => props.actions.onOpenChat(data.chat!.href)}>
{t("projects.actions.openChat")}
</Button>
</ButtonGroup>
</Card>
) : null}
<ProjectSignaturePanel
vm={props.signature}
submitting={props.submitting}
errorKey={props.errorKey?.startsWith("signature.") ? props.errorKey : null}
actions={{ onSubmit: submit, uploadPdf: props.actions.uploadPdf }}
/>
<Tabs data-ui-id="ui.projects.operations.tabs">
<Tabs.Item active={activeTab === "members"} onClick={() => setActiveTab("members")} role="tab" aria-selected={activeTab === "members"}>
{t("projects.subAreas.members")}
</Tabs.Item>
<Tabs.Item
active={activeTab === "appointments"}
onClick={() => setActiveTab("appointments")}
role="tab"
aria-selected={activeTab === "appointments"}
>
{t("projects.subAreas.appointments")}
</Tabs.Item>
<Tabs.Item active={activeTab === "invoices"} onClick={() => setActiveTab("invoices")} role="tab" aria-selected={activeTab === "invoices"}>
{t("projects.subAreas.invoices")}
</Tabs.Item>
<Tabs.Item
active={activeTab === "checklists"}
onClick={() => setActiveTab("checklists")}
role="tab"
aria-selected={activeTab === "checklists"}
>
{t("projects.subAreas.checklists")}
</Tabs.Item>
<Tabs.Item active={activeTab === "tasks"} onClick={() => setActiveTab("tasks")} role="tab" aria-selected={activeTab === "tasks"}>
{t("projects.subAreas.tasks")}
</Tabs.Item>
<Tabs.Item active={activeTab === "materials"} onClick={() => setActiveTab("materials")} role="tab" aria-selected={activeTab === "materials"}>
{t("projects.subAreas.materials")}
</Tabs.Item>
<Tabs.Item active={activeTab === "documents"} onClick={() => setActiveTab("documents")} role="tab" aria-selected={activeTab === "documents"}>
{t("projects.subAreas.documents")}
</Tabs.Item>
</Tabs>
{activeTab === "members" ? (
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]">
<Card data-ui-id="ui.projects.operations.members">
<span className={headingText}>{t("projects.subAreas.members")}</span>
{data.members.length === 0 ? (
<EmptyState outlined title={t("projects.empty.members.title")} body={t("projects.empty.members.body")} />
) : (
<Table>
<Table.HeaderRow>
<Table.HeaderCell>{t("projects.fields.userId")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.role")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.actions")}</Table.HeaderCell>
</Table.HeaderRow>
{data.members.map((row) => (
<Table.Row key={row.id}>
<Table.Cell>{row.principal === "projects.fields.none" ? t(row.principal) : row.principal}</Table.Cell>
<Table.Cell><BadgeFeedback farbe="subtle-neutral">{t(row.roleLabelKey)}</BadgeFeedback></Table.Cell>
<Table.Cell>
<Button
size="small"
variant="ghost"
loading={props.submitting}
onClick={() => submitFields(submit, "removeMember", { memberId: row.id })}
>
{t("projects.actions.removeMember")}
</Button>
</Table.Cell>
</Table.Row>
))}
</Table>
)}
</Card>
<Card data-ui-id="ui.projects.operations.members.form">
<span className={headingText}>{t("projects.actions.addMember")}</span>
<Select
showLabel
label={t("projects.fields.principalType")}
value={member.principalType}
onValueChange={(principalType) => setMember((current) => ({ ...current, principalType, userId: "", groupId: "" }))}
className="max-w-none"
>
<Select.Item value="user">{t("projects.fields.principalUser")}</Select.Item>
<Select.Item value="group">{t("projects.fields.principalGroup")}</Select.Item>
</Select>
{member.principalType === "group" ? (
data.groupOptions.length > 0 ? (
<Select
showLabel
label={t("projects.fields.groupId")}
value={member.groupId}
onValueChange={(groupId) => setMember((current) => ({ ...current, groupId }))}
className="max-w-none"
>
{data.groupOptions.map((group) => (
<Select.Item key={group.id} value={group.id}>{group.name}</Select.Item>
))}
</Select>
) : (
<span className={mutedText}>{t("projects.empty.groups.body")}</span>
)
) : props.userOptions && props.userOptions.length > 0 ? (
<Select
showLabel
label={t("projects.fields.userId")}
value={member.userId}
onValueChange={(userId) => setMember((current) => ({ ...current, userId }))}
className="max-w-none"
>
{props.userOptions.map((user) => (
<Select.Item key={user.id} value={user.id}>{user.label}</Select.Item>
))}
</Select>
) : (
<TextInput showLabel label={t("projects.fields.userId")} className="max-w-none">
<TextInput.Input value={member.userId} onChange={(event) => setMember((current) => ({ ...current, userId: event.target.value }))} />
</TextInput>
)}
<Select showLabel label={t("projects.fields.role")} value={member.rolle} onValueChange={(rolle) => setMember((current) => ({ ...current, rolle }))} className="max-w-none">
{["monteur", "projektleiter", "zustaendig", "beobachter"].map((role) => <Select.Item key={role} value={role}>{t(`projects.roles.${role}`)}</Select.Item>)}
</Select>
<Button
loading={props.submitting}
disabled={member.principalType === "group" ? !member.groupId : !member.userId}
onClick={() =>
submitFields(
submit,
"addMember",
member.principalType === "group" ? { groupId: member.groupId, rolle: member.rolle } : { userId: member.userId, rolle: member.rolle }
)
}
>
{t("projects.actions.addMember")}
</Button>
</Card>
</div>
) : null}
{activeTab === "appointments" ? (
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]">
<Card data-ui-id="ui.projects.operations.appointments">
<span className={headingText}>{t("projects.subAreas.appointments")}</span>
{data.appointments.length === 0 ? (
<EmptyState outlined title={t("projects.empty.appointments.title")} body={t("projects.empty.appointments.body")} />
) : (
<Table>
<Table.HeaderRow>
<Table.HeaderCell>{t("projects.fields.appointmentTitle")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.owner")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.startDate")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.stage")}</Table.HeaderCell>
</Table.HeaderRow>
{data.appointments.map((row) => (
<Table.Row key={row.id}>
<Table.Cell>{row.title}</Table.Cell>
<Table.Cell>{row.assignee === "projects.fields.none" ? t(row.assignee) : row.assignee}</Table.Cell>
<Table.Cell>{formatDateTime(row.startAtIso, i18n.language)}</Table.Cell>
<Table.Cell><BadgeFeedback farbe="subtle-information">{t(row.statusLabelKey)}</BadgeFeedback></Table.Cell>
</Table.Row>
))}
</Table>
)}
</Card>
<Card data-ui-id="ui.projects.operations.appointments.form">
<span className={headingText}>{t("projects.actions.createAppointment")}</span>
<TextInput showLabel label={t("projects.fields.appointmentTitle")} className="max-w-none">
<TextInput.Input value={appointment.titel} onChange={(event) => setAppointment((current) => ({ ...current, titel: event.target.value }))} />
</TextInput>
<TextInput showLabel label={t("projects.fields.userId")} className="max-w-none">
<TextInput.Input value={appointment.assignedToUserId} onChange={(event) => setAppointment((current) => ({ ...current, assignedToUserId: event.target.value }))} />
</TextInput>
<TextInput showLabel label={t("projects.fields.startDate")} className="max-w-none">
<TextInput.Input type={DATETIME_INPUT_TYPE} value={appointment.startAt} onChange={(event) => setAppointment((current) => ({ ...current, startAt: event.target.value }))} />
</TextInput>
<TextInput showLabel label={t("projects.fields.deadline")} className="max-w-none">
<TextInput.Input type={DATETIME_INPUT_TYPE} value={appointment.endAt} onChange={(event) => setAppointment((current) => ({ ...current, endAt: event.target.value }))} />
</TextInput>
<Button loading={props.submitting} onClick={() => submitFields(submit, "createAppointment", appointment)}>{t("projects.actions.createAppointment")}</Button>
</Card>
</div>
) : null}
{activeTab === "invoices" ? (
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]">
<Card data-ui-id="ui.projects.operations.invoices">
<span className={headingText}>{t("projects.subAreas.invoices")}</span>
{data.invoices.length === 0 ? (
<EmptyState outlined title={t("projects.empty.invoices.title")} body={t("projects.empty.invoices.body")} />
) : (
<Table>
<Table.HeaderRow>
<Table.HeaderCell>{t("projects.fields.number")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.amount")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.stage")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.deadline")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.actions.updateStatus")}</Table.HeaderCell>
</Table.HeaderRow>
{data.invoices.map((row) => (
<Table.Row key={row.id}>
<Table.Cell>{row.number}</Table.Cell>
<Table.Cell>{row.amount}</Table.Cell>
<Table.Cell><BadgeFeedback farbe={row.status === "bezahlt" ? "subtle-positive" : "subtle-neutral"}>{t(row.statusLabelKey)}</BadgeFeedback></Table.Cell>
<Table.Cell>{formatDate(row.dueAtIso, i18n.language)}</Table.Cell>
<Table.Cell>
<div className="flex flex-wrap items-center gap-2">
<Select value={invoiceStatuses[row.id] ?? row.status} onValueChange={(status) => setInvoiceStatuses((current) => ({ ...current, [row.id]: status }))} className="max-w-[180px]">
{["entwurf", "gestellt", "bezahlt", "storniert"].map((status) => <Select.Item key={status} value={status}>{t(`projects.invoiceStatus.${status}`)}</Select.Item>)}
</Select>
<Button variant="tertiary" size="small" loading={props.submitting} onClick={() => submit("updateInvoiceStatus", { invoiceId: row.id, status: invoiceStatuses[row.id] ?? row.status })}>
{t("projects.actions.save")}
</Button>
</div>
</Table.Cell>
</Table.Row>
))}
</Table>
)}
</Card>
<Card data-ui-id="ui.projects.operations.invoices.form">
<span className={headingText}>{t("projects.actions.createInvoice")}</span>
<TextInput showLabel label={t("projects.fields.amount")} className="max-w-none">
<TextInput.Input type="number" value={invoice.betrag} onChange={(event) => setInvoice((current) => ({ ...current, betrag: event.target.value }))} />
</TextInput>
<TextInput showLabel label={t("projects.fields.startDate")} className="max-w-none">
<TextInput.Input type={DATE_INPUT_TYPE} value={invoice.datum} onChange={(event) => setInvoice((current) => ({ ...current, datum: event.target.value }))} />
</TextInput>
<TextInput showLabel label={t("projects.fields.deadline")} className="max-w-none">
<TextInput.Input type={DATE_INPUT_TYPE} value={invoice.faelligAm} onChange={(event) => setInvoice((current) => ({ ...current, faelligAm: event.target.value }))} />
</TextInput>
<TextInput showLabel label={t("projects.fields.fileId")} className="max-w-none">
<TextInput.Input value={invoice.dateiId} onChange={(event) => setInvoice((current) => ({ ...current, dateiId: event.target.value }))} />
</TextInput>
<Button loading={props.submitting} onClick={() => submitFields(submit, "createInvoice", invoice)}>{t("projects.actions.createInvoice")}</Button>
</Card>
</div>
) : null}
{activeTab === "checklists" ? (
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]">
<Card data-ui-id="ui.projects.operations.checklists">
<span className={headingText}>{t("projects.subAreas.checklists")}</span>
{data.checklists.length === 0 ? (
<EmptyState outlined title={t("projects.empty.checklists.title")} body={t("projects.empty.checklists.body")} />
) : (
<div className="flex flex-col gap-4">
{data.checklists.map((row) => (
<div key={row.id} className="flex flex-col gap-3 rounded-md border border-solid border-border-default p-4">
<div className="flex flex-wrap items-center justify-between gap-2">
<div className="flex flex-col gap-1">
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{row.title}</span>
<span className={mutedText}>{row.itemCount} · {row.openItemCount} {t("projects.checklists.open")}</span>
</div>
<BadgeFeedback farbe="subtle-neutral">{t(row.typeLabelKey)}</BadgeFeedback>
</div>
{row.items.length === 0 ? <span className={mutedText}>{t("projects.empty.checklistItems.body")}</span> : null}
{row.items.map((item) => (
<div key={item.id} className="flex flex-wrap items-center justify-between gap-2 rounded-sm bg-surface-neutral-secondary px-3 py-2">
<span className={mutedText}>{item.title}</span>
<BadgeFeedback farbe={item.status === "erledigt" ? "subtle-positive" : "subtle-neutral"}>{t(item.statusLabelKey)}</BadgeFeedback>
</div>
))}
<div className="flex flex-col gap-2 sm:flex-row">
<TextInput showLabel={false} className="max-w-none">
<TextInput.Input placeholder={t("projects.fields.checklistItem")} value={itemDrafts[row.id] ?? ""} onChange={(event) => setItemDrafts((current) => ({ ...current, [row.id]: event.target.value }))} />
</TextInput>
<Button variant="tertiary" loading={props.submitting} onClick={() => submit("upsertChecklistItem", { checklistId: row.id, titel: itemDrafts[row.id] ?? "" })}>
{t("projects.actions.addItem")}
</Button>
</div>
</div>
))}
</div>
)}
</Card>
<Card data-ui-id="ui.projects.operations.checklists.form">
<span className={headingText}>{t("projects.actions.createChecklist")}</span>
<TextInput showLabel label={t("projects.fields.checklistTitle")} className="max-w-none">
<TextInput.Input value={checklist.titel} onChange={(event) => setChecklist((current) => ({ ...current, titel: event.target.value }))} />
</TextInput>
<Select showLabel label={t("projects.fields.stageKind")} value={checklist.typ} onValueChange={(typ) => setChecklist((current) => ({ ...current, typ }))} className="max-w-none">
<Select.Item value="generisch">{t("projects.checklistTypes.generisch")}</Select.Item>
<Select.Item value="maengel">{t("projects.checklistTypes.maengel")}</Select.Item>
<Select.Item value="abnahme_doku">{t("projects.checklistTypes.abnahmeDoku")}</Select.Item>
</Select>
<Button loading={props.submitting} onClick={() => submitFields(submit, "createChecklist", checklist)}>{t("projects.actions.createChecklist")}</Button>
</Card>
</div>
) : null}
{activeTab === "tasks" ? (
<div className="grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]">
<Card data-ui-id="ui.projects.operations.tasks">
<span className={headingText}>{t("projects.subAreas.tasks")}</span>
{data.tasks.length === 0 ? (
<EmptyState outlined title={t("projects.empty.tasks.title")} body={t("projects.empty.tasks.body")} />
) : (
<Table>
<Table.HeaderRow>
<Table.HeaderCell>{t("projects.fields.taskTitle")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.stage")}</Table.HeaderCell>
<Table.HeaderCell>{t("shared.priority")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.deadline")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.owner")}</Table.HeaderCell>
</Table.HeaderRow>
{data.tasks.map((task) => (
<Table.Row key={task.id}>
<Table.Cell>{task.title}</Table.Cell>
<Table.Cell>
<BadgeFeedback farbe={task.status === "done" ? "subtle-positive" : "subtle-neutral"}>{t(task.statusLabelKey)}</BadgeFeedback>
</Table.Cell>
<Table.Cell>
<BadgeFeedback farbe={task.priority === "urgent" || task.priority === "high" ? "subtle-warning" : "subtle-neutral"}>
{t(task.priorityLabelKey)}
</BadgeFeedback>
</Table.Cell>
<Table.Cell>{formatDate(task.deadlineIso, i18n.language)}</Table.Cell>
<Table.Cell>{task.assignee === "projects.fields.none" ? t(task.assignee) : task.assignee}</Table.Cell>
</Table.Row>
))}
</Table>
)}
</Card>
<Card data-ui-id="ui.projects.operations.tasks.form">
<span className={headingText}>{t("projects.actions.createTask")}</span>
<TextInput showLabel label={t("projects.fields.taskTitle")} className="max-w-none">
<TextInput.Input value={taskDraft} onChange={(event) => setTaskDraft(event.target.value)} />
</TextInput>
<Button
loading={props.submitting}
disabled={!taskDraft.trim()}
onClick={() => {
submitFields(submit, "createTask", { title: taskDraft.trim() });
setTaskDraft("");
}}
>
{t("projects.actions.createTask")}
</Button>
</Card>
</div>
) : null}
{activeTab === "materials" ? (
<Card data-ui-id="ui.projects.operations.materials">
<span className={headingText}>{t("projects.subAreas.materials")}</span>
{data.materials.length === 0 ? (
<EmptyState outlined title={t("projects.empty.materials.title")} body={t("projects.empty.materials.body")} />
) : (
<Table>
<Table.HeaderRow>
<Table.HeaderCell>{t("projects.fields.position")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.description")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.quantity")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.unit")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.unitPrice")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.totalPrice")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.updatedAt")}</Table.HeaderCell>
</Table.HeaderRow>
{data.materials.map((position) => (
<Table.Row key={position.id}>
<Table.Cell>{position.positionNumber}</Table.Cell>
<Table.Cell>
<span>{position.text}</span>
{position.longText ? <span className={mutedText}>{position.longText}</span> : null}
</Table.Cell>
<Table.Cell>{position.quantity}</Table.Cell>
<Table.Cell>{position.unit}</Table.Cell>
<Table.Cell>{position.unitPrice}</Table.Cell>
<Table.Cell>{position.totalPrice}</Table.Cell>
<Table.Cell>{formatDate(position.lastSyncedAtIso, i18n.language)}</Table.Cell>
</Table.Row>
))}
</Table>
)}
</Card>
) : null}
{activeTab === "documents" ? (
<Card data-ui-id="ui.projects.operations.documents">
<span className={headingText}>{t("projects.subAreas.documents")}</span>
{data.documents.length === 0 ? (
<EmptyState outlined title={t("projects.empty.documents.title")} body={t("projects.empty.documents.body")} />
) : (
<Table>
<Table.HeaderRow>
<Table.HeaderCell>{t("projects.fields.fileName")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.fileType")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.fileSize")}</Table.HeaderCell>
<Table.HeaderCell>{t("projects.fields.startDate")}</Table.HeaderCell>
</Table.HeaderRow>
{data.documents.map((document) => (
<Table.Row key={document.id}>
<Table.Cell>{document.name}</Table.Cell>
<Table.Cell><span className={mutedText} title={document.mimeType}>{t(fileTypeLabelKey(document.mimeType))}</span></Table.Cell>
<Table.Cell>{document.sizeLabel}</Table.Cell>
<Table.Cell>{formatDate(document.createdAtIso, i18n.language)}</Table.Cell>
</Table.Row>
))}
</Table>
)}
</Card>
) : null}
</div>
);
}