Skip to content

Commit

Permalink
fixed improper route id in route options
Browse files Browse the repository at this point in the history
  • Loading branch information
sarem-h authored and incognitojam committed Jul 6, 2024
1 parent 112582c commit d9327e0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/components/RouteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ import type { Route, RouteSegments } from '~/types'

import { reverseGeocode } from '~/map'

type RouteOptionsProps = {
route?: Route;
}

const [showRouteOptionsCard, setShowRouteOptionsCard] = createSignal(false)
const [currentCardRoute, setCurrentCardRoute] = createSignal<Route | undefined>(undefined)

const RouteOptionsCard: Component<RouteOptionsProps> = (props) => {
const RouteOptionsCard: Component = () => {
const [isMdOrLarger, setIsMdOrLarger] = createSignal(false)

// listen isMdOrLarger
Expand Down Expand Up @@ -49,7 +46,7 @@ const RouteOptionsCard: Component<RouteOptionsProps> = (props) => {
'transform translate-y-full': !isMdOrLarger() && !showRouteOptionsCard(),
}}>
<div onClick={(event: MouseEvent) => event.stopPropagation()}>
<RouteOptions {...props} />
<RouteOptions route={currentCardRoute()} />
</div>
</div>
</Show>
Expand Down Expand Up @@ -89,6 +86,7 @@ const RouteHeader = (props: { route?: RouteSegments }) => {
const handleMoreOptionsClick = (event: MouseEvent) => {
event.stopPropagation()
setShowRouteOptionsCard(true)
setCurrentCardRoute(props.route)
}

return (
Expand Down Expand Up @@ -221,7 +219,7 @@ const RouteCard: Component<RouteCardProps> = (props) => {

return (
<div class="custom-card flex shrink-0 flex-col rounded-lg md:flex-row" onClick={navigateToRouteActivity}>
<RouteOptionsCard route={route()} />
<RouteOptionsCard />
<div class="h-full lg:w-[410px]">
<Suspense
fallback={<div class="skeleton-loader size-full bg-surface" />}
Expand Down

0 comments on commit d9327e0

Please sign in to comment.