mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean baseline. Formatting only — no behaviour change. Generator-owned and vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
1 parent
b3fea2ef59
commit
1f4ba5939d
1000 files changed
+12130
-8385
No files matched your search
@@ -11,10 +11,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
|
||||
import { I18nProvider } from "@/lib/i18n/context";
|
||||
import {
|
||||
AnamnesisCard,
|
||||
buildAnamnesisAboutMeBody,
|
||||
} from "../anamnesis-card";
|
||||
import { AnamnesisCard, buildAnamnesisAboutMeBody } from "../anamnesis-card";
|
||||
|
||||
describe("buildAnamnesisAboutMeBody", () => {
|
||||
const empty = { conditions: "", allergies: "" };
|
||||
|
||||
@@ -32,8 +32,9 @@ describe("shouldAutoLaunchTour() — v1.4.47 W5 chain-gate", () => {
|
||||
expect(
|
||||
shouldAutoLaunchTour({
|
||||
onboardingTourCompleted: true,
|
||||
onboardingCompletedAt: new Date(NOW - 365 * 24 * ONE_HOUR_MS)
|
||||
.toISOString(),
|
||||
onboardingCompletedAt: new Date(
|
||||
NOW - 365 * 24 * ONE_HOUR_MS,
|
||||
).toISOString(),
|
||||
nowMs: NOW,
|
||||
}),
|
||||
).toBe(false);
|
||||
@@ -143,8 +144,6 @@ describe("tourIncludesAchievements() — v1.18.0 B5 module gate", () => {
|
||||
});
|
||||
|
||||
it("ignores other disabled modules — only the achievements key matters", () => {
|
||||
expect(
|
||||
tourIncludesAchievements({ sleep: false, mood: false }),
|
||||
).toBe(true);
|
||||
expect(tourIncludesAchievements({ sleep: false, mood: false })).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -17,10 +17,7 @@
|
||||
* in-app tour re-entry trigger.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
tourReferrerKey,
|
||||
tourSessionDismissedKey,
|
||||
} from "../tour-launcher";
|
||||
import { tourReferrerKey, tourSessionDismissedKey } from "../tour-launcher";
|
||||
|
||||
describe("tour-launcher sessionStorage key scoping", () => {
|
||||
it("scopes the dismiss key by user id", () => {
|
||||
|
||||
@@ -63,7 +63,11 @@ export interface AnamnesisCardProps {
|
||||
/** Per-field cap mirrors ABOUT_ME_FIELD_MAX_CHARS on the server. */
|
||||
const FIELD_MAX = 500;
|
||||
|
||||
export function AnamnesisCard({ value, onChange, disabled }: AnamnesisCardProps) {
|
||||
export function AnamnesisCard({
|
||||
value,
|
||||
onChange,
|
||||
disabled,
|
||||
}: AnamnesisCardProps) {
|
||||
const { t } = useTranslations();
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const conditionsId = useId();
|
||||
|
||||
@@ -153,10 +153,7 @@ export function BaselineForm() {
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby="onboarding-baseline-title"
|
||||
className="space-y-6"
|
||||
>
|
||||
<section aria-labelledby="onboarding-baseline-title" className="space-y-6">
|
||||
<header className="space-y-2">
|
||||
<h1
|
||||
id="onboarding-baseline-title"
|
||||
@@ -284,7 +281,9 @@ export function BaselineForm() {
|
||||
disabled={saving}
|
||||
className="min-h-11 min-w-11"
|
||||
>
|
||||
{saving ? <Loader2 className="size-4 animate-spin motion-reduce:animate-none" /> : null}
|
||||
{saving ? (
|
||||
<Loader2 className="size-4 animate-spin motion-reduce:animate-none" />
|
||||
) : null}
|
||||
{t("onboarding.baseline.saveCta")}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -292,4 +291,3 @@ export function BaselineForm() {
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
|
||||
import Link from "next/link";
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
CheckCircle2,
|
||||
FileUp,
|
||||
PlusCircle,
|
||||
Plug,
|
||||
Sparkles,
|
||||
} from "lucide-react";
|
||||
import { CheckCircle2, FileUp, PlusCircle, Plug, Sparkles } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
@@ -109,10 +103,7 @@ export function DoneScreen() {
|
||||
</Link>
|
||||
</Button>
|
||||
<Button asChild size="lg" variant="outline">
|
||||
<Link
|
||||
href="/measurements"
|
||||
className="inline-flex items-center gap-2"
|
||||
>
|
||||
<Link href="/measurements" className="inline-flex items-center gap-2">
|
||||
<PlusCircle className="size-4" />
|
||||
{t("onboarding.done.logCta")}
|
||||
</Link>
|
||||
|
||||
@@ -139,10 +139,7 @@ export function GoalsChipPicker({ userId: _userId }: GoalsChipPickerProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby="onboarding-goals-title"
|
||||
className="space-y-6"
|
||||
>
|
||||
<section aria-labelledby="onboarding-goals-title" className="space-y-6">
|
||||
<header className="space-y-2">
|
||||
<h1
|
||||
id="onboarding-goals-title"
|
||||
@@ -195,7 +192,7 @@ export function GoalsChipPicker({ userId: _userId }: GoalsChipPickerProps) {
|
||||
>
|
||||
<Icon className="size-4" />
|
||||
</span>
|
||||
<span className="text-foreground text-sm font-medium leading-tight">
|
||||
<span className="text-foreground text-sm leading-tight font-medium">
|
||||
{t(option.labelKey)}
|
||||
</span>
|
||||
</label>
|
||||
@@ -230,4 +227,3 @@ export function GoalsChipPicker({ userId: _userId }: GoalsChipPickerProps) {
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,10 @@ export async function OnboardingShell({
|
||||
: t(`onboarding.shell.step${clamped}of4`);
|
||||
|
||||
const primaryLabel =
|
||||
nextLabel ?? (clamped === 4 ? t("onboarding.done.returnCta") : t("onboarding.shell.next"));
|
||||
nextLabel ??
|
||||
(clamped === 4
|
||||
? t("onboarding.done.returnCta")
|
||||
: t("onboarding.shell.next"));
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -117,10 +117,7 @@ export function SourceCardGrid() {
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby="onboarding-source-title"
|
||||
className="space-y-6"
|
||||
>
|
||||
<section aria-labelledby="onboarding-source-title" className="space-y-6">
|
||||
<header className="space-y-2">
|
||||
<h1
|
||||
id="onboarding-source-title"
|
||||
@@ -151,7 +148,7 @@ export function SourceCardGrid() {
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="space-y-3 rounded-lg border border-dashed border-border p-4">
|
||||
<div className="border-border space-y-3 rounded-lg border border-dashed p-4">
|
||||
<div className="flex items-start gap-3">
|
||||
<span
|
||||
aria-hidden="true"
|
||||
@@ -171,12 +168,7 @@ export function SourceCardGrid() {
|
||||
<ul className="flex flex-wrap gap-2" data-testid="source-more-list">
|
||||
{MORE_SOURCES.map((item) => (
|
||||
<li key={item.slug}>
|
||||
<Button
|
||||
asChild
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="min-h-9"
|
||||
>
|
||||
<Button asChild variant="outline" size="sm" className="min-h-9">
|
||||
<Link
|
||||
href="/settings/integrations"
|
||||
data-testid={`source-more-${item.slug}`}
|
||||
@@ -268,7 +260,7 @@ function SourceCardItem({
|
||||
<div className="min-w-0 flex-1">
|
||||
<h2 className="text-base font-semibold tracking-tight">{titleLabel}</h2>
|
||||
{recommendedLabel ? (
|
||||
<span className="bg-primary/10 text-primary mt-1 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide">
|
||||
<span className="bg-primary/10 text-primary mt-1 inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium tracking-wide uppercase">
|
||||
{recommendedLabel}
|
||||
</span>
|
||||
) : null}
|
||||
@@ -318,7 +310,7 @@ function SourceCardItem({
|
||||
aria-pressed={selected}
|
||||
className={cn(
|
||||
baseClasses,
|
||||
"cursor-pointer hover:border-primary/50",
|
||||
"hover:border-primary/50 cursor-pointer",
|
||||
selected && "border-primary bg-primary/5",
|
||||
)}
|
||||
data-testid={`source-card-${card.slug}`}
|
||||
@@ -328,4 +320,3 @@ function SourceCardItem({
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,11 @@ export function TourLauncher({ ready = true }: TourLauncherProps) {
|
||||
// v1.18.6 — stable progress callback so the overlay's checkpoint effect
|
||||
// fires on a real step transition, not on every launcher re-render.
|
||||
const handleProgress = useCallback(
|
||||
(progress: { lastStopId: string | null; completedStopIds: string[]; status: "in_progress" | "completed" | "skipped" }) => {
|
||||
(progress: {
|
||||
lastStopId: string | null;
|
||||
completedStopIds: string[];
|
||||
status: "in_progress" | "completed" | "skipped";
|
||||
}) => {
|
||||
void apiPost("/api/onboarding/tour", {
|
||||
progress: { ...progress, updatedAt: new Date().toISOString() },
|
||||
}).catch(() => {});
|
||||
|
||||
@@ -520,9 +520,7 @@ export function OnboardingTour({
|
||||
const dimRects = rect
|
||||
? [
|
||||
// Top strip — full width above spotlight.
|
||||
rect.top > 0
|
||||
? { top: 0, left: 0, width: vw, height: rect.top }
|
||||
: null,
|
||||
rect.top > 0 ? { top: 0, left: 0, width: vw, height: rect.top } : null,
|
||||
// Bottom strip — full width below spotlight.
|
||||
rect.top + rect.height < vh
|
||||
? {
|
||||
@@ -550,7 +548,12 @@ export function OnboardingTour({
|
||||
height: rect.height,
|
||||
}
|
||||
: null,
|
||||
].filter((r): r is { top: number; left: number; width: number; height: number } => r !== null)
|
||||
].filter(
|
||||
(
|
||||
r,
|
||||
): r is { top: number; left: number; width: number; height: number } =>
|
||||
r !== null,
|
||||
)
|
||||
: null;
|
||||
|
||||
return (
|
||||
@@ -589,31 +592,31 @@ export function OnboardingTour({
|
||||
fully clickable: the user can drive the Hinzufügen dropdown,
|
||||
sidebar links, or header avatar mid-tour and only the
|
||||
tooltip-footer Skip / Back / Next buttons drive tour state. */}
|
||||
{dimRects
|
||||
? dimRects.map((r, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
aria-hidden="true"
|
||||
data-testid="onboarding-tour-dim"
|
||||
className={backdropClass}
|
||||
style={{
|
||||
top: `${r.top}px`,
|
||||
left: `${r.left}px`,
|
||||
width: `${r.width}px`,
|
||||
height: `${r.height}px`,
|
||||
}}
|
||||
/>
|
||||
))
|
||||
: (
|
||||
// Center-placement fallback — no spotlight target available.
|
||||
// Render a single full-cover dim layer. Still purely visual:
|
||||
// skip / back / next live on the tooltip itself.
|
||||
{dimRects ? (
|
||||
dimRects.map((r, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
aria-hidden="true"
|
||||
data-testid="onboarding-tour-dim"
|
||||
className={`${backdropClass} inset-0`}
|
||||
className={backdropClass}
|
||||
style={{
|
||||
top: `${r.top}px`,
|
||||
left: `${r.left}px`,
|
||||
width: `${r.width}px`,
|
||||
height: `${r.height}px`,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
))
|
||||
) : (
|
||||
// Center-placement fallback — no spotlight target available.
|
||||
// Render a single full-cover dim layer. Still purely visual:
|
||||
// skip / back / next live on the tooltip itself.
|
||||
<div
|
||||
aria-hidden="true"
|
||||
data-testid="onboarding-tour-dim"
|
||||
className={`${backdropClass} inset-0`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Polite live region — announces the current step to screen readers. */}
|
||||
<p className="sr-only" aria-live="polite">
|
||||
|
||||
@@ -164,10 +164,7 @@ export function WelcomeCarousel() {
|
||||
}
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby="onboarding-welcome-title"
|
||||
className="space-y-6"
|
||||
>
|
||||
<section aria-labelledby="onboarding-welcome-title" className="space-y-6">
|
||||
<h1
|
||||
id="onboarding-welcome-title"
|
||||
tabIndex={-1}
|
||||
@@ -185,7 +182,7 @@ export function WelcomeCarousel() {
|
||||
className={cn(
|
||||
"flex w-full snap-x snap-mandatory gap-4 overflow-x-auto",
|
||||
// Hide native scrollbar; the dot pager is the visible affordance.
|
||||
"scrollbar-none [-ms-overflow-style:none] [scrollbar-width:none]",
|
||||
"[scrollbar-width:none] scrollbar-none [-ms-overflow-style:none]",
|
||||
"[&::-webkit-scrollbar]:hidden",
|
||||
"scroll-smooth motion-reduce:scroll-auto",
|
||||
)}
|
||||
@@ -282,9 +279,7 @@ export function WelcomeCarousel() {
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() =>
|
||||
scrollToSlide(Math.min(SLIDES.length - 1, active + 1))
|
||||
}
|
||||
onClick={() => scrollToSlide(Math.min(SLIDES.length - 1, active + 1))}
|
||||
disabled={active === SLIDES.length - 1}
|
||||
aria-label={t("onboarding.welcome.nextSlide")}
|
||||
aria-controls={liveRegionId}
|
||||
@@ -335,4 +330,3 @@ export function WelcomeCarousel() {
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user