feat(know-your-world): improve setup screen UX
- Add inline region list panel on larger screens (md+) - Fix mobile double-tap issue with touch-action: manipulation - Sync map navigation state across network for multiplayer 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
81b44a6422
commit
dc4d62195b
|
|
@ -166,6 +166,18 @@ export function DrillDownMapSelector({
|
||||||
// Track which region name is being hovered in the popover (for zoom preview)
|
// Track which region name is being hovered in the popover (for zoom preview)
|
||||||
const [previewRegionName, setPreviewRegionName] = useState<string | null>(null)
|
const [previewRegionName, setPreviewRegionName] = useState<string | null>(null)
|
||||||
|
|
||||||
|
// Sync local path state when props change from external sources (e.g., other players)
|
||||||
|
useEffect(() => {
|
||||||
|
const expectedPath = getInitialPath()
|
||||||
|
const pathMatches =
|
||||||
|
path.length === expectedPath.length && path.every((p, i) => p === expectedPath[i])
|
||||||
|
|
||||||
|
if (!pathMatches) {
|
||||||
|
setPath(expectedPath)
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [selectedMap, selectedContinent])
|
||||||
|
|
||||||
// Measure container dimensions for viewBox calculation
|
// Measure container dimensions for viewBox calculation
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const measureContainer = () => {
|
const measureContainer = () => {
|
||||||
|
|
@ -1071,6 +1083,75 @@ export function DrillDownMapSelector({
|
||||||
onRegionNameHover={setPreviewRegionName}
|
onRegionNameHover={setPreviewRegionName}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Region List Panel - visible on larger screens only */}
|
||||||
|
{fillContainer && selectedRegionNames.length > 0 && (
|
||||||
|
<div
|
||||||
|
data-element="region-list-panel"
|
||||||
|
className={css({
|
||||||
|
position: 'absolute',
|
||||||
|
top: '164px',
|
||||||
|
right: { base: '8px', sm: '180px' },
|
||||||
|
display: { base: 'none', md: 'flex' },
|
||||||
|
flexDirection: 'column',
|
||||||
|
width: '180px',
|
||||||
|
maxHeight: '280px',
|
||||||
|
bg: isDark ? 'gray.800' : 'gray.100',
|
||||||
|
rounded: 'xl',
|
||||||
|
shadow: 'lg',
|
||||||
|
zIndex: 10,
|
||||||
|
overflow: 'hidden',
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{/* Header */}
|
||||||
|
<div
|
||||||
|
className={css({
|
||||||
|
px: '3',
|
||||||
|
py: '2',
|
||||||
|
borderBottom: '1px solid',
|
||||||
|
borderColor: isDark ? 'gray.700' : 'gray.200',
|
||||||
|
fontWeight: '600',
|
||||||
|
fontSize: 'sm',
|
||||||
|
color: isDark ? 'gray.100' : 'gray.800',
|
||||||
|
flexShrink: 0,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{selectedRegionNames.length} regions
|
||||||
|
</div>
|
||||||
|
{/* Scrollable list */}
|
||||||
|
<div
|
||||||
|
className={css({
|
||||||
|
overflowY: 'auto',
|
||||||
|
flex: 1,
|
||||||
|
py: '1',
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{selectedRegionNames
|
||||||
|
.slice()
|
||||||
|
.sort((a, b) => a.localeCompare(b))
|
||||||
|
.map((name) => (
|
||||||
|
<div
|
||||||
|
key={name}
|
||||||
|
onMouseEnter={() => setPreviewRegionName(name)}
|
||||||
|
onMouseLeave={() => setPreviewRegionName(null)}
|
||||||
|
className={css({
|
||||||
|
px: '3',
|
||||||
|
py: '1',
|
||||||
|
fontSize: 'xs',
|
||||||
|
color: isDark ? 'gray.300' : 'gray.600',
|
||||||
|
cursor: 'pointer',
|
||||||
|
_hover: {
|
||||||
|
bg: isDark ? 'gray.700' : 'gray.200',
|
||||||
|
color: isDark ? 'gray.100' : 'gray.900',
|
||||||
|
},
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Peer Navigation - Mini-map thumbnails below main map (or planets at world level) */}
|
{/* Peer Navigation - Mini-map thumbnails below main map (or planets at world level) */}
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ const AnimatedRegion = memo(function AnimatedRegion({
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
pointerEvents: 'all',
|
pointerEvents: 'all',
|
||||||
opacity: springProps.opacity,
|
opacity: springProps.opacity,
|
||||||
|
touchAction: 'manipulation',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
@ -365,6 +366,7 @@ export function MapSelectorMap({
|
||||||
height: '100%',
|
height: '100%',
|
||||||
cursor: 'crosshair',
|
cursor: 'crosshair',
|
||||||
display: 'block',
|
display: 'block',
|
||||||
|
touchAction: 'manipulation',
|
||||||
})}
|
})}
|
||||||
preserveAspectRatio="xMidYMid meet"
|
preserveAspectRatio="xMidYMid meet"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue