mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 22:54:42 +02:00
fix: search viewport init, theme-clears-route bug, preview-during-route
Three regressions fixed: 1. mapCenter is now initialized on map 'load' event, not just 'moveend'. Searches immediately after page load now correctly include viewport bias instead of falling back to default Twin Falls coords. 2. setThemeOverride had stray code from startDirections that wiped stops and added undefined place data. Toggling theme cleared the active route. Restored setThemeOverride to its correct theme-only implementation. 3. usePanelState returned ROUTE_CALCULATED before checking selectedPlace, so preview cards could never appear alongside a calculated route. Refactored to decouple preview state from route state - preview renders whenever selectedPlace exists, independent of route state.
This commit is contained in:
parent
5eb83e9b4b
commit
f5e0b9606e
3 changed files with 21 additions and 18 deletions
|
|
@ -32,7 +32,7 @@ export default function Panel({ onManeuverClick }) {
|
|||
const activeTab = useStore((s) => s.activeTab)
|
||||
const setActiveTab = useStore((s) => s.setActiveTab)
|
||||
|
||||
const panelState = usePanelState()
|
||||
const { hasPreview, routeState } = usePanelState()
|
||||
|
||||
const [isMobile, setIsMobile] = useState(false)
|
||||
const [optimizing, setOptimizing] = useState(false)
|
||||
|
|
@ -126,11 +126,11 @@ export default function Panel({ onManeuverClick }) {
|
|||
|
||||
const showOptimize = effectiveCount >= 3
|
||||
|
||||
// Determine what to show based on panel state
|
||||
const showPreviewCard = panelState === 'PREVIEW' || panelState === 'PREVIEW_ROUTING'
|
||||
const showRouteSection = panelState === 'ROUTING' || panelState === 'PREVIEW_ROUTING' || panelState === 'ROUTE_CALCULATED'
|
||||
const showManeuvers = panelState === 'ROUTE_CALCULATED'
|
||||
const showEmptyState = panelState === 'IDLE'
|
||||
// Determine what to show based on panel state (preview and route are now orthogonal)
|
||||
const showPreviewCard = hasPreview
|
||||
const showRouteSection = routeState === 'ROUTING' || routeState === 'CALCULATED'
|
||||
const showManeuvers = routeState === 'CALCULATED'
|
||||
const showEmptyState = !hasPreview && routeState === 'NONE'
|
||||
|
||||
// Routes tab content - now state-driven
|
||||
const routesContent = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue