From 025ed7a0e6b08d7f262c28f7f902c13b8f9938a8 Mon Sep 17 00:00:00 2001 From: Naiyuan Qing <145280634+NevilleQingNY@users.noreply.github.com> Date: Mon, 15 Jun 2026 13:20:21 +0800 Subject: [PATCH] fix(projects): single view-toggle button, decouple Display from view mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes from the same principle — view mode is pure presentation and must not couple to anything: - The view switch is now ONE button that flips table ⇄ cards (shows the current view's icon+label, tooltip names the target), instead of two side-by-side buttons. - The Display (sort/columns) control no longer disappears when you switch to cards — it was gated on isCompact, so flipping the view made it vanish (the "filter gone after switching" weirdness). It's always present now; only the columns *section* inside the popover is table-only (cards have no columns). Sort applies to both views. Co-Authored-By: Claude Fable 5 --- .../projects/components/projects-page.tsx | 95 ++++++++----------- 1 file changed, 41 insertions(+), 54 deletions(-) diff --git a/packages/views/projects/components/projects-page.tsx b/packages/views/projects/components/projects-page.tsx index 54ce2d171..b1f0718cc 100644 --- a/packages/views/projects/components/projects-page.tsx +++ b/packages/views/projects/components/projects-page.tsx @@ -86,7 +86,6 @@ import { TooltipContent, TooltipTrigger, } from "@multica/ui/components/ui/tooltip"; -import { cn } from "@multica/ui/lib/utils"; import type { MemberWithUser, Project, @@ -905,9 +904,11 @@ export function ProjectsPage() { - {/* Display (sort + columns) — table view only */} - {isCompact && ( - + {/* Display (sort + columns). Always present — view mode is a + pure presentation choice and must not reshape the toolbar. + Sort applies to both views; the columns section is shown + only in the table view (cards have no columns). */} + -
- {t(($) => $.toolbar.section_columns)} -
- {COLUMN_KEYS.map((key) => ( - - ))} + {isCompact && ( +
+ {t(($) => $.toolbar.section_columns)} +
+ {COLUMN_KEYS.map((key) => ( + + ))} +
-
+ )} - )} - {/* View toggle — table / cards */} -
- - setViewMode("compact")} - > + {/* View toggle — a single button that flips table ⇄ cards. + Pure presentation; coupled to nothing else. */} + + setViewMode(isCompact ? "comfortable" : "compact")} + > + {isCompact ? ( - - } - /> - {t(($) => $.page.view_table)} - - - setViewMode("comfortable")} - > + ) : ( - - } - /> - {t(($) => $.page.view_cards)} - -
+ )} + + {isCompact ? t(($) => $.page.view_table) : t(($) => $.page.view_cards)} + + + } + /> + + {isCompact ? t(($) => $.page.view_cards) : t(($) => $.page.view_table)} + +