fix(chat,analysis,sidebar): compact cards, sparse citations, range + active state

- Chat patient cards are now compact previews (header + key stat + "Click for
  more"); cards size to content (items-start) instead of stretching to the tallest;
  Edit record moved into the summary detail dialog
- AI citations render once per source per message (collapses per-word spam) and the
  prompt now asks the model to cite sparingly (once per paragraph, not per list item)
- Sidebar sub-items use exact-match active state so Meetings no longer lights Inbox
- Analysis defaults to All Time, drops the 12m option, and clamps the chart window
  to >=2 points so 30d/Today render instead of collapsing

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalid Abdi
2026-06-20 01:57:31 +03:00
parent c88b674196
commit e841cb56e1
6 changed files with 77 additions and 101 deletions
@@ -26,13 +26,18 @@ export function hasCitationMarkers(text: string): boolean {
}
// Rewrites [[src:id]] → [n](#cite-id) for known sources; strips unknown markers.
// Each source is cited at most once (its first occurrence) so an over-eager model
// that tags every word with the same source collapses to a single chip.
function withCitationLinks(
text: string,
numberById: Map<string, number>,
): string {
const seen = new Set<string>();
return text.replace(CITATION_RE, (_match, id: string) => {
const num = numberById.get(id);
return num ? `[${num}](${CITE_HREF_PREFIX}${id})` : "";
if (!num || seen.has(id)) return "";
seen.add(id);
return `[${num}](${CITE_HREF_PREFIX}${id})`;
});
}