-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maint 853 update baner with new townhall link (#857)
* maint: updated banner with new tonwhall link * fix: update hover color * chore: linting * fix: file name change and linting
- Loading branch information
Showing
2 changed files
with
64 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,80 @@ | ||
import Close from "@mui/icons-material/Close"; | ||
import { IconButton } from "@mui/material"; | ||
import { AxiosError } from "axios"; | ||
import useGoogleAnalytics from "hooks/useGoogleAnalytics"; | ||
import { SnackbarKey, SnackbarProvider } from "notistack"; | ||
import { useEffect, useRef } from "react"; | ||
import { QueryCache, QueryClient, QueryClientProvider } from "react-query"; | ||
import Navbar from "components/Navbar/Navbar"; | ||
import useGetToken from "./hooks/useGetToken"; | ||
import BaseNavigation from "pages/BaseNavigation/BaseNavigation"; | ||
import { useLocation } from "react-router-dom"; | ||
import Banner from "components/Downbanner"; | ||
import Close from '@mui/icons-material/Close'; | ||
import { IconButton } from '@mui/material'; | ||
import { AxiosError } from 'axios'; | ||
import useGoogleAnalytics from 'hooks/useGoogleAnalytics'; | ||
import { SnackbarKey, SnackbarProvider } from 'notistack'; | ||
import { useEffect, useRef } from 'react'; | ||
import { QueryCache, QueryClient, QueryClientProvider } from 'react-query'; | ||
import Navbar from 'components/Navbar/Navbar'; | ||
import useGetToken from './hooks/useGetToken'; | ||
import BaseNavigation from 'pages/BaseNavigation/BaseNavigation'; | ||
import { useLocation } from 'react-router-dom'; | ||
import Banner from 'components/Banner'; | ||
|
||
const queryClient = new QueryClient({ | ||
defaultOptions: { | ||
queries: { | ||
retry: 0, | ||
refetchOnWindowFocus: false, | ||
// staleTime: 5000, // https://tkdodo.eu/blog/practical-react-query#the-defaults-explained | ||
defaultOptions: { | ||
queries: { | ||
retry: 0, | ||
refetchOnWindowFocus: false, | ||
// staleTime: 5000, // https://tkdodo.eu/blog/practical-react-query#the-defaults-explained | ||
}, | ||
}, | ||
}, | ||
queryCache: new QueryCache({ | ||
onError: (error) => { | ||
console.log({ error }); | ||
const responseStatus = (error as AxiosError)?.response?.status; | ||
if (responseStatus && responseStatus === 404) { | ||
console.error("could not find resource"); | ||
} | ||
}, | ||
}), | ||
queryCache: new QueryCache({ | ||
onError: (error) => { | ||
console.log({ error }); | ||
const responseStatus = (error as AxiosError)?.response?.status; | ||
if (responseStatus && responseStatus === 404) { | ||
console.error('could not find resource'); | ||
} | ||
}, | ||
}), | ||
}); | ||
|
||
declare global { | ||
interface Window { | ||
gtag?: ( | ||
type: "event" | "config" | "get" | "set" | "consent", | ||
action: "login" | "page_view", | ||
options?: any | ||
) => void; | ||
} | ||
interface Window { | ||
gtag?: ( | ||
type: 'event' | 'config' | 'get' | 'set' | 'consent', | ||
action: 'login' | 'page_view', | ||
options?: any | ||
) => void; | ||
} | ||
} | ||
|
||
function App() { | ||
const notistackRef = useRef<SnackbarProvider>(null); | ||
useGetToken(); | ||
useGoogleAnalytics(); | ||
const notistackRef = useRef<SnackbarProvider>(null); | ||
useGetToken(); | ||
useGoogleAnalytics(); | ||
|
||
const location = useLocation(); | ||
useEffect(() => { | ||
if (window.gtag) { | ||
window.gtag("event", "page_view", { | ||
page_path: `${location.pathname}${location.search}`, | ||
}); | ||
} | ||
}, [location]); | ||
const location = useLocation(); | ||
useEffect(() => { | ||
if (window.gtag) { | ||
window.gtag('event', 'page_view', { | ||
page_path: `${location.pathname}${location.search}`, | ||
}); | ||
} | ||
}, [location]); | ||
|
||
const handleCloseSnackbar = | ||
(key: SnackbarKey) => (_event: React.MouseEvent) => { | ||
if (notistackRef?.current?.closeSnackbar) | ||
notistackRef.current?.closeSnackbar(key); | ||
const handleCloseSnackbar = (key: SnackbarKey) => (_event: React.MouseEvent) => { | ||
if (notistackRef?.current?.closeSnackbar) notistackRef.current?.closeSnackbar(key); | ||
}; | ||
|
||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<SnackbarProvider | ||
ref={notistackRef} | ||
autoHideDuration={8000} | ||
action={(key) => ( | ||
<IconButton onClick={handleCloseSnackbar(key)}> | ||
<Close sx={{ color: "white" }} /> | ||
</IconButton> | ||
)} | ||
> | ||
<Banner /> | ||
<Navbar /> | ||
<BaseNavigation /> | ||
</SnackbarProvider> | ||
</QueryClientProvider> | ||
); | ||
return ( | ||
<QueryClientProvider client={queryClient}> | ||
<SnackbarProvider | ||
ref={notistackRef} | ||
autoHideDuration={8000} | ||
action={(key) => ( | ||
<IconButton onClick={handleCloseSnackbar(key)}> | ||
<Close sx={{ color: 'white' }} /> | ||
</IconButton> | ||
)} | ||
> | ||
<Banner /> | ||
<Navbar /> | ||
<BaseNavigation /> | ||
</SnackbarProvider> | ||
</QueryClientProvider> | ||
); | ||
} | ||
|
||
export default App; |
File renamed without changes.