fix(map): Fix logout

Took 1 hour 16 minutes
This commit is contained in:
Lucàs
2023-05-18 13:59:33 +02:00
parent 5b2e9ebafc
commit 31666d9698
6 changed files with 99 additions and 197 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import { MdError } from "react-icons/md";
import { Button, Text, VStack } from "@chakra-ui/react";
import { useRouter } from "next/router";
export default function LoadingPage() {
export default function ErrorGeoLocation() {
const router = useRouter();
return (
+1 -1
View File
@@ -2,7 +2,7 @@ import { MdError } from "react-icons/md";
import { Button, Text, VStack } from "@chakra-ui/react";
import { useRouter } from "next/router";
export default function LoadingPage() {
export default function ErrorPage() {
const router = useRouter();
return (
+1 -4
View File
@@ -29,10 +29,7 @@ export default function Navbar({variant = 'fixed'}: Props) {
return (
<Flex gap={5} justify={'center'} flexBasis={'100%'}>
{status === 'authenticated'
? authenticatedLinks
: <></>
}
{status === 'authenticated' && authenticatedLinks}
</Flex>
);
};
+37 -39
View File
@@ -1,7 +1,6 @@
import {MapContainer, TileLayer, Marker, Popup} from 'react-leaflet';
import {MapContainer, TileLayer, Marker} from 'react-leaflet';
import {Flex, Text, useToast} from '@chakra-ui/react';
import MarkerClusterGroup
from '@christopherpickering/react-leaflet-markercluster';
import MarkerClusterGroup from '@christopherpickering/react-leaflet-markercluster';
import '@christopherpickering/react-leaflet-markercluster/dist/styles.min.css';
@@ -15,46 +14,45 @@ export default function MapComponent(props: any) {
const idToastError = 'error_location';
const userIcon = new L.Icon({
iconUrl: 'logo.svg',
iconSize: [35, 35],
});
const userIcon = new L.Icon({iconUrl: 'logo.svg', iconSize: [35, 35]});
if (!location[0] || !location[1]) return (
<>
{!toast.isActive(idToastError) &&
toast({
title: 'Erreur',
id: idToastError,
description: 'Veuillez autoriser la localisation',
status: 'error',
isClosable: false,
duration: 100000,
})}
<Text color="purple.500" fontSize="2xl" fontWeight="bold">
Veuillez autoriser la localisation
</Text>
</>
);
return (
<>
{location[0] === null || location[1] === null ? (
<>
{!toast.isActive(idToastError) &&
toast({
title: 'Erreur',
id: idToastError,
description: 'Veuillez autoriser la localisation',
status: 'error',
isClosable: false,
duration: 100000,
})}
<Text color="purple.500" fontSize="2xl" fontWeight="bold">
Veuillez autoriser la localisation
</Text>
</>
) : (
<Flex>
<MapContainer center={location} zoom={13} minZoom={8}
zoomControl={false}
style={{width: '100vw', height: '100vw'}}>
<TileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
/>
{/* Pour le user */}
<Marker icon={userIcon} position={location}></Marker>
<Flex>
<MapContainer center={location} zoom={13} minZoom={8}
zoomControl={false}
style={{width: '100vw', height: '100vw'}}>
<TileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
/>
{/* Pour le user */}
<Marker icon={userIcon} position={location}></Marker>
<MarkerClusterGroup chunkedLoading showCoverageOnHover={false}>
{listBars.map((bar: any, index: number) => <MarkerBar key={index} bar={bar}/>)}
</MarkerClusterGroup>
</MapContainer>
</Flex>
)}
<MarkerClusterGroup chunkedLoading showCoverageOnHover={false}>
{listBars.map((bar: any, index: number) =>
<MarkerBar key={index} bar={bar}/>
)}
</MarkerClusterGroup>
</MapContainer>
</Flex>
</>
);
}