diff --git a/web/src/components/Hideable.tsx b/web/src/components/Hideable.tsx
new file mode 100644
index 0000000..b9814f4
--- /dev/null
+++ b/web/src/components/Hideable.tsx
@@ -0,0 +1,39 @@
+import type { ReactNode } from "react";
+import { IconEye, IconEyeOff } from "@tabler/icons-react";
+import { setCardHidden, useDashboardLayout } from "../utils/dashboardLayout";
+
+/** Whether the person has hidden a dashboard card, whether they are arranging the dashboard, and so whether the card is to be drawn (hidden ones are drawn, dimmed, while arranging). */
+export function useCardState(label: string): { hidden: boolean; editing: boolean; shown: boolean } {
+ const { layout, editing } = useDashboardLayout();
+ const hidden = layout.hidden.includes(label);
+ return { hidden, editing, shown: !hidden || editing };
+}
+
+/** The bar above a card while the dashboard is being arranged: its name and a button to hide it or bring it back. */
+export function HideBar({ label, hidden }: { label: string; hidden: boolean }) {
+ return (
+
+ {label}
+
+
+ );
+}
+
+/**
+ * A card at the top of the dashboard that the person can hide. Hidden, it is gone; while they arrange the dashboard (Customise) it is there, dimmed, under a bar that hides it or brings it back.
+ * It is kept the same way as the other cards' arrangement — on their user record, so it follows them to any browser — and Reset to default shows it again.
+ */
+export default function Hideable({ label, children }: { label: string; children: ReactNode }) {
+ const { hidden, editing, shown } = useCardState(label);
+ if (!shown) return null;
+ return (
+
+ {editing && }
+ {children}
+
+ );
+}
diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsx
index c490e7a..49a119e 100644
--- a/web/src/pages/Dashboard.tsx
+++ b/web/src/pages/Dashboard.tsx
@@ -4,6 +4,7 @@ import { IconArrowLeft, IconArrowRight, IconEye, IconEyeOff } from "@tabler/icon
import TimeAgo from "../components/TimeAgo";
import WhatChanged from "../components/WhatChanged";
import DashboardTodos from "../components/DashboardTodos";
+import Hideable, { HideBar, useCardState } from "../components/Hideable";
import { setProblemsFirst, useProblemsFirst } from "../utils/problemsFirst";
import { UNPLACED, moveCard, resetDashboardLayout, setCardHidden, setEditingDashboard, useDashboardLayout } from "../utils/dashboardLayout";
import { Link } from "react-router-dom";
@@ -353,8 +354,15 @@ function MyWorkStrip() {
);
}
+/** The cards down the left of the top of the dashboard, and the to-do list on the right: the names the person hides them by. */
+const TOP_LEFT_CARDS = ["Needs attention", "My work", "Since you last looked", "Getting started"];
+const TODO_CARD = "To do list";
+
export default function Dashboard({ user }: { user: CurrentUser }) {
- const { editing } = useDashboardLayout();
+ const { editing, layout: arranged } = useDashboardLayout();
+ // The top of the dashboard is two columns while both have something to show; when the person has hidden every card of one, the other takes the whole width.
+ const showTopLeft = editing || TOP_LEFT_CARDS.some((c) => !arranged.hidden.includes(c));
+ const todoCard = useCardState(TODO_CARD);
const problemsFirst = useProblemsFirst();
const [integrations, setIntegrations] = useState(null);
// How many alerts each integration has open that nobody has put aside, for the tiles of the integrations that have no widget of their own.
@@ -718,7 +726,7 @@ export default function Dashboard({ user }: { user: CurrentUser }) {
{editing && (
- Move the cards with the arrows and hide the ones you don't use. It saves as you go, for you only, and follows you to other browsers.
+ Move the Overview cards with the arrows, and hide any card you don't use — the ones at the top too. It saves as you go, for you only, and follows you to other browsers.
diff --git a/web/src/styles.css b/web/src/styles.css
index 5d0681e..47d4135 100644
--- a/web/src/styles.css
+++ b/web/src/styles.css
@@ -1701,6 +1701,22 @@ html[data-density="roomy"] .table > :not(caption) > * > * {
opacity: 0.5;
}
+/* The cards at the top of the dashboard have no card round the bar, so it gets its own frame. */
+.hideable > .card-customise {
+ margin-bottom: 0.5rem;
+ border: 1px dashed var(--tblr-border-color);
+ border-radius: var(--tblr-border-radius);
+}
+
+.dash-side-col {
+ display: flex;
+ flex-direction: column;
+}
+
+.dash-side-col > .dash-side {
+ flex: 1 1 auto;
+}
+
/* ── Comparing servers: the chart fills its card and takes the text colour for its axes. ── */
.multi-chart {
display: block;
@@ -2008,7 +2024,8 @@ tr.alert-row-child > td:first-child {
position: relative;
}
- .dash-todos {
+ /* Only beside the other cards: on its own (they are hidden) it is an ordinary card. */
+ .dash-side > .dash-todos {
position: absolute;
inset: 0 calc(var(--tblr-gutter-x, 1.5rem) / 2) 0;
max-height: none;