mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
feat(dashboard): the daily-overview band becomes opt-in
The hero renders only when the layout carries the literal heroVisible: true. Legacy blobs without the field, malformed values, and fresh accounts all keep it off; the Settings toggle persists an explicit opt-in through the existing layout PUT.
This commit is contained in:
1 parent
7eeab2ae98
commit
8a5a26b49a
8 files changed
+51
-50
No files matched your search
@@ -477,7 +477,7 @@ describe("PUT /api/dashboard/widgets — heroVisible thread-through", () => {
|
||||
expect(updateArg.data.dashboardWidgetsJson.heroVisible).toBe(false);
|
||||
});
|
||||
|
||||
it("defaults heroVisible to true for a first save with no stored layout", async () => {
|
||||
it("defaults heroVisible to false for a first save with no stored layout", async () => {
|
||||
vi.mocked(prisma.user.findUnique).mockResolvedValue({
|
||||
dashboardWidgetsJson: null,
|
||||
} as never);
|
||||
@@ -495,7 +495,7 @@ describe("PUT /api/dashboard/widgets — heroVisible thread-through", () => {
|
||||
.calls[0]?.[0] as unknown as {
|
||||
data: { dashboardWidgetsJson: { heroVisible: boolean } };
|
||||
};
|
||||
expect(updateArg.data.dashboardWidgetsJson.heroVisible).toBe(true);
|
||||
expect(updateArg.data.dashboardWidgetsJson.heroVisible).toBe(false);
|
||||
});
|
||||
|
||||
it("422s on a non-boolean heroVisible", async () => {
|
||||
|
||||
@@ -283,7 +283,7 @@ export const PUT = apiHandler(async (request: NextRequest) => {
|
||||
mergedChartOverlayPrefs = existingLayout.chartOverlayPrefs ?? {};
|
||||
}
|
||||
if (mergedHeroVisible === undefined) {
|
||||
mergedHeroVisible = existingLayout.heroVisible !== false;
|
||||
mergedHeroVisible = existingLayout.heroVisible === true;
|
||||
}
|
||||
}
|
||||
const normalized = serializeDashboardLayout({
|
||||
|
||||
Reference in new issue
Block a user