From a017df89fa421e48022b990235c85e1a1782a1bb Mon Sep 17 00:00:00 2001 From: g-but <41178744+g-but@users.noreply.github.com> Date: Sun, 31 May 2026 03:39:09 +0200 Subject: [PATCH] fix(prompts): mobile scroll affordance for CategoryBar chips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fourth horizontal-scroll surface in the codebase to get the same mobile chevron treatment as Today SummaryBar (4cb018c), Settings tab strip (7ab36d6), and Projects status filter chips (0523927). Live audit at 414px on cockpitapp.vercel.app/prompts caught "Engineering (..." cut off at the right edge with neither a fade mask nor a chevron — user has no cue the category bar is scrollable. CategoryBar was also missing the ui-scroll-fade-right class entirely (the other 3 surfaces had it for the opacity hint even if the chevron was new). Adding both: the fade gives a subtle bg cue, the chevron gives an explicit "more this way" affordance. Threshold of visibleCats >= 3 matches the rough overflow point at 414px (1 "All" + 3 category chips ≈ first wrap-or-scroll boundary). Pattern is now duplicated 4× — extracting is the clear next refactor before a 5th surface appears. --- src/components/prompts/CategoryBar.tsx | 65 +++++++++++++++++--------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/src/components/prompts/CategoryBar.tsx b/src/components/prompts/CategoryBar.tsx index 5e3492db3..15866228c 100644 --- a/src/components/prompts/CategoryBar.tsx +++ b/src/components/prompts/CategoryBar.tsx @@ -1,5 +1,6 @@ "use client"; +import { ChevronRight } from "lucide-react"; import { cn } from "@/lib/utils"; import { ALL_CATEGORIES, CATEGORY_META, type PromptCategory, type PromptTemplate } from "@/config/prompt-library"; @@ -16,31 +17,49 @@ export function CategoryBar({ const counts = new Map( ALL_CATEGORIES.map((cat) => [cat, templates.filter((t) => t.category === cat).length]), ); + const visibleCats = ALL_CATEGORIES.filter((cat) => (counts.get(cat) ?? 0) > 0); + // Fourth horizontal-scroll surface in this codebase needing a mobile + // affordance — Today SummaryBar (4cb018c), Settings tab strip (7ab36d6), + // Projects status chips (0523927), now Prompts categories. Same pattern: + // ui-scroll-fade-right mask + ChevronRight pinned to the right edge of + // the relative wrapper, hidden on sm+ where chips wrap. Adds the fade + // mask that was previously missing here too. Threshold of 4 chips + // matches the pattern (1 All + 4 categories ≈ first overflow point). return ( -
- - {ALL_CATEGORIES.filter((cat) => (counts.get(cat) ?? 0) > 0).map((cat) => { - const meta = CATEGORY_META[cat]; - const isActive = active === cat; - return ( - - ); - })} +
+
+ + {visibleCats.map((cat) => { + const meta = CATEGORY_META[cat]; + const isActive = active === cat; + return ( + + ); + })} +
+ {visibleCats.length >= 3 && ( + + + + )}
); }