Skip to content

Commit

Permalink
fix: remove dynamic loader (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkonush authored Dec 24, 2024
1 parent 0db59fe commit 0825201
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
4 changes: 2 additions & 2 deletions apps/findbobastore/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MapContainer } from '@/components/map-container'
import { MapView } from '@/components/map-view'

export default async function Home() {
const mapboxToken = process.env.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN
Expand All @@ -7,7 +7,7 @@ export default async function Home() {
<div className="absolute top-4 left-4 z-10 bg-slate-900/50 px-4 py-2 rounded-lg">
<h1 className="text-xl font-bold text-white">Find Boba Store</h1>
</div>
<MapContainer token={mapboxToken} />
<MapView token={mapboxToken} />
</main>
)
}
16 changes: 0 additions & 16 deletions apps/findbobastore/src/components/map-container.tsx

This file was deleted.

10 changes: 4 additions & 6 deletions apps/findbobastore/src/components/map-view.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { useCallback, memo, useState } from 'react'
import ReactMapGL, { Marker, NavigationControl, GeolocateControl } from 'react-map-gl'
import { motion, AnimatePresence } from 'framer-motion'
Expand Down Expand Up @@ -31,8 +33,7 @@ function MapOverlay({ store }: { store: BobaStore | null }) {
)
}

export function MapView({ token }: { token: string | undefined }) {
console.log({ token })
export const MapView = memo(function MapView({ token }: { token: string | undefined }) {
const [selectedStore, setSelectedStore] = useState<BobaStore | null>(null)
const [viewState, setViewState] = useState({
longitude: -122.4194,
Expand Down Expand Up @@ -114,7 +115,6 @@ export function MapView({ token }: { token: string | undefined }) {
</Marker>
))}

{/* User location marker */}
{viewState.longitude !== -122.4194 && (
<Marker longitude={viewState.longitude} latitude={viewState.latitude}>
<div className="text-4xl" aria-label="Your location">
Expand All @@ -127,6 +127,4 @@ export function MapView({ token }: { token: string | undefined }) {
{locationError && <div className="absolute top-4 left-4 p-4 bg-slate-900/90 rounded-lg text-slate-100 text-sm">{locationError}</div>}
</div>
)
}

export default memo(MapView)
})

0 comments on commit 0825201

Please sign in to comment.