mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
feat(vorsorge): move cadence into metric row and link heading to filtered results
Drop the grey cadence pill from the card heading. The cadence now reads as part of the metric line, styled like the metric label itself (no shaded background), via a new MedicationCardHeader metricMeta slot. Nothing else sits beside the heading. Link a measurement-linked reminder's heading to the measurements history pre-filtered to its type, reusing the existing kebab target. Free-text reminders keep a plain heading.
This commit is contained in:
1 parent
2803df5275
commit
0623316c12
2 files changed
+40
-8
No files matched your search
@@ -770,11 +770,19 @@ function VorsorgeCard({
|
||||
? t(`measurementReminders.types.${reminder.measurementType}`)
|
||||
: t("measurementReminders.selfPlanned");
|
||||
|
||||
// v1.18.6.1 — the cadence renders as a chip DIRECTLY to the right of the
|
||||
// metric name (the med-card convention: cadence sits next to the name).
|
||||
const cadenceChip = cadence ? (
|
||||
<Badge variant="secondary">{cadence}</Badge>
|
||||
) : null;
|
||||
// v1.18.10 — the cadence reads as part of the METRIC ROW (the category
|
||||
// line), styled like the metric label itself — same muted weight/colour,
|
||||
// no shaded pill. The card heading stays clean (nothing beside it); the
|
||||
// cadence rides next to "Blutdruck" et al. via `metricMeta` below.
|
||||
const cadenceText = cadence || null;
|
||||
|
||||
// v1.18.10 — a measurement-linked reminder's heading links to the
|
||||
// measurements history pre-filtered to its type (the same target the
|
||||
// "Messergebnisse anzeigen" kebab item uses). A free-text reminder has no
|
||||
// readings to show, so it stays a plain (non-linking) heading.
|
||||
const measurementsHref = isLinked
|
||||
? `/measurements?type=${encodeURIComponent(reminder.measurementType as string)}`
|
||||
: undefined;
|
||||
|
||||
// Provenance / disabled state badges keep their own row below the category.
|
||||
// Omit the row entirely when neither applies (don't render an empty band).
|
||||
@@ -900,13 +908,15 @@ function VorsorgeCard({
|
||||
<span className="truncate font-medium">
|
||||
{resolveReminderLabel(reminder, t)}
|
||||
</span>
|
||||
{cadenceChip}
|
||||
</div>
|
||||
{/* v1.18.10 — cadence rides on the metric line, styled like the
|
||||
metric text (no shaded pill). */}
|
||||
<div className="text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs">
|
||||
<span className="text-foreground">
|
||||
{t(`measurementReminders.${due.key}`, { days: due.days })}
|
||||
</span>
|
||||
<span>{categoryLabel}</span>
|
||||
{cadenceText ? <span>{cadenceText}</span> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
@@ -991,7 +1001,13 @@ function VorsorgeCard({
|
||||
name={resolveReminderLabel(reminder, t)}
|
||||
dose=""
|
||||
categoryLabel={categoryLabel}
|
||||
nameChip={cadenceChip}
|
||||
metricMeta={cadenceText}
|
||||
href={measurementsHref}
|
||||
linkLabel={
|
||||
measurementsHref
|
||||
? t("measurementReminders.showMeasurements")
|
||||
: undefined
|
||||
}
|
||||
stateBadges={stateBadges}
|
||||
actions={headerActions}
|
||||
/>
|
||||
|
||||
@@ -43,6 +43,15 @@ export interface MedicationCardHeaderProps {
|
||||
* from `stateBadges` (which ride their own row below the category).
|
||||
*/
|
||||
nameChip?: ReactNode;
|
||||
/**
|
||||
* v1.18.10 — inline text rendered DIRECTLY beside the category label on
|
||||
* line 2 (e.g. the Vorsorge cadence "alle 7 Tage"). Unlike `nameChip`
|
||||
* (a chip on the title line) this reads as part of the metric row itself,
|
||||
* inheriting the muted line's weight/colour rather than a shaded pill, so
|
||||
* the cadence sits next to the metric name without an alarming grey
|
||||
* background.
|
||||
*/
|
||||
metricMeta?: ReactNode;
|
||||
stateBadges?: ReactNode;
|
||||
actions?: ReactNode;
|
||||
/**
|
||||
@@ -60,6 +69,7 @@ export function MedicationCardHeader({
|
||||
dose,
|
||||
categoryLabel,
|
||||
nameChip,
|
||||
metricMeta,
|
||||
stateBadges,
|
||||
actions,
|
||||
href,
|
||||
@@ -81,10 +91,16 @@ export function MedicationCardHeader({
|
||||
State badges now ride their own row below the category
|
||||
badge so the canonical row stays two lines on narrow
|
||||
viewports. */}
|
||||
<div className="text-muted-foreground flex items-center gap-2 text-sm">
|
||||
<div className="text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
|
||||
<Badge variant="outline" className="text-xs">
|
||||
{categoryLabel}
|
||||
</Badge>
|
||||
{/* v1.18.10 — cadence (and any future metric meta) reads as part of
|
||||
the metric line itself: same muted weight/colour as the row, no
|
||||
shaded pill. */}
|
||||
{metricMeta ? (
|
||||
<span className="text-muted-foreground text-xs">{metricMeta}</span>
|
||||
) : null}
|
||||
</div>
|
||||
{stateBadges ? (
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user