From 26310ed4259f7bb5eb354ef6be8da328c62798b8 Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Wed, 20 Nov 2024 10:58:04 -0500 Subject: [PATCH 1/4] maint: updated banner with new tonwhall link --- compose/neurosynth-frontend/src/App.tsx | 4 ++-- .../src/components/Downbanner.tsx | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compose/neurosynth-frontend/src/App.tsx b/compose/neurosynth-frontend/src/App.tsx index 7d791c8c..648491e8 100644 --- a/compose/neurosynth-frontend/src/App.tsx +++ b/compose/neurosynth-frontend/src/App.tsx @@ -9,7 +9,7 @@ import Navbar from "components/Navbar/Navbar"; import useGetToken from "./hooks/useGetToken"; import BaseNavigation from "pages/BaseNavigation/BaseNavigation"; import { useLocation } from "react-router-dom"; -import Downbanner from "components/Downbanner"; +import Banner from "components/Downbanner"; const queryClient = new QueryClient({ defaultOptions: { @@ -71,7 +71,7 @@ function App() { )} > - + diff --git a/compose/neurosynth-frontend/src/components/Downbanner.tsx b/compose/neurosynth-frontend/src/components/Downbanner.tsx index 078de858..d9ce58a0 100644 --- a/compose/neurosynth-frontend/src/components/Downbanner.tsx +++ b/compose/neurosynth-frontend/src/components/Downbanner.tsx @@ -4,10 +4,10 @@ import { Box, IconButton, Link } from "@mui/material"; import BaseNavigationStyles from "pages/BaseNavigation/BaseNavigation.styles"; import { useState } from "react"; -const localStorageDownBannerKey = "hide-downbanner-nov-6-2024"; +const localStorageBannerKey = "hide-banner-nov-20-2024"; -const Downbanner: React.FC = () => { - const shouldHide = !!localStorage.getItem(localStorageDownBannerKey); +const Banner: React.FC = () => { + const shouldHide = !!localStorage.getItem(localStorageBannerKey); const [hideBanner, setHideBanner] = useState(shouldHide); if (hideBanner) return <>; @@ -34,12 +34,12 @@ const Downbanner: React.FC = () => { > - Join us next Wednesday, November 13th at 19:00 ET for the inaugural + Join us next Wednesday, December 4th 2024 at 10:00 ET for the Neurosynth Compose Virtual Town Hall!{" "} Click here to register @@ -47,7 +47,7 @@ const Downbanner: React.FC = () => { { - localStorage.setItem(localStorageDownBannerKey, "true"); + localStorage.setItem(localStorageBannerKey, "true"); setHideBanner(true); }} sx={{ @@ -62,4 +62,4 @@ const Downbanner: React.FC = () => { ); }; -export default Downbanner; +export default Banner; From ecaa30f96f0257ea139f98a7d5ad0b2a71ed511f Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Wed, 20 Nov 2024 10:59:42 -0500 Subject: [PATCH 2/4] fix: update hover color --- compose/neurosynth-frontend/src/components/Downbanner.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose/neurosynth-frontend/src/components/Downbanner.tsx b/compose/neurosynth-frontend/src/components/Downbanner.tsx index d9ce58a0..b84a51c6 100644 --- a/compose/neurosynth-frontend/src/components/Downbanner.tsx +++ b/compose/neurosynth-frontend/src/components/Downbanner.tsx @@ -52,7 +52,7 @@ const Banner: React.FC = () => { }} sx={{ padding: 0, - ":hover": { backgroundColor: "secondary.light" }, + ":hover": { backgroundColor: "gray" }, }} > From c95d76f7750c73981f05e348ed055af887ba9ded Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Wed, 20 Nov 2024 11:51:50 -0500 Subject: [PATCH 3/4] chore: linting --- .../src/components/Downbanner.tsx | 111 +++++++++--------- 1 file changed, 55 insertions(+), 56 deletions(-) diff --git a/compose/neurosynth-frontend/src/components/Downbanner.tsx b/compose/neurosynth-frontend/src/components/Downbanner.tsx index b84a51c6..9d13cb76 100644 --- a/compose/neurosynth-frontend/src/components/Downbanner.tsx +++ b/compose/neurosynth-frontend/src/components/Downbanner.tsx @@ -1,65 +1,64 @@ -import { Cancel } from "@mui/icons-material"; -import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople"; -import { Box, IconButton, Link } from "@mui/material"; -import BaseNavigationStyles from "pages/BaseNavigation/BaseNavigation.styles"; -import { useState } from "react"; +import { Cancel } from '@mui/icons-material'; +import EmojiPeopleIcon from '@mui/icons-material/EmojiPeople'; +import { Box, IconButton, Link } from '@mui/material'; +import BaseNavigationStyles from 'pages/BaseNavigation/BaseNavigation.styles'; +import { useState } from 'react'; -const localStorageBannerKey = "hide-banner-nov-20-2024"; +const localStorageBannerKey = 'hide-banner-nov-20-2024'; const Banner: React.FC = () => { - const shouldHide = !!localStorage.getItem(localStorageBannerKey); - const [hideBanner, setHideBanner] = useState(shouldHide); + const shouldHide = !!localStorage.getItem(localStorageBannerKey); + const [hideBanner, setHideBanner] = useState(shouldHide); - if (hideBanner) return <>; + if (hideBanner) return <>; - return ( - - - - - Join us next Wednesday, December 4th 2024 at 10:00 ET for the - Neurosynth Compose Virtual Town Hall!{" "} - - Click here to register - - - { - localStorage.setItem(localStorageBannerKey, "true"); - setHideBanner(true); - }} - sx={{ - padding: 0, - ":hover": { backgroundColor: "gray" }, - }} + return ( + - - - - - ); + + + + Join us next Wednesday, December 4th 2024 at 10:00 ET for the Neurosynth Compose Virtual Town Hall!{' '} + + Click here to register + + + { + localStorage.setItem(localStorageBannerKey, 'true'); + setHideBanner(true); + }} + sx={{ + padding: 0, + ':hover': { backgroundColor: 'gray' }, + }} + > + + + + + ); }; export default Banner; From 4db3d4e21056b528a86928529ae271c87f410b64 Mon Sep 17 00:00:00 2001 From: Nicholas Lee Date: Wed, 20 Nov 2024 12:03:55 -0500 Subject: [PATCH 4/4] fix: file name change and linting --- compose/neurosynth-frontend/src/App.tsx | 130 +++++++++--------- .../components/{Downbanner.tsx => Banner.tsx} | 0 2 files changed, 64 insertions(+), 66 deletions(-) rename compose/neurosynth-frontend/src/components/{Downbanner.tsx => Banner.tsx} (100%) diff --git a/compose/neurosynth-frontend/src/App.tsx b/compose/neurosynth-frontend/src/App.tsx index 648491e8..1c46a7d9 100644 --- a/compose/neurosynth-frontend/src/App.tsx +++ b/compose/neurosynth-frontend/src/App.tsx @@ -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(null); - useGetToken(); - useGoogleAnalytics(); + const notistackRef = useRef(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 ( - - ( - - - - )} - > - - - - - - ); + return ( + + ( + + + + )} + > + + + + + + ); } export default App; diff --git a/compose/neurosynth-frontend/src/components/Downbanner.tsx b/compose/neurosynth-frontend/src/components/Banner.tsx similarity index 100% rename from compose/neurosynth-frontend/src/components/Downbanner.tsx rename to compose/neurosynth-frontend/src/components/Banner.tsx