mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +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
@@ -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