This file contains hidden or 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
| /* Marker */ | |
| .marker { | |
| height: 15px; | |
| width: 15px; | |
| border-radius: 50%; | |
| background-color: blue; | |
| cursor: pointer; | |
| } |
This file contains hidden or 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
| const fetchData = useCallback(() => { | |
| const geocodingClient = mbxGeocoding({ | |
| accessToken: mapboxgl.accessToken, | |
| }); | |
| // geocoding with countries | |
| return geocodingClient | |
| .forwardGeocode({ | |
| query: 'Ikeja, Lagos', | |
| countries: ['ng'], |
This file contains hidden or 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
| .map-container { | |
| width: 100%; | |
| height: 500px; | |
| border-radius: 5px; | |
| } |
This file contains hidden or 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
| return ( | |
| <div> | |
| <div ref={mapContainerRef} className='map-container' /> | |
| </div> | |
| ); |
This file contains hidden or 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
| const map = useRef(null); | |
| const mapContainerRef = useRef(null); | |
| mapboxgl.accessToken = process.env.REACT_APP_MAPBOX_API; // your mapbox api | |
| useEffect(() => { | |
| if (map.current) return; // Checks if there's an already existing map initialised. | |
| map.current = new mapboxgl.Map({ | |
| container: mapContainerRef.current, | |
| style: 'mapbox://styles/mapbox/streets-v11', |
This file contains hidden or 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
| import React, { useEffect, useRef, useCallback } from 'react'; | |
| import mapboxgl from '!mapbox-gl'; // eslint-disable-line import/no-webpack-loader-syntax | |
| import mbxGeocoding from '@mapbox/mapbox-sdk/services/geocoding'; | |
| const GenerateMap = () => { | |
| return <React.Fragment /> | |
| } | |
| export default GenerateMap; |
This file contains hidden or 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
| let timeStamp; | |
| let warningInactiveInterval = useRef(); | |
| let startTimerInterval = useRef(); | |
| // start inactive check | |
| let timeChecker = () => { | |
| startTimerInterval.current = setTimeout(() => { | |
| let storedTimeStamp = sessionStorage.getItem('lastTimeStamp'); | |
| warningInactive(storedTimeStamp); | |
| }, 60000); |
This file contains hidden or 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
| const SessionTimeout = () => { | |
| const [events, setEvents] = useState(['click', 'load', 'scroll']); | |
| const [second, setSecond] = useState(0); | |
| let timeStamp; | |
| let warningInactiveInterval = useRef(); | |
| let startTimerInterval = useRef(); | |
| // start inactive check | |
| let timeChecker = () => { |
This file contains hidden or 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
| const SessionTimeout = () => { | |
| const [events, setEvents] = useState(['click', 'load', 'scroll']); | |
| const [second, setSecond] = useState(0); | |
| // reset interval timer | |
| let resetTimer = useCallback(() => { | |
| if (isAuthenticated) { | |
| timeStamp = moment(); | |
| sessionStorage.setItem('lastTimeStamp', timeStamp); |
This file contains hidden or 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
| // reset interval timer | |
| let resetTimer = useCallback(() => { | |
| clearTimeout(startTimerInterval.current); | |
| clearInterval(warningInactiveInterval.current); | |
| if (isAuthenticated) { | |
| timeStamp = moment(); | |
| sessionStorage.setItem('lastTimeStamp', timeStamp); | |
| } else { | |
| clearInterval(warningInactiveInterval.current); |