diff --git a/components/elements/carouselItem.js b/components/elements/carouselItem.js index d6684ac..d9df994 100644 --- a/components/elements/carouselItem.js +++ b/components/elements/carouselItem.js @@ -32,6 +32,9 @@ const CarouselItem = ({ toggleLanguage, data, toggleLocationPreference, updateCi } } + useEffect(() => { + console.log(new Date(data['submissiontimestamp']).toLocaleString().split(',')[1] === undefined) + }) // Get viewport dimensions const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) @@ -55,7 +58,7 @@ const CarouselItem = ({ toggleLanguage, data, toggleLocationPreference, updateCi {new Date(data['submissiontimestamp']).toLocaleString().split(',')[0]} - {new Date(data['submissiontimestamp']).toLocaleString().split(',')[1].slice(0,6)} + {new Date(data['submissiontimestamp']).toLocaleString().split(',')[1] !== undefined ? new Date(data['submissiontimestamp']).toLocaleString().split(',')[1].slice(0,6) : "-"} ) diff --git a/components/elements/dateFilter.js b/components/elements/dateFilter.js index 004b1ca..d7e2694 100644 --- a/components/elements/dateFilter.js +++ b/components/elements/dateFilter.js @@ -45,8 +45,11 @@ const DateFilter = (props) => { useEffect(() => { // Fix to ensure mui selected patterns are correct on load - should be a better method available // Infrequent behaviour - if (props.toggleDate.endDate.slice(0,5) !== dates.now.slice(0,5)) { - document.querySelector('#custom-date-button').classList += ' Mui-selected' + + if ((props.toggleDate.endDate !== undefined) && (dates.now !== undefined)) { + if (props.toggleDate.endDate.slice(0,5) !== dates.now?.slice(0,5)) { + document.querySelector('#custom-date-button').classList += ' Mui-selected' + } } }) diff --git a/components/elements/floodMap.js b/components/elements/floodMap.js index 0a8e11e..9145c1d 100644 --- a/components/elements/floodMap.js +++ b/components/elements/floodMap.js @@ -131,8 +131,8 @@ const FloodMap = ({ toggleLanguage, configureAPI, toggleDate, updateFloodData, u (theme.typography.fontWeightLight), marginTop: (theme) => (theme.spacing(2))}}>{object.submissionText !== undefined ? "'" + object.submissionText + "'" : uiText.global.tooltips.noComment[toggleLanguage.language]} (theme.spacing(2))}}> - (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[0] : null} - (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[1].slice(0,6) : null} + (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[0] : '-'} + (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[1] !== undefined ? new Date(object.timestamp).toLocaleString().split(',')[1].slice(0,6) : '-' : '-'} ) : null; diff --git a/components/elements/rainfallMap.js b/components/elements/rainfallMap.js index ac4f799..6013dc7 100644 --- a/components/elements/rainfallMap.js +++ b/components/elements/rainfallMap.js @@ -195,8 +195,8 @@ const RainfallMap = ({ toggleLanguage, toggleDate, toggleDataType, mapBoxToken, (theme.typography.fontWeightLight), marginTop: (theme) => (theme.spacing(2))}}>{"'" + object.submissionText + "'"} (theme.spacing(2))}}> - (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[0] : null} - (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[1].slice(0,6) : null} + (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[0] : '-'} + (theme.typography.fontWeightLight)}} >{object?.timestamp ? new Date(object.timestamp).toLocaleString().split(',')[1] !== undefined ? new Date(object.timestamp).toLocaleString().split(',')[1].slice(0,6) : '-' : '-'} ); diff --git a/components/elements/searchDropdown.js b/components/elements/searchDropdown.js index fdd633a..b8e498b 100644 --- a/components/elements/searchDropdown.js +++ b/components/elements/searchDropdown.js @@ -26,6 +26,7 @@ import { removeCitizenRiverFloodEventsData } from "../../store/actions"; import locationPaths from "../../data/locationPaths"; +import locationPathsBR from "../../data/locationPathsBR"; import config from "../../api/config"; import uiText from "../../data/ui-text"; import requestCitizenEvents from "../../api/requestCitizenEvents"; @@ -112,7 +113,7 @@ const SearchDropdown = ({ configureAPI, toggleDate, toggleGreatestDateRange, tog {searchResult['placename']} {searchResult['hascitizendata'] ? "": uiText.global.labels.hasNoCitizenData[toggleLanguage.language]} - + diff --git a/components/modules/cookies.js b/components/modules/cookies.js deleted file mode 100644 index 7b95bb6..0000000 --- a/components/modules/cookies.js +++ /dev/null @@ -1,116 +0,0 @@ -// Cookies Component to Render Cookies Banner -// Complies with Google Analytics - Will Accept Cookies and Set Expiration Date for 1 year from now - -// Package Imports -import {Box, Container, styled, Typography, Button} from "@mui/material"; -import {useEffect, useState} from "react"; - -// Cookies Banner Component -const CookiesBanner = ({}) => { - - const [cookieConsent, setCookieConsent] = useState(false) - - const getCookieValue = (name) => ( - document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || '' - ) - - useEffect(() => { - - const documentCookiesConsent = getCookieValue('CookieConsent') === "true" - - setCookieConsent(documentCookiesConsent) - - }, [cookieConsent]) - - - const handleClick = (e) => { - let expires = "expires=" + new Date(new Date().setDate(new Date().getDate() + 365)).toUTCString(); - // Logic - if (e.target.id === "reject-button") { - document.cookie = `CookieConsent=false;${expires}` - setCookieConsent(false) - document.querySelector('#cookies-container').style.display = 'none'; - } else if (e.target.id === "accept-button") { - document.cookie = `CookieConsent=true;${expires}` - setCookieConsent(true) - } - } - - return ( - !cookieConsent && ( - - - This site uses cookies. - By continuing to browse you are agreeing to the use of cookies detailed in our privacy policy. - - - No Thanks - {"That's OK"} - - - - ) - ); -} - -const CookiesContainer = styled(Container)(({theme}) => ({ - maxWidth: `90%`, - backgroundColor: `#fff`, - display: `flex`, - justifyContent: `space-between`, - alignItems: `center`, - borderRadius: theme.shape.borderRadius, - boxShadow: `0px 8px 15px 0px rgba(0, 0, 0, 0.10)`, - paddingTop: theme.spacing(2), - paddingBottom: theme.spacing(2), - position: `fixed`, - bottom: theme.spacing(2), - left: 0, - right: 0, - marginLeft: `auto`, - marginRight: `auto`, - zIndex: `10000000` -})) - -const CookiesButtonFlex = styled(Box)(({theme}) => ({ - display: `flex`, - [theme.breakpoints.down('sm')] : { - flexDirection: `column-reverse`, - flexWrap: `wrap`, - gap: `.5em` - } -})) - -const CookiesTextBox = styled(Box)(({theme}) => ({ - display: `flex`, - flexDirection: `column`, -})) - -const CookiesText = styled(Typography)(({theme}) => ({ - fontSize: `14px`, - textAlign: `left`, - fontWeight: theme.typography.fontWeightLight, - color: `#888888`, - [theme.breakpoints.down('md')] : { - fontSize: `10px` - } -})) - - -const CustomButton = styled(Button)(({theme}) => ({ - width: `max-content !important`, - minWidth: `150px`, - fontSize: `12px`, - height: `min-content`, - marginLeft: theme.spacing(1), - [theme.breakpoints.down('md')] : { - fontSize: `10px`, - minWidth: `145px`, - }, - [theme.breakpoints.down('sm')] : { - fontSize: `8px`, - minWidth: `125px`, - } -})) - -export default CookiesBanner; diff --git a/components/modules/landing-page/about.js b/components/modules/landing-page/about.js index 2d48e2f..e3f2711 100644 --- a/components/modules/landing-page/about.js +++ b/components/modules/landing-page/about.js @@ -28,7 +28,7 @@ const About = ({ toggleLanguage }) => { - +
diff --git a/data/locationPathsBR.js b/data/locationPathsBR.js new file mode 100644 index 0000000..d815880 --- /dev/null +++ b/data/locationPathsBR.js @@ -0,0 +1,14 @@ +export default { + M: { + text: "Município", + zoom: 8, + }, + O: { + text: "Organização", + zoom: 15, + }, + E: { + text: "Estado", + zoom: 6, + } +} \ No newline at end of file