Ship C3 mobilization events with the actionPlan collection, list/detail/forms UI, upcoming-event blocks, access control, and migration.
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { MessageSquareTextIcon } from 'lucide-react'
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/Empty'
|
|
import { formatBahiaDateTimeLabel } from '@/utilities/campaignTime'
|
|
import type { ActionPlanUpdateViewModel } from '@/utilities/actionPlanViewModels'
|
|
|
|
const UpdateCard = ({ update }: { update: ActionPlanUpdateViewModel }) => (
|
|
<article>
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle className="text-base">{update.authorName ?? 'Autor removido'}</CardTitle>
|
|
<p className="text-sm text-muted-foreground">
|
|
{update.createdAt ? formatBahiaDateTimeLabel(update.createdAt) : ''}
|
|
</p>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<p className="whitespace-pre-wrap">{update.body}</p>
|
|
</CardContent>
|
|
</Card>
|
|
</article>
|
|
)
|
|
|
|
export const ActionPlanUpdateFeed = ({ updates }: { updates: ActionPlanUpdateViewModel[] }) => {
|
|
if (!updates.length) {
|
|
return (
|
|
<Empty className="border">
|
|
<EmptyHeader>
|
|
<EmptyMedia variant="icon">
|
|
<MessageSquareTextIcon aria-hidden="true" />
|
|
</EmptyMedia>
|
|
<EmptyTitle>Nenhuma atualização registrada</EmptyTitle>
|
|
<EmptyDescription>
|
|
Envie o primeiro reporte para iniciar o histórico cronológico deste plano.
|
|
</EmptyDescription>
|
|
</EmptyHeader>
|
|
</Empty>
|
|
)
|
|
}
|
|
|
|
const sortedUpdates = [...updates].reverse()
|
|
|
|
return (
|
|
<div className="flex flex-col gap-4">
|
|
{sortedUpdates.map((update, index) => (
|
|
<UpdateCard key={update.id ?? index} update={update} />
|
|
))}
|
|
</div>
|
|
)
|
|
}
|