From 6b925a4fc0c0d02e902e6f2ad432b4519c288c7c Mon Sep 17 00:00:00 2001 From: SkateSpots Date: Sun, 27 Sep 2026 09:56:14 +0700 Subject: [PATCH] feat(crews): compact focus toggle group + mobile-only Near me MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace the eight wrapping filter chips with a single-row ToggleGroup (short labels; full names in tooltip/aria-label). Scrolls horizontally on mobile instead of wrapping to two rows. - Near me is now mobile-only on the Crews page — it was clutter on desktop. --- src/pages/CrewsPage.tsx | 74 ++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/src/pages/CrewsPage.tsx b/src/pages/CrewsPage.tsx index 92850bb..f49f366 100644 --- a/src/pages/CrewsPage.tsx +++ b/src/pages/CrewsPage.tsx @@ -5,6 +5,7 @@ import { Layout } from '@/components/Layout'; import { LazyMount } from '@/components/LazyMount'; import { Card, CardContent } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; +import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group'; import { Skeleton } from '@/components/ui/skeleton'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { CrewRepBadge, CrewActivityPulse } from '@/components/CrewBadge'; @@ -18,15 +19,17 @@ import type { CrewActivity } from '@/lib/crewHelpers'; import { cn } from '@/lib/utils'; import { Users, Plus, Search, MapPin, X, HardHat, Camera, GraduationCap, Sparkles, Navigation, Loader2, Music, Palette, Dumbbell, Film } from 'lucide-react'; -const FOCUS_FILTERS: { key: CrewFocus | 'all'; label: string; icon: typeof Users }[] = [ - { key: 'all', label: 'All', icon: Users }, - { key: 'builder', label: CREW_FOCUS_LABELS.builder, icon: HardHat }, - { key: 'photo', label: CREW_FOCUS_LABELS.photo, icon: Camera }, - { key: 'coaching', label: CREW_FOCUS_LABELS.coaching, icon: GraduationCap }, - { key: 'art', label: CREW_FOCUS_LABELS.art, icon: Palette }, - { key: 'music', label: CREW_FOCUS_LABELS.music, icon: Music }, - { key: 'wellness', label: CREW_FOCUS_LABELS.wellness, icon: Dumbbell }, - { key: 'mixed', label: CREW_FOCUS_LABELS.mixed, icon: Sparkles }, +// `label` is the full name (used for the tooltip + screen readers); `short` is +// what the compact toggle shows, to keep the filter bar to a single row. +const FOCUS_FILTERS: { key: CrewFocus | 'all'; label: string; short: string; icon: typeof Users }[] = [ + { key: 'all', label: 'All', short: 'All', icon: Users }, + { key: 'builder', label: CREW_FOCUS_LABELS.builder, short: 'DIY', icon: HardHat }, + { key: 'photo', label: CREW_FOCUS_LABELS.photo, short: 'Photo', icon: Camera }, + { key: 'coaching', label: CREW_FOCUS_LABELS.coaching, short: 'Coaching', icon: GraduationCap }, + { key: 'art', label: CREW_FOCUS_LABELS.art, short: 'Art', icon: Palette }, + { key: 'music', label: CREW_FOCUS_LABELS.music, short: 'Music', icon: Music }, + { key: 'wellness', label: CREW_FOCUS_LABELS.wellness, short: 'Physio', icon: Dumbbell }, + { key: 'mixed', label: CREW_FOCUS_LABELS.mixed, short: 'Mixed', icon: Sparkles }, ]; const FOCUS_BADGE_ICONS: Record = { @@ -272,33 +275,42 @@ export default function CrewsPage() { )} - {/* Filters row: focus chips + Near me */} -
- {FOCUS_FILTERS.map(({ key, label, icon: Icon }) => { - const active = focusFilter === key; - return ( - - ); - })} + {/* Filters: one compact focus toggle group (scrolls on mobile) */} +
+
+ { + if (v) setFocusFilter(v as CrewFocus | 'all'); + }} + className="inline-flex w-max items-center gap-0.5 rounded-xl border border-white/10 bg-white/[0.04] p-1" + > + {FOCUS_FILTERS.map(({ key, label, short, icon: Icon }) => ( + + + {short} + + ))} + +
+ {/* Near me — mobile only; on desktop it was just clutter in this bar. */}