Skip to content

Commit

Permalink
2317 fire warning (#2325)
Browse files Browse the repository at this point in the history
* Add LA Fire warning

* Implement temporary warning message
  • Loading branch information
entrotech authored Jan 17, 2025
1 parent dd13138 commit 0959ddd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 40 deletions.
31 changes: 2 additions & 29 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { CssBaseline, Alert, Snackbar, Stack } from "@mui/material";
import { useEffect } from "react";
import { CssBaseline } from "@mui/material";
import SurveySnackbar from "./components/UI/SurveySnackbar";
import { SiteProvider } from "./contexts/siteContext";
import { ToasterProvider } from "contexts/toasterContext";
Expand Down Expand Up @@ -36,8 +36,6 @@ function App() {
/>
<MapProvider>
<Router>
<LAFireWarning />

<AppRoutes />
{hasUserFeedbackSuveyFeatureFlag && <SurveySnackbar />}
</Router>
Expand All @@ -52,28 +50,3 @@ function App() {
}

export default App;

function LAFireWarning() {
const [snackbarOpen, setSnackbarOpen] = useState(true);

return (
<Stack spacing={2} sx={{ maxWidth: 700 }}>
<Snackbar
open={snackbarOpen}
onClose={() => setSnackbarOpen(false)}
anchorOrigin={{
vertical: "bottom",
horizontal: "right",
}}
>
<Alert
onClose={() => setSnackbarOpen(false)}
severity="warning"
sx={{ width: "100%" }}
>
Due to the LA Fires (Jan 2025), some information may be out-of-date.
</Alert>
</Snackbar>
</Stack>
);
}
5 changes: 5 additions & 0 deletions client/src/components/FoodSeeker/Home.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LocationOn } from "@mui/icons-material";
import {
Alert,
Box,
Button,
CircularProgress,
Expand Down Expand Up @@ -226,6 +227,10 @@ const Home = () => {
</div>
)}
</Box>
<Alert severity="warning">
Due to the LA Fires (Jan 2025), some information may be
out-of-date.
</Alert>
<Box
sx={{
display: "flex",
Expand Down
10 changes: 8 additions & 2 deletions client/src/components/Layout/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppBar, Box, Toolbar, Typography } from "@mui/material";
import { AppBar, Alert, Box, Toolbar, Typography } from "@mui/material";
import useLocationHook from "hooks/useLocationHook";
import PropTypes from "prop-types";
import { Link } from "react-router-dom";
Expand All @@ -11,7 +11,7 @@ Header.propTypes = {
};

export default function Header() {
const { isAuthPage } = useLocationHook();
const { isAuthPage, isMapPage } = useLocationHook();
const imageType = TENANT_LOGO_URL
? TENANT_LOGO_URL.split(".").pop()
: "unknown";
Expand Down Expand Up @@ -62,6 +62,12 @@ export default function Header() {
/>
</a>
</Box>
{isMapPage ? (
<Alert severity="warning">
Due to the LA Fires (Jan 2025), some information may be
out-of-date.
</Alert>
) : null}
<Box
sx={{
display: "flex",
Expand Down
21 changes: 13 additions & 8 deletions client/src/components/Layout/WidgetFooter.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from "@mui/material";
import { Alert, Box } from "@mui/material";
import { useSiteContext } from "contexts/siteContext";
import PropTypes from "prop-types";
import { useEffect, useState } from "react";
Expand Down Expand Up @@ -50,7 +50,7 @@ function WidgetFooterSection(props) {
>
{captionText}
</Box>

{maintainers.map((maintainer) => {
const logoMaintainerPath = maintainer.path;
const imageType = logoMaintainerPath
Expand Down Expand Up @@ -194,12 +194,17 @@ function WidgetFooter() {
boxShadow: "none",
})}
>
<WidgetFooterSection
name="Food Oasis"
logoPath={TENANT_LOGO_URL}
url={`${window.location.origin}`}
alt="Food Oasis Logo"
/>
<div style={{ display: "flex", flexDirection: "row" }}>
<WidgetFooterSection
name="Food Oasis"
logoPath={TENANT_LOGO_URL}
url={`${window.location.origin}`}
alt="Food Oasis Logo"
/>
<Alert severity="warning">
Due to the LA Fires (Jan 2025), some information may be out-of-date.
</Alert>
</div>
<WidgetFooterSection
type="maintainer"
maintainers={maintainers}
Expand Down
4 changes: 3 additions & 1 deletion client/src/hooks/useLocationHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { matchPath, useLocation } from "react-router-dom";
export default function useLocationHook() {
const [isHomePage, setIsHomePage] = useState(false);
const [isAuthPage, setIsAuthPage] = useState(false);
const [isMapPage, setIsMapPage] = useState(false);
const location = useLocation();
const AUTHROUTES = [
"/admin/login",
Expand All @@ -25,7 +26,8 @@ export default function useLocationHook() {
useEffect(() => {
setIsHomePage(location.pathname === "/");
setIsAuthPage(match && match.isExact ? true : false);
setIsMapPage(location.pathname.toLowerCase().includes("organizations"));
}, [location, match]);

return { isHomePage, isAuthPage };
return { isHomePage, isAuthPage, isMapPage };
}

0 comments on commit 0959ddd

Please sign in to comment.