-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dependencies] new package for maps + moving a bunch of components to…
… `ui` (#432) Closes DG-146 ## What changed? Why? Maps now have their own package, and tons of dependencies updated as a result. Also moves a bunch more components to UI
- Loading branch information
Showing
65 changed files
with
1,136 additions
and
1,582 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,16 @@ | ||
import { Suspense, useState } from 'react'; | ||
import dynamic from 'next/dynamic'; | ||
import { useColorScheme } from 'ui/theme/useColorScheme'; | ||
import { LazyLoadedMap } from 'maps/LazyLoadedMap'; | ||
import { useData } from 'api/useData'; | ||
import type { ContentCardProps } from 'components/ContentCard'; | ||
import { MapContentCard } from 'components/maps/MapContentCard'; | ||
|
||
type MapPreviewCardProps = Pick<ContentCardProps, 'turnOnAnimation'>; | ||
|
||
// Only render when you want to start importing this giant component | ||
const FullMapCard = dynamic(() => import('components/maps/FullMapCard'), { | ||
const FullMapCard = dynamic(() => import('maps/mapbox-gl/FullMapCard'), { | ||
suspense: true, | ||
}); | ||
|
||
/** | ||
* Shows a preview of the full map card, to be fetched on hover. | ||
*/ | ||
export function MapPreviewCard({ turnOnAnimation }: MapPreviewCardProps) { | ||
export function MapPreviewCard() { | ||
const { data: location } = useData('location'); | ||
const { colorScheme } = useColorScheme(); | ||
const [showFullMapComponent, setShowFullMapComponent] = useState(false); | ||
|
||
const backgroundImageUrl = colorScheme.isInitialized | ||
? (colorScheme.mode === 'light' | ||
? location?.backupImageUrls.light | ||
: location?.backupImageUrls.dark) ?? null | ||
: null; | ||
|
||
// Loads the full map card on hover | ||
const previewCard = ( | ||
<MapContentCard | ||
backgroundImageUrl={backgroundImageUrl} | ||
onMouseOver={() => { | ||
setShowFullMapComponent(true); | ||
}} | ||
onTouchStart={() => { | ||
setShowFullMapComponent(true); | ||
}} | ||
turnOnAnimation={turnOnAnimation} | ||
/> | ||
); | ||
|
||
return showFullMapComponent && location ? ( | ||
<Suspense fallback={previewCard}> | ||
<FullMapCard | ||
backgroundImageUrl={backgroundImageUrl} | ||
location={location} | ||
turnOnAnimation={turnOnAnimation} | ||
/> | ||
</Suspense> | ||
) : ( | ||
previewCard | ||
); | ||
return <LazyLoadedMap FullMapCard={FullMapCard} location={location} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
5b65f54
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dg – ./
dg.vercel.app
dg-git-main-dgattey.vercel.app
dylangattey.com
dg-dgattey.vercel.app