From 81b44a6422848d949ff8c3b082cff12c373b12cb Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Thu, 27 Nov 2025 14:45:21 -0600 Subject: [PATCH] fix(know-your-world): improve mobile layout for setup screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix broken CSS by simplifying breadcrumb styles - Stack breadcrumbs vertically on phones to avoid overlap with region selector - Shrink mode/guidance menus on phones (64px β†’ 48px height) - Scale region size selector to 75% on phones - Remove complex calc() and alpha channel values causing issues πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/DrillDownMapSelector.tsx | 293 ++++++------------ .../know-your-world/components/SetupPhase.tsx | 37 ++- 2 files changed, 119 insertions(+), 211 deletions(-) diff --git a/apps/web/src/arcade-games/know-your-world/components/DrillDownMapSelector.tsx b/apps/web/src/arcade-games/know-your-world/components/DrillDownMapSelector.tsx index 915ba488..04c9afb9 100644 --- a/apps/web/src/arcade-games/know-your-world/components/DrillDownMapSelector.tsx +++ b/apps/web/src/arcade-games/know-your-world/components/DrillDownMapSelector.tsx @@ -90,7 +90,13 @@ const PLANETS: PlanetData[] = [ { id: 'mercury', name: 'Mercury', color: '#b0b0b0', size: 0.38 }, { id: 'venus', name: 'Venus', color: '#e6c87a', size: 0.95 }, { id: 'mars', name: 'Mars', color: '#c1440e', size: 0.53 }, - { id: 'jupiter', name: 'Jupiter', color: '#d8ca9d', size: 2.0, hasStripes: true }, + { + id: 'jupiter', + name: 'Jupiter', + color: '#d8ca9d', + size: 2.0, + hasStripes: true, + }, { id: 'saturn', name: 'Saturn', color: '#ead6b8', size: 1.7, hasRings: true }, ] @@ -152,7 +158,10 @@ export function DrillDownMapSelector({ const [sizeRangePreview, setSizeRangePreview] = useState | null>( null ) - const [containerDimensions, setContainerDimensions] = useState({ width: 0, height: 0 }) + const [containerDimensions, setContainerDimensions] = useState({ + width: 0, + height: 0, + }) const containerRef = useRef(null) // Track which region name is being hovered in the popover (for zoom preview) const [previewRegionName, setPreviewRegionName] = useState(null) @@ -477,7 +486,10 @@ export function DrillDownMapSelector({ } } - return { previewAddRegions: addRegions, previewRemoveRegions: removeRegions } + return { + previewAddRegions: addRegions, + previewRemoveRegions: removeRegions, + } }, [sizeRangePreview, currentLevel, path, selectedContinent, includeSizes]) // Compute the label to display for the hovered region @@ -634,7 +646,12 @@ export function DrillDownMapSelector({ } : null }) - .filter(Boolean) as Array<{ id: string; label: string; emoji: string; path: SelectionPath }> + .filter(Boolean) as Array<{ + id: string + label: string + emoji: string + path: SelectionPath + }> } return [] @@ -761,205 +778,76 @@ export function DrillDownMapSelector({ > {/* Breadcrumb Navigation - different styles for fillContainer vs normal */} {fillContainer ? ( - /* Navigation breadcrumb - positioned well below nav bar */ + /* Breadcrumb navigation overlay for full-screen mode */
- {currentLevel > 0 ? ( - <> - {/* Back button with mini-map */} - {(() => { - const backToWorld = currentLevel === 1 - const backToContinentId = currentLevel === 2 ? path[0] : null - const backLabel = backToWorld - ? 'World' - : (CONTINENTS.find((c) => c.id === backToContinentId)?.name ?? 'Continent') - const backEmoji = backToWorld - ? '🌍' - : (CONTINENTS.find((c) => c.id === backToContinentId)?.emoji ?? 'πŸ—ΊοΈ') - - // Get viewBox and regions for the mini-map preview - const backViewBox = backToWorld - ? WORLD_MAP.viewBox - : backToContinentId - ? calculateContinentViewBox( - WORLD_MAP.regions, - backToContinentId, - WORLD_MAP.viewBox, - 'world' - ) - : WORLD_MAP.viewBox - const backRegions = backToWorld - ? WORLD_MAP.regions - : backToContinentId - ? filterRegionsByContinent(WORLD_MAP.regions, backToContinentId) - : [] - - return ( - - ) - })()} - - {/* Current location badge */} -
- - {breadcrumbs[breadcrumbs.length - 1]?.emoji} - + {breadcrumbs.map((crumb, index) => ( + + {index > 0 && ( - {breadcrumbs[breadcrumbs.length - 1]?.label} + β€Ί -
- - ) : ( - /* World level - current location badge */ -
- 🌍 - - World - -
- )} + )} + {crumb.isClickable ? ( + + ) : ( + + {crumb.emoji} + {crumb.label} + + )} + + ))}
) : ( /* Normal breadcrumb for non-fillContainer mode */ @@ -977,7 +865,11 @@ export function DrillDownMapSelector({ {breadcrumbs.map((crumb, index) => ( {index > 0 && ( β€Ί @@ -1153,20 +1045,15 @@ export function DrillDownMapSelector({ data-element="region-size-filters" className={css({ position: 'absolute', - top: fillContainer ? 'calc(var(--app-nav-height, 92px) + 72px)' : '3', - right: { base: '16px', sm: '24px' }, - padding: '12px', - bg: isDark - ? 'linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%)' - : 'linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%)', - backdropFilter: 'blur(12px)', - border: '1px solid', - borderColor: isDark ? 'rgba(71, 85, 105, 0.5)' : 'rgba(203, 213, 225, 0.8)', + top: fillContainer ? '164px' : '3', + right: { base: '8px', sm: '24px' }, + padding: { base: '2', sm: '3' }, + bg: isDark ? 'gray.800' : 'gray.100', rounded: 'xl', - shadow: isDark - ? '0 4px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05)' - : '0 4px 20px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8)', + shadow: 'lg', zIndex: 10, + transform: { base: 'scale(0.75)', sm: 'scale(1)' }, + transformOrigin: 'top right', })} > setMode(value as 'cooperative' | 'race' | 'turn-based')} > - + {selectedMode?.emoji}
@@ -304,7 +309,10 @@ export function SetupPhase() { {selectedMode?.label} β–Ό @@ -365,7 +373,12 @@ export function SetupPhase() { } > - + {selectedAssistance?.emoji || 'πŸ’‘'}
@@ -386,7 +399,10 @@ export function SetupPhase() { {selectedAssistance?.label} β–Ό @@ -578,7 +594,12 @@ export function SetupPhase() { })} > {regionTheme.icons[0]} - + {regionTheme.icons[1]}