File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
frontend/src/screens/App/screens
MapPane/components/MainMap Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ interface Props {
2929 className ?: string ;
3030 panOnClick : boolean ;
3131 overlay : overlays . OverlayId ;
32+ requireLogin ?: boolean ;
3233}
3334
3435type PropsWithRouter = Props & RouteComponentProps < { identifier ?: string } > ;
@@ -148,7 +149,7 @@ All the types got very confusing, sorry.
148149
149150// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
150151function withRouterRef <
151- OuterProps ,
152+ OuterProps extends Props ,
152153 C = React . ComponentType < OuterProps & RouteComponentProps >
153154> ( Component : C ) {
154155 return React . forwardRef < C , OuterProps > ( function WithRouterRef ( props , ref ) {
@@ -158,7 +159,10 @@ function withRouterRef<
158159 const { isLoggedInToNonAnonymousAccount, isLoadingMe } = useLoginStore ( ) ;
159160
160161 // Only show map if user is logged in to a non-anonymous account
161- const canShowMap = isLoggedInToNonAnonymousAccount && ! isLoadingMe ;
162+ // But allow override if requireLogin is explicitly set to false
163+ const canShowMap =
164+ props . requireLogin === false ||
165+ ( isLoggedInToNonAnonymousAccount && ! isLoadingMe ) ;
162166
163167 if ( ! canShowMap ) {
164168 return (
Original file line number Diff line number Diff line change @@ -35,7 +35,11 @@ export default function ToteBag(): JSX.Element {
3535 return (
3636 < div className = { stylesheet . back } ref = { containerRef } >
3737 < div className = { stylesheet . map } >
38- < MainMap panOnClick = { false } overlay = "default-map" />
38+ < MainMap
39+ panOnClick = { false }
40+ overlay = "default-map"
41+ requireLogin = { false }
42+ />
3943 </ div >
4044 < div className = { stylesheet . box } >
4145 < div className = { stylesheet . subhead } >
You can’t perform that action at this time.
0 commit comments