diff --git a/apps/web/messages/it.json b/apps/web/messages/it.json index ac87952..892e972 100644 --- a/apps/web/messages/it.json +++ b/apps/web/messages/it.json @@ -16,6 +16,12 @@ "viewTracking": "Pesata & misure", "viewFasting": "Digiuno intermittente", "viewBilling": "Abbonamento & fatture", + "navPlan": "Cucina", + "navTracking": "Tracking", + "navFasting": "Digiuno", + "navShopping": "Spesa", + "navProfile": "Profilo", + "navBilling": "Abbonamento", "lettura": "Continua la lettura", "inizia": "Inizia", "greeting": "Buongiorno, {name}.", diff --git a/apps/web/src/app/[locale]/billing/page.tsx b/apps/web/src/app/[locale]/billing/page.tsx index 81579bd..2685615 100644 --- a/apps/web/src/app/[locale]/billing/page.tsx +++ b/apps/web/src/app/[locale]/billing/page.tsx @@ -39,7 +39,7 @@ function BillingPageContent({ status }: { status: BillingStatus | null }) { return (
- +

{t('errorLoading')}

@@ -54,7 +54,7 @@ function BillingPageContent({ status }: { status: BillingStatus | null }) { return (
- +
- +
- + {userName ? ( ) : ( diff --git a/apps/web/src/app/[locale]/plan/page.tsx b/apps/web/src/app/[locale]/plan/page.tsx index 64d7639..ae6d782 100644 --- a/apps/web/src/app/[locale]/plan/page.tsx +++ b/apps/web/src/app/[locale]/plan/page.tsx @@ -64,7 +64,7 @@ function PlanPageContent({ return (
- +
- +
- +
- +
- +
= [ + { href: '/plan', key: 'navPlan' }, + { href: '/tracking', key: 'navTracking' }, + { href: '/fasting', key: 'navFasting' }, + { href: '/shopping', key: 'navShopping' }, + { href: '/profile', key: 'navProfile' }, + { href: '/billing', key: 'navBilling' }, +]; + /** - * Top-of-page header minimale: logo a sinistra, sezione corrente a destra (se - * fornita). Una riga sottile sotto fa da divider editoriale. + * Top-of-page header dell'app. Logo a sx, nav orizzontale al centro/destra + * (desktop) o hamburger drawer (mobile). Pagina corrente evidenziata in + * pomodoro. Una riga sottile sotto fa da divider editoriale. */ -export function Masthead({ issueLabel, className }: MastheadProps) { +export function Masthead({ issueLabel, showNav = false, className }: MastheadProps) { + const t = useTranslations('Home'); + const pathname = usePathname(); + const [open, setOpen] = useState(false); + + // Quando il pathname cambia, chiudi il drawer mobile (utente ha navigato). + useEffect(() => setOpen(false), [pathname]); + + // Match di fallback: il pathname è tipo /it/plan, dobbiamo confrontare + // ignorando il segmento di locale. Usiamo `.includes('/plan')` con + // controllo che inizi con //plan oppure /plan. + function isActive(href: string): boolean { + if (!pathname) return false; + // strip locale prefix se presente + const stripped = pathname.replace(/^\/[a-z]{2}(\/|$)/, '/'); + if (href === '/') return stripped === '/'; + return stripped.startsWith(href); + } + return (
-
+
KetoPath. - {issueLabel ?

{issueLabel}

: null} + + {showNav ? ( + <> + {/* Desktop nav */} + + + {/* Mobile: hamburger button */} + + + ) : issueLabel ? ( +

{issueLabel}

+ ) : null}
+ + {/* Mobile drawer: appare sotto la riga di header */} + {showNav && open ? ( + + ) : null} +
);