mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 23:33:29 +00:00
style: one spacing, title and skeleton language across the app
Icons inside buttons drop their manual margins in favour of the button's built-in gap (two hundred call sites), form field stacks settle on one spacing step, card titles on exactly two sizes, inline field errors on one text size, and a dozen hand-rolled loading pulses move onto the shared skeleton primitive while keeping their silhouettes. The intake dialog wording joins the rest of the app on 'übersprungen', and the UI guidelines now document the two deliberate footer and touch-target systems.
This commit is contained in:
1 parent
4ca3de5ff3
commit
04765ea8ac
92 files changed
+1433
-1445
No files matched your search
@@ -85,9 +85,7 @@ export function ResearchModeAcknowledgmentDialog({
|
||||
const json = await res.json().catch(() => ({}));
|
||||
if (!res.ok) {
|
||||
const code =
|
||||
typeof json?.error === "string"
|
||||
? json.error
|
||||
: `http-${res.status}`;
|
||||
typeof json?.error === "string" ? json.error : `http-${res.status}`;
|
||||
throw new Error(code);
|
||||
}
|
||||
return json?.data ?? null;
|
||||
@@ -137,7 +135,7 @@ export function ResearchModeAcknowledgmentDialog({
|
||||
description={t("medications.researchMode.dialog.intro")}
|
||||
className="sm:max-w-xl"
|
||||
footer={
|
||||
<div className="flex w-full gap-2 sm:justify-end sm:gap-2">
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleCancel}
|
||||
@@ -152,118 +150,118 @@ export function ResearchModeAcknowledgmentDialog({
|
||||
data-slot="research-mode-acknowledge"
|
||||
>
|
||||
{mutation.isPending ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : null}
|
||||
{t("medications.researchMode.dialog.acknowledgeCta")}
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div
|
||||
data-slot="research-mode-acknowledgment-dialog"
|
||||
className="space-y-4 text-sm"
|
||||
<div
|
||||
data-slot="research-mode-acknowledgment-dialog"
|
||||
className="space-y-4 text-sm"
|
||||
>
|
||||
<section
|
||||
aria-labelledby="research-mode-what-it-is"
|
||||
data-slot="research-mode-what-it-is"
|
||||
>
|
||||
<section
|
||||
aria-labelledby="research-mode-what-it-is"
|
||||
data-slot="research-mode-what-it-is"
|
||||
<h3
|
||||
id="research-mode-what-it-is"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-what-it-is"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
{t("medications.researchMode.dialog.whatItIsHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.whatItIs")}
|
||||
</p>
|
||||
</section>
|
||||
{t("medications.researchMode.dialog.whatItIsHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.whatItIs")}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section
|
||||
aria-labelledby="research-mode-what-it-isnt"
|
||||
data-slot="research-mode-what-it-isnt"
|
||||
<section
|
||||
aria-labelledby="research-mode-what-it-isnt"
|
||||
data-slot="research-mode-what-it-isnt"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-what-it-isnt"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-what-it-isnt"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
{t("medications.researchMode.dialog.whatItIsntHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.whatItIsnt")}
|
||||
</p>
|
||||
</section>
|
||||
{t("medications.researchMode.dialog.whatItIsntHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.whatItIsnt")}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section
|
||||
aria-labelledby="research-mode-why-estimate"
|
||||
data-slot="research-mode-why-estimate"
|
||||
<section
|
||||
aria-labelledby="research-mode-why-estimate"
|
||||
data-slot="research-mode-why-estimate"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-why-estimate"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-why-estimate"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
{t("medications.researchMode.dialog.whyEstimateHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.whyEstimate")}
|
||||
</p>
|
||||
</section>
|
||||
{t("medications.researchMode.dialog.whyEstimateHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.whyEstimate")}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section
|
||||
aria-labelledby="research-mode-mdr"
|
||||
data-slot="research-mode-mdr-boundary"
|
||||
className="bg-warning/10 border-warning/30 rounded-md border-l-4 px-3 py-2"
|
||||
<section
|
||||
aria-labelledby="research-mode-mdr"
|
||||
data-slot="research-mode-mdr-boundary"
|
||||
className="bg-warning/10 border-warning/30 rounded-md border-l-4 px-3 py-2"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-mdr"
|
||||
className="text-foreground flex items-center gap-2 font-medium"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-mdr"
|
||||
className="text-foreground flex items-center gap-2 font-medium"
|
||||
>
|
||||
<AlertTriangle
|
||||
className="text-warning h-4 w-4 shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{t("medications.researchMode.dialog.mdrBoundaryHeader")}
|
||||
</h3>
|
||||
<p className="text-foreground/85 mt-1">
|
||||
{t("medications.researchMode.dialog.mdrBoundary")}
|
||||
</p>
|
||||
</section>
|
||||
<AlertTriangle
|
||||
className="text-warning h-4 w-4 shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{t("medications.researchMode.dialog.mdrBoundaryHeader")}
|
||||
</h3>
|
||||
<p className="text-foreground/85 mt-1">
|
||||
{t("medications.researchMode.dialog.mdrBoundary")}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section
|
||||
aria-labelledby="research-mode-citations"
|
||||
data-slot="research-mode-citations"
|
||||
<section
|
||||
aria-labelledby="research-mode-citations"
|
||||
data-slot="research-mode-citations"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-citations"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
<h3
|
||||
id="research-mode-citations"
|
||||
className="text-foreground font-medium"
|
||||
>
|
||||
{t("medications.researchMode.dialog.citationsHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.citations")}
|
||||
</p>
|
||||
</section>
|
||||
{t("medications.researchMode.dialog.citationsHeader")}
|
||||
</h3>
|
||||
<p className="text-muted-foreground mt-1">
|
||||
{t("medications.researchMode.dialog.citations")}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
{currentDisclaimerVersion && (
|
||||
<p
|
||||
className="text-muted-foreground text-xs italic"
|
||||
data-slot="research-mode-version"
|
||||
>
|
||||
{t("medications.researchMode.dialog.versionLine", {
|
||||
version: currentDisclaimerVersion,
|
||||
})}
|
||||
</p>
|
||||
)}
|
||||
{currentDisclaimerVersion && (
|
||||
<p
|
||||
className="text-muted-foreground text-xs italic"
|
||||
data-slot="research-mode-version"
|
||||
>
|
||||
{t("medications.researchMode.dialog.versionLine", {
|
||||
version: currentDisclaimerVersion,
|
||||
})}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{errorMessage && (
|
||||
<p
|
||||
role="alert"
|
||||
className="text-destructive text-sm"
|
||||
data-slot="research-mode-error"
|
||||
>
|
||||
{errorMessage}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{errorMessage && (
|
||||
<p
|
||||
role="alert"
|
||||
className="text-destructive text-sm"
|
||||
data-slot="research-mode-error"
|
||||
>
|
||||
{errorMessage}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</ResponsiveSheet>
|
||||
);
|
||||
}
|
||||
@@ -251,7 +251,7 @@ export function SideEffectsSection({ medicationId }: SideEffectsSectionProps) {
|
||||
setOpen(true);
|
||||
}}
|
||||
>
|
||||
<Plus className="mr-1.5 h-3.5 w-3.5" />
|
||||
<Plus className="h-3.5 w-3.5" />
|
||||
{t("medications.sideEffects.addCta")}
|
||||
</Button>
|
||||
</>
|
||||
@@ -512,7 +512,7 @@ export function SideEffectsSection({ medicationId }: SideEffectsSectionProps) {
|
||||
disabled={createMutation.isPending}
|
||||
>
|
||||
{createMutation.isPending && (
|
||||
<Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none" />
|
||||
)}
|
||||
{t("medications.sideEffects.submitCta")}
|
||||
</Button>
|
||||
|
||||
@@ -36,9 +36,9 @@ export function MedicationIntakeActions({
|
||||
disabled={!!intakeLoading}
|
||||
>
|
||||
{intakeLoading === "take" ? (
|
||||
<Loader2 className="mr-1 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : (
|
||||
<Check className="mr-1 h-4 w-4" />
|
||||
<Check className="h-4 w-4" />
|
||||
)}
|
||||
{t("medications.taken")}
|
||||
</Button>
|
||||
@@ -49,9 +49,9 @@ export function MedicationIntakeActions({
|
||||
disabled={!!intakeLoading}
|
||||
>
|
||||
{intakeLoading === "skip" ? (
|
||||
<Loader2 className="mr-1 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : (
|
||||
<SkipForward className="mr-1 h-4 w-4" />
|
||||
<SkipForward className="h-4 w-4" />
|
||||
)}
|
||||
{t("medications.skipped")}
|
||||
</Button>
|
||||
|
||||
@@ -71,9 +71,7 @@ import { SideEffectsSection } from "@/components/medications/SideEffectsSection"
|
||||
import { ChartSkeleton } from "@/components/charts/chart-skeleton";
|
||||
import { estimateRunwayDays } from "@/components/medications/detail/supply-runway";
|
||||
import { MedicationWizardDialog } from "@/components/medications/wizard/MedicationWizardDialog";
|
||||
import {
|
||||
parseScheduleRecurrence,
|
||||
} from "@/lib/medication-schedule";
|
||||
import { parseScheduleRecurrence } from "@/lib/medication-schedule";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { queryKeys } from "@/lib/query-keys";
|
||||
import { useTranslations, useFormatters } from "@/lib/i18n/context";
|
||||
@@ -234,8 +232,7 @@ export function MedicationDetailTabs({
|
||||
// medications, so a stale `?tab=injektion` deep-link falls back to the
|
||||
// landing tab instead of rendering an empty surface.
|
||||
const availableTabs = useMemo<TabSlug[]>(
|
||||
() =>
|
||||
TAB_SLUGS.filter((slug) => slug !== "injektion" || isInjectable),
|
||||
() => TAB_SLUGS.filter((slug) => slug !== "injektion" || isInjectable),
|
||||
[isInjectable],
|
||||
);
|
||||
|
||||
@@ -322,9 +319,7 @@ export function MedicationDetailTabs({
|
||||
staleTime: 30_000,
|
||||
});
|
||||
|
||||
const inventoryItems = Array.isArray(inventory?.items)
|
||||
? inventory.items
|
||||
: [];
|
||||
const inventoryItems = Array.isArray(inventory?.items) ? inventory.items : [];
|
||||
const liveItems = inventoryItems.filter((i) => i.state !== "USED_UP");
|
||||
const dosesRemaining = liveItems.reduce(
|
||||
(sum, i) => sum + i.dosesRemaining,
|
||||
@@ -337,7 +332,7 @@ export function MedicationDetailTabs({
|
||||
<div className="space-y-6" data-slot="medication-detail-page">
|
||||
<Button variant="ghost" size="sm" className="-ml-2 w-fit" asChild>
|
||||
<Link href="/medications">
|
||||
<ArrowLeft aria-hidden="true" className="mr-1 size-4" />
|
||||
<ArrowLeft aria-hidden="true" className="size-4" />
|
||||
{t("medications.back")}
|
||||
</Link>
|
||||
</Button>
|
||||
@@ -587,9 +582,7 @@ export function MedicationDetailTabs({
|
||||
<DoseStrengthCurve medicationId={id} />
|
||||
</div>
|
||||
)}
|
||||
{!isGlp1 && (
|
||||
<DoseStrengthCurve medicationId={id} />
|
||||
)}
|
||||
{!isGlp1 && <DoseStrengthCurve medicationId={id} />}
|
||||
</TabsContent>
|
||||
)}
|
||||
|
||||
|
||||
@@ -35,10 +35,7 @@ import { Label } from "@/components/ui/label";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { useTranslations } from "@/lib/i18n/context";
|
||||
import {
|
||||
invalidateKeys,
|
||||
medicationDependentKeys,
|
||||
} from "@/lib/query-keys";
|
||||
import { invalidateKeys, medicationDependentKeys } from "@/lib/query-keys";
|
||||
import type { QueryKey } from "@tanstack/react-query";
|
||||
import type { LedgerSchedule } from "@/components/medications/dose-history-ledger";
|
||||
|
||||
@@ -187,7 +184,10 @@ export function LedgerAddDialog({
|
||||
{ name: medicationName },
|
||||
),
|
||||
);
|
||||
await invalidateKeys(queryClient, [...medicationDependentKeys, ledgerKey]);
|
||||
await invalidateKeys(queryClient, [
|
||||
...medicationDependentKeys,
|
||||
ledgerKey,
|
||||
]);
|
||||
setNudgeOpen(false);
|
||||
onOpenChange(false);
|
||||
} catch {
|
||||
@@ -220,7 +220,7 @@ export function LedgerAddDialog({
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-1">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="ledger-add-taken-at">
|
||||
{t("medications.detail.verlauf.addDialog.takenAtLabel")}
|
||||
</Label>
|
||||
@@ -277,7 +277,7 @@ export function LedgerAddDialog({
|
||||
data-slot="ledger-add-submit"
|
||||
>
|
||||
{busy && (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
)}
|
||||
{t("medications.detail.verlauf.addDialog.submit")}
|
||||
</Button>
|
||||
@@ -317,7 +317,7 @@ export function LedgerAddDialog({
|
||||
data-slot="ledger-add-nudge-pin"
|
||||
>
|
||||
{busy && (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
)}
|
||||
{t("medications.detail.verlauf.nudge.pin")}
|
||||
</Button>
|
||||
|
||||
@@ -163,7 +163,7 @@ function IntakeEditDialogBody({
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-1">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="intake-edit-taken-at">
|
||||
{t("medications.detail.intake.edit.takenAtLabel")}
|
||||
</Label>
|
||||
@@ -220,7 +220,7 @@ function IntakeEditDialogBody({
|
||||
aria-busy={busy || undefined}
|
||||
>
|
||||
{busy && (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
)}
|
||||
{t("medications.detail.intake.edit.save")}
|
||||
</Button>
|
||||
|
||||
@@ -156,7 +156,7 @@ export function IntakeImportDialog({
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{t("medications.importDescription")}
|
||||
</p>
|
||||
<div className="space-y-1.5">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="intake-import-file" className="text-xs font-medium">
|
||||
{t("medications.importUploadFile")}
|
||||
</Label>
|
||||
@@ -236,9 +236,9 @@ export function IntakeImportDialog({
|
||||
className="min-h-11 sm:min-h-9"
|
||||
>
|
||||
{importing ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : (
|
||||
<Upload className="mr-2 h-4 w-4" />
|
||||
<Upload className="h-4 w-4" />
|
||||
)}
|
||||
{t("common.import")}
|
||||
</Button>
|
||||
|
||||
@@ -174,7 +174,7 @@ export function LogInjectionSiteDialog({
|
||||
}}
|
||||
>
|
||||
{submitting ? (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
) : null}
|
||||
{t("medications.logInjectionSiteConfirm")}
|
||||
</Button>
|
||||
|
||||
@@ -189,7 +189,7 @@ export function LogIntakeDialog({
|
||||
</p>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-1">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="log-intake-medication">
|
||||
{t("medications.logIntake.medicationLabel")}
|
||||
</Label>
|
||||
@@ -207,7 +207,7 @@ export function LogIntakeDialog({
|
||||
</div>
|
||||
|
||||
{slotTimes.length > 0 && (
|
||||
<div className="space-y-1">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="log-intake-slot">
|
||||
{t("medications.logIntake.slotLabel")}
|
||||
</Label>
|
||||
@@ -228,7 +228,7 @@ export function LogIntakeDialog({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-1">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="log-intake-taken-at">
|
||||
{t("medications.logIntake.takenAtLabel")}
|
||||
</Label>
|
||||
@@ -275,7 +275,7 @@ export function LogIntakeDialog({
|
||||
aria-busy={busy || undefined}
|
||||
>
|
||||
{busy && (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
)}
|
||||
{t("medications.logIntake.submit")}
|
||||
</Button>
|
||||
|
||||
@@ -131,7 +131,7 @@ export function CourseWindowRow({
|
||||
<div className="space-y-3" data-slot="course-window-row">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end">
|
||||
{/* startsOn */}
|
||||
<div className="flex-1 space-y-1.5">
|
||||
<div className="flex-1 space-y-2">
|
||||
<Label htmlFor={startId} className="text-sm">
|
||||
{t(`${i18nPrefix}.startsOn.label`)}
|
||||
</Label>
|
||||
@@ -148,7 +148,7 @@ export function CourseWindowRow({
|
||||
</div>
|
||||
|
||||
{/* endsOn */}
|
||||
<div className="flex-1 space-y-1.5">
|
||||
<div className="flex-1 space-y-2">
|
||||
<Label htmlFor={endId} className="text-sm">
|
||||
{t(`${i18nPrefix}.endsOn.label`)}
|
||||
</Label>
|
||||
@@ -156,9 +156,7 @@ export function CourseWindowRow({
|
||||
id={endId}
|
||||
type="date"
|
||||
value={endsIso}
|
||||
disabled={
|
||||
disabled || noEndDate || lockEndsToStart
|
||||
}
|
||||
disabled={disabled || noEndDate || lockEndsToStart}
|
||||
readOnly={lockEndsToStart}
|
||||
onChange={(e) => onEndsChange(e.target.value)}
|
||||
className="h-11 w-full"
|
||||
@@ -199,7 +197,7 @@ export function CourseWindowRow({
|
||||
|
||||
{!valid && (
|
||||
<p
|
||||
className="text-destructive text-xs"
|
||||
className="text-destructive text-sm"
|
||||
role="alert"
|
||||
data-slot="course-window-error"
|
||||
>
|
||||
|
||||
@@ -68,10 +68,7 @@ export function DoseWindowEditor({
|
||||
const generatedId = useId();
|
||||
const prefix = idPrefix ?? generatedId;
|
||||
|
||||
const rows = useMemo(
|
||||
() => buildRows(timesOfDay, value),
|
||||
[timesOfDay, value],
|
||||
);
|
||||
const rows = useMemo(() => buildRows(timesOfDay, value), [timesOfDay, value]);
|
||||
|
||||
// Rebuild the persisted set from the next row state and bubble it up.
|
||||
const emit = useCallback(
|
||||
@@ -84,9 +81,7 @@ export function DoseWindowEditor({
|
||||
const setRow = useCallback(
|
||||
(timeOfDay: string, patch: Partial<DoseWindowRow>) => {
|
||||
emit(
|
||||
rows.map((r) =>
|
||||
r.timeOfDay === timeOfDay ? { ...r, ...patch } : r,
|
||||
),
|
||||
rows.map((r) => (r.timeOfDay === timeOfDay ? { ...r, ...patch } : r)),
|
||||
);
|
||||
},
|
||||
[emit, rows],
|
||||
@@ -201,7 +196,7 @@ export function DoseWindowEditor({
|
||||
isValidHhmm(row.end) &&
|
||||
!ordered ? (
|
||||
<p
|
||||
className="text-destructive text-xs"
|
||||
className="text-destructive text-sm"
|
||||
role="alert"
|
||||
data-slot="dose-window-error"
|
||||
>
|
||||
|
||||
@@ -273,7 +273,7 @@ export function TimesOfDayChips({
|
||||
aria-label={t(`${i18nPrefix}.add`)}
|
||||
data-slot="times-of-day-add"
|
||||
>
|
||||
<Plus className="mr-1 h-4 w-4" aria-hidden="true" />
|
||||
<Plus className="h-4 w-4" aria-hidden="true" />
|
||||
{t(`${i18nPrefix}.add`)}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -156,7 +156,7 @@ export function DataPortabilityRow({
|
||||
{t("medications.detail.advanced.dataPortability.export.button")}
|
||||
</Button>
|
||||
{error && (
|
||||
<p role="alert" className="text-destructive text-xs">
|
||||
<p role="alert" className="text-destructive text-sm">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -311,7 +311,7 @@ function PhaseConfigForm({
|
||||
{saving && (
|
||||
<Loader2
|
||||
aria-hidden="true"
|
||||
className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none"
|
||||
className="h-4 w-4 animate-spin motion-reduce:animate-none"
|
||||
/>
|
||||
)}
|
||||
{t("common.save")}
|
||||
|
||||
@@ -27,13 +27,7 @@
|
||||
* dialog reaches a new locale.
|
||||
*/
|
||||
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { toast } from "sonner";
|
||||
@@ -189,15 +183,17 @@ function WizardDialogShell({
|
||||
// payload validates every gate, so the ceiling is the whole path.
|
||||
const reachableUntil = useMemo(
|
||||
() =>
|
||||
Math.max(fallbackIndex, firstInvalidIndex(payload, stepList, fallbackIndex)),
|
||||
Math.max(
|
||||
fallbackIndex,
|
||||
firstInvalidIndex(payload, stepList, fallbackIndex),
|
||||
),
|
||||
[payload, stepList, fallbackIndex],
|
||||
);
|
||||
// Jump-to-last is enabled only when the WHOLE path validates — i.e.
|
||||
// every step from the first slot onward passes its gate, so a single
|
||||
// tap can land the user on the review step without stranding them
|
||||
// behind an unmet requirement.
|
||||
const lastReachable =
|
||||
firstInvalidIndex(payload, stepList, 0) >= totalSteps;
|
||||
const lastReachable = firstInvalidIndex(payload, stepList, 0) >= totalSteps;
|
||||
|
||||
const canContinue = useMemo(
|
||||
() => validateStep(payload, step),
|
||||
@@ -345,16 +341,7 @@ function WizardDialogShell({
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
}, [
|
||||
initial,
|
||||
mode,
|
||||
onOpenChange,
|
||||
onSuccess,
|
||||
payload,
|
||||
queryClient,
|
||||
router,
|
||||
t,
|
||||
]);
|
||||
}, [initial, mode, onOpenChange, onSuccess, payload, queryClient, router, t]);
|
||||
|
||||
const Icon = STEP_ICONS[step];
|
||||
|
||||
@@ -445,7 +432,7 @@ function WizardDialogShell({
|
||||
className="h-11"
|
||||
>
|
||||
{submitting && (
|
||||
<Loader2 className="mr-2 h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
<Loader2 className="h-4 w-4 animate-spin motion-reduce:animate-none" />
|
||||
)}
|
||||
{primaryCtaLabel}
|
||||
</Button>
|
||||
@@ -495,10 +482,7 @@ function WizardDialogShell({
|
||||
data-slot="wizard-nl-button"
|
||||
aria-label={t("medications.wizard.nl.button")}
|
||||
>
|
||||
<Sparkles
|
||||
className="h-3.5 w-3.5"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<Sparkles className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
{t("medications.wizard.nl.button")}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -515,7 +499,7 @@ function WizardDialogShell({
|
||||
snaps the step. The slide proposed in D-2 was stripped. */}
|
||||
<div
|
||||
ref={bodyRef}
|
||||
className="flex flex-col gap-6 p-4 pr-12 sm:gap-8 sm:p-6 sm:pr-14 animate-in fade-in-0 duration-200 motion-reduce:animate-none"
|
||||
className="animate-in fade-in-0 flex flex-col gap-6 p-4 pr-12 duration-200 motion-reduce:animate-none sm:gap-8 sm:p-6 sm:pr-14"
|
||||
data-slot="wizard-step-body"
|
||||
key={step}
|
||||
>
|
||||
@@ -545,13 +529,11 @@ function WizardDialogShell({
|
||||
<h2
|
||||
ref={stepTitleRef}
|
||||
tabIndex={-1}
|
||||
className="text-foreground text-base font-semibold leading-tight tracking-tight focus-visible:outline-none"
|
||||
className="text-foreground text-base leading-tight font-semibold tracking-tight focus-visible:outline-none"
|
||||
>
|
||||
{stepTitle}
|
||||
</h2>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{stepSubline}
|
||||
</p>
|
||||
<p className="text-muted-foreground text-sm">{stepSubline}</p>
|
||||
{/* v1.8.6 W4b — muted "what's next" hint so the user
|
||||
knows what the Next tap leads to (or, on the final
|
||||
slot, that Next saves). */}
|
||||
@@ -582,10 +564,7 @@ function WizardDialogShell({
|
||||
<Step4Window payload={payload} applyPartial={applyPartial} />
|
||||
)}
|
||||
{step === 5 && (
|
||||
<Step5Cadence
|
||||
payload={payload}
|
||||
applyPartial={applyPartial}
|
||||
/>
|
||||
<Step5Cadence payload={payload} applyPartial={applyPartial} />
|
||||
)}
|
||||
{step === 6 && (
|
||||
<Step6SubCadence
|
||||
@@ -594,10 +573,7 @@ function WizardDialogShell({
|
||||
/>
|
||||
)}
|
||||
{step === 7 && (
|
||||
<Step7Times
|
||||
payload={payload}
|
||||
applyPartial={applyPartial}
|
||||
/>
|
||||
<Step7Times payload={payload} applyPartial={applyPartial} />
|
||||
)}
|
||||
{step === 8 && (
|
||||
<Step8Summary
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface StepProps {
|
||||
export function Step1Name({ payload, applyPartial }: StepProps) {
|
||||
const { t } = useTranslations();
|
||||
return (
|
||||
<div className="space-y-1.5" data-slot="wizard-step1">
|
||||
<div className="space-y-2" data-slot="wizard-step1">
|
||||
<Label htmlFor="wizard-name" className="sr-only">
|
||||
{t("medications.wizard.steps.step1.label")}
|
||||
</Label>
|
||||
|
||||
@@ -65,16 +65,14 @@ export function Step3Dose({ payload, applyPartial }: StepProps) {
|
||||
if (checked) current.add(site);
|
||||
else current.delete(site);
|
||||
applyPartial({
|
||||
allowedInjectionSites: INJECTION_SITE_KEYS.filter((s) =>
|
||||
current.has(s),
|
||||
),
|
||||
allowedInjectionSites: INJECTION_SITE_KEYS.filter((s) => current.has(s)),
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6" data-slot="wizard-step3">
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="space-y-1.5">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="wizard-dose-amount" className="text-sm">
|
||||
{t("medications.wizard.steps.step3.amountLabel")}
|
||||
</Label>
|
||||
@@ -90,7 +88,7 @@ export function Step3Dose({ payload, applyPartial }: StepProps) {
|
||||
enterKeyHint="next"
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="wizard-dose-unit" className="text-sm">
|
||||
{t("medications.wizard.steps.step3.unitLabel")}
|
||||
</Label>
|
||||
@@ -116,7 +114,7 @@ export function Step3Dose({ payload, applyPartial }: StepProps) {
|
||||
the Step 2 treatment row so an INJECTION delivery surfaces the
|
||||
rotation map for any class, not only GLP-1. */}
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="space-y-1.5">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="wizard-delivery-form" className="text-sm">
|
||||
{t("medications.wizard.steps.step3.deliveryFormLabel")}
|
||||
</Label>
|
||||
@@ -138,7 +136,7 @@ export function Step3Dose({ payload, applyPartial }: StepProps) {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="wizard-doses-per-unit" className="text-sm">
|
||||
{t("medications.wizard.steps.step3.dosesPerUnitLabel")}
|
||||
</Label>
|
||||
|
||||
Reference in new issue
Block a user