diff --git a/frontend/src/components/incidents/PostMortemPanel.tsx b/frontend/src/components/incidents/PostMortemPanel.tsx index 1ec6e8c..53ff40d 100644 --- a/frontend/src/components/incidents/PostMortemPanel.tsx +++ b/frontend/src/components/incidents/PostMortemPanel.tsx @@ -73,7 +73,13 @@ export function PostMortemPanel({ incidentId, onPostMortemLoaded }: PostMortemPa Promise.all([ fetchPm(), getAISettings().then((s) => setAiEnabled(s.enabled)).catch(() => setAiEnabled(false)), - listPostMortemTemplates().then(setTemplates).catch(() => setTemplates([])), + listPostMortemTemplates() + .then((data) => { + setTemplates(data) + const first = data[0] + if (first) setSelectedTemplateId(first.id) + }) + .catch(() => setTemplates([])), ]).finally(() => setLoading(false)) }, [fetchPm]) @@ -280,6 +286,16 @@ export function PostMortemPanel({ incidentId, onPostMortemLoaded }: PostMortemPa

No post-mortem yet

Write it yourself or let AI draft it from the incident timeline.

+ {aiEnabled && templates.length > 0 && ( +
+ Template + +
+ )}
)}
@@ -476,6 +494,50 @@ function AIActionsDropdown({ ) } +function TemplatePills({ + templates, + selectedId, + onSelect, +}: { + templates: PostMortemTemplate[] + selectedId: string + onSelect: (id: string) => void +}) { + if (templates.length === 0) return null + const single = templates.length === 1 + return ( +
+ {templates.map((t) => { + const isSelected = t.id === selectedId + if (single) { + return ( + + {t.name} + + ) + } + return ( + + ) + })} +
+ ) +} + function formatRelativeTime(isoString: string): string { const date = new Date(isoString) const now = new Date()