Skip to content

Commit

Permalink
Maint 853 update baner with new townhall link (#857)
Browse files Browse the repository at this point in the history
* maint: updated banner with new tonwhall link

* fix: update hover color

* chore: linting

* fix: file name change and linting
  • Loading branch information
nicoalee authored Nov 20, 2024
1 parent 68f3d28 commit 7a8ee2c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 66 deletions.
130 changes: 64 additions & 66 deletions compose/neurosynth-frontend/src/App.tsx
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;

0 comments on commit 7a8ee2c

Please sign in to comment.