// AK-P17b Interim-UI (AD-28) — announcement detail composed from ~/ui (D-HR // "Ankündigung Detail", archetype A3). Pure presentational: markdown body, // reaction toggles, single-level comments, acknowledgement, and a manager // read-receipt table. Actions run through injected callbacks (route owns the // fetcher). Final Subframe optics = tracked design-nachzug. import { useState } from "react"; import { useTranslation } from "react-i18next"; import type { HrAnnouncementDetailVM } from "@hivegrid/view-models"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; import { Card } from "~/ui/components/Card"; import { Table } from "~/ui/components/Table"; import { TextInput } from "~/ui/components/TextInput"; const REACTIONS = ["👍", "❤️", "🎉", "👀"] as const; export type HrAnnouncementDetailActions = { onAck: () => void; onReact: (reaction: string) => void; onComment: (body: string) => void; }; export type HrAnnouncementDetailPageProps = { vm: HrAnnouncementDetailVM; submitting: boolean; actions: HrAnnouncementDetailActions; }; export function HrAnnouncementDetailPage({ vm, submitting, actions }: HrAnnouncementDetailPageProps) { const { t } = useTranslation(); const [comment, setComment] = useState(""); const data = vm.data; if (vm.status !== "ready" || !data) { return
; } return (
{data.title} {data.authorLabel}
{data.bodyMarkdown} {data.requiresAcknowledgement ? (
{data.isAcknowledged ? ( {t("hr.announcements.acknowledged")} ) : ( )}
) : null}
{REACTIONS.map((emoji) => { const group = data.reactions.find((r) => r.reaction === emoji); return ( ); })}
{t("hr.announcements.comments.title")} {data.comments.length === 0 ? ( {t(data.commentEmptyKey)} ) : ( data.comments.map((c) => (
{c.authorLabel} {c.body}
)) )}
setComment(e.target.value)} placeholder={t("hr.announcements.comments.placeholder")} />
{data.canManage && data.readReceipts.length > 0 ? (
{t("hr.announcements.receipts.title")}
{t("hr.announcements.receipts.user")}{t("hr.announcements.receipts.acknowledged")} } > {data.readReceipts.map((receipt) => ( {receipt.userLabel} {receipt.acknowledged ? ( {t("hr.announcements.acknowledged")} ) : ( — )} ))}
) : null}
); }