From 5509f8c15a166f5196e0ac4ddf9a87525a688488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Mon, 8 Jun 2026 18:51:18 +0200 Subject: [PATCH] feat(insights): remove the inline "Anpassen" toggle from the overview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Customising the overview and sorting the nav pills now live only in Settings → Insights, reached via the top-right cog. The in-page edit mode and its toggle are gone — a single entry point, no duplicate. The "every section hidden" empty-state now links to the Insights settings section instead of reopening an in-page editor. --- src/app/insights/page.tsx | 101 ++++++-------------------------------- 1 file changed, 16 insertions(+), 85 deletions(-) diff --git a/src/app/insights/page.tsx b/src/app/insights/page.tsx index 544370864..cf35a6376 100644 --- a/src/app/insights/page.tsx +++ b/src/app/insights/page.tsx @@ -1,6 +1,6 @@ "use client"; -import { Fragment, useRef, useState, type ReactNode } from "react"; +import { Fragment, type ReactNode } from "react"; import { useQuery } from "@tanstack/react-query"; import dynamic from "next/dynamic"; import Link from "next/link"; @@ -21,7 +21,6 @@ import { EmptyState } from "@/components/ui/empty-state"; import { Skeleton } from "@/components/ui/skeleton"; import { cn } from "@/lib/utils"; import { HeroStrip } from "@/components/insights/hero-strip"; -import { InsightsEditMode } from "@/components/insights/insights-edit-mode"; import { useInsightsAdvisorQuery } from "@/components/insights/use-insights-advisor"; import { useCoachLaunch } from "@/lib/insights/coach-launch-context"; import { useAnalyticsQuery } from "@/lib/queries/use-analytics-query"; @@ -283,27 +282,11 @@ export default function InsightsPage() { // per-tile order/visibility (passed into ). Defaults to // the canonical layout while in-flight so the first paint matches the // default order with no flicker. - const { - layout, - isLoading: layoutLoading, - } = useInsightsLayoutQuery(isAuthenticated); - - // v1.15.11 W3 — inline "Anpassen" edit mode. When on, the customizable - // region swaps the live (heavy) sections for lightweight edit cards; the - // section data is never refetched (the queries stay mounted via the page's - // own hooks but the section JSX is replaced). HeroStrip stays anchored. - const [editMode, setEditMode] = useState(false); - - // v1.15.11 QA L5 — focus restoration. On entering edit mode focus moves to - // the edit-card heading; on close/save focus returns to the "Anpassen" - // toggle so keyboard users are not dropped at the top of the document. - const customizeToggleRef = useRef(null); - - // v1.15.11 QA L1 — never let a "Fertig" save flush DEFAULT_INSIGHTS_LAYOUT - // over the user's real saved layout. The editor seeds its draft once from - // the `layout` prop, which is the default while the GET is in-flight, so the - // edit surface stays gated (the toggle disabled) until the query has settled. - const canEdit = !layoutLoading; + // v1.15.18 — the overview layout (sections + tiles) still drives the section + // render order/visibility + the Vitals grid below. CUSTOMISING it (and the + // nav-pill order) moved out of an in-page "Anpassen" edit mode into + // Settings → Insights, reached via the top-right cog on the tab strip. + const { layout } = useInsightsLayoutQuery(isAuthenticated); // Error branch — a transient 500 / network drop (after the query's // retries are exhausted) settles the comprehensive query with no data. @@ -450,21 +433,6 @@ export default function InsightsPage() { "rhythm-events": , }; - // v1.15.11 W3 — sections whose feature/data gate is currently OFF. The edit - // row for these renders disabled with a hint so a toggle that does nothing - // never confuses the user (it stays orderable, just not enable-able past the - // gate). Mirrors the `null` registry entries above: `daily-briefing` + - // `period-review` ride the briefing flag; `cycle-summary` rides the cycle - // opt-in. Every other section is always available. - const gatedOffSectionIds = new Set(); - if (!flags.briefing) { - gatedOffSectionIds.add("daily-briefing"); - gatedOffSectionIds.add("period-review"); - } - if (!user?.cycleTrackingEnabled) { - gatedOffSectionIds.add("cycle-summary"); - } - const orderedSectionIds = orderedVisibleSectionIds(layout); const everySectionHidden = orderedSectionIds.length === 0; @@ -497,58 +465,21 @@ export default function InsightsPage() { healthScore={analytics?.healthScore ?? undefined} /> - {/* v1.15.11 W3 — the "Anpassen" toggle sits at the top of the - customizable region, below the anchored HeroStrip. v1.15.11 QA - L2-design: the toggle is HIDDEN while editing — the InsightsEditMode - card owns save (Fertig) + reset (Zurücksetzen), so a second top-right - "Fertig" that only closes-without-saving (a label-collision trap) no - longer exists. The toggle only ENTERS edit mode; the component's - Fertig/Zurücksetzen → onClose returns here. QA L1: disabled until the - layout query settles so a save can never flush defaults. */} - {!editMode && ( -
- -
- )} - - {editMode ? ( - /* v1.15.11 W3 — edit mode swaps the live, heavy sections for the - lightweight edit cards. The section data queries stay mounted on the - page, but their JSX is not rendered, so toggling into edit mode never - refetches. */ - { - setEditMode(false); - // v1.15.11 QA L5 — return focus to the toggle that reappears. - requestAnimationFrame(() => customizeToggleRef.current?.focus()); - }} - /> - ) : everySectionHidden ? ( - /* v1.15.11 W3 — empty-state: every section hidden. The page is never - blank — surface a hint + a button that opens edit mode so the user - can bring sections back. */ + {/* v1.15.18 — the inline "Anpassen" toggle was removed. Customising the + overview (section show/hide + order) and sorting the nav pills now + live ONLY in Settings → Insights, reached via the top-right cog on the + tab strip — no duplicate in-page entry point. */} + {everySectionHidden ? ( + /* v1.15.18 — empty-state: every section hidden. The page is never + blank — surface a hint + a link to the Insights settings section so + the user can bring sections back. */ } title={t("insights.editMode.emptyTitle")} description={t("insights.editMode.emptyDescription")} action={ - } />