Skip to content

Commit e431be0

Browse files
authored
MAINT: add banner for town hall (#844)
* MAINT: add banner for town hall * fix: failing integration tests * Dummy commit to trigger something
1 parent d1e544e commit e431be0

File tree

4 files changed

+134
-111
lines changed

4 files changed

+134
-111
lines changed

compose/neurosynth-frontend/cypress/e2e/workflows/Extraction/ExtractionTable.cy.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,24 +154,30 @@ describe('ExtractionTable', () => {
154154
});
155155
});
156156

157-
it('should remove the filter if the delete button is clicked', () => {
157+
it.only('should remove the filter if the delete button is clicked', () => {
158+
let studysetYear = '';
158159
// ARRANGE
159160
cy.wait('@studysetFixture').then((studysetFixture) => {
160161
const studyset = studysetFixture?.response?.body as StudysetReturn;
161162
const studysetStudies = studyset.studies as StudyReturn[];
163+
studysetYear = studysetStudies[0].year?.toString() || "";
162164
cy.get('input').eq(0).click();
163165
cy.get(`input`)
164166
.eq(0)
165167
.type(studysetStudies[0].year?.toString() || '');
166168
});
167169
cy.get('tbody > tr').should('have.length', 1);
168-
cy.get('[data-testid="CancelIcon"]').should('exist');
170+
169171
// ACT
170-
cy.get('[data-testid="CancelIcon"]').click();
172+
cy.contains(
173+
`Filtering YEAR: ${studysetYear}`
174+
).parent().find('[data-testid="CancelIcon"]').click();
171175

172176
// ASSERT
173177
cy.get('tbody > tr').should('have.length', 3);
174-
cy.get(`[data-testid="CancelIcon"]`).should('not.exist');
178+
cy.contains(
179+
`Filtering YEAR: ${studysetYear}`
180+
).should('not.exist')
175181
});
176182
});
177183

compose/neurosynth-frontend/cypress/e2e/workflows/SleuthImport/DoSleuthImport.cy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ describe('DoSleuthImport', () => {
422422

423423
it('should select MKDA and create an MKDA meta analysis', () => {
424424
cy.contains('button', 'Yes').click();
425-
cy.get('[type="radio"]').eq(1).click();
425+
cy.get('[type="radio"]').eq(1).click({ force: true });
426426
cy.contains('button', 'create')
427427
.click()
428428
.wait('@specificationPostFixture')
Lines changed: 66 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,82 @@
1-
import Close from '@mui/icons-material/Close';
2-
import { IconButton } from '@mui/material';
3-
import { AxiosError } from 'axios';
4-
import useGoogleAnalytics from 'hooks/useGoogleAnalytics';
5-
import { SnackbarKey, SnackbarProvider } from 'notistack';
6-
import { useEffect, useRef } from 'react';
7-
import { QueryCache, QueryClient, QueryClientProvider } from 'react-query';
8-
import Navbar from 'components/Navbar/Navbar';
9-
import useGetToken from './hooks/useGetToken';
10-
import BaseNavigation from 'pages/BaseNavigation/BaseNavigation';
11-
import { useLocation } from 'react-router-dom';
1+
import Close from "@mui/icons-material/Close";
2+
import { IconButton } from "@mui/material";
3+
import { AxiosError } from "axios";
4+
import useGoogleAnalytics from "hooks/useGoogleAnalytics";
5+
import { SnackbarKey, SnackbarProvider } from "notistack";
6+
import { useEffect, useRef } from "react";
7+
import { QueryCache, QueryClient, QueryClientProvider } from "react-query";
8+
import Navbar from "components/Navbar/Navbar";
9+
import useGetToken from "./hooks/useGetToken";
10+
import BaseNavigation from "pages/BaseNavigation/BaseNavigation";
11+
import { useLocation } from "react-router-dom";
12+
import Downbanner from "components/Downbanner";
1213

1314
const queryClient = new QueryClient({
14-
defaultOptions: {
15-
queries: {
16-
retry: 0,
17-
refetchOnWindowFocus: false,
18-
// staleTime: 5000, // https://tkdodo.eu/blog/practical-react-query#the-defaults-explained
19-
},
15+
defaultOptions: {
16+
queries: {
17+
retry: 0,
18+
refetchOnWindowFocus: false,
19+
// staleTime: 5000, // https://tkdodo.eu/blog/practical-react-query#the-defaults-explained
2020
},
21-
queryCache: new QueryCache({
22-
onError: (error) => {
23-
console.log({ error });
24-
const responseStatus = (error as AxiosError)?.response?.status;
25-
if (responseStatus && responseStatus === 404) {
26-
console.error('could not find resource');
27-
}
28-
},
29-
}),
21+
},
22+
queryCache: new QueryCache({
23+
onError: (error) => {
24+
console.log({ error });
25+
const responseStatus = (error as AxiosError)?.response?.status;
26+
if (responseStatus && responseStatus === 404) {
27+
console.error("could not find resource");
28+
}
29+
},
30+
}),
3031
});
3132

3233
declare global {
33-
interface Window {
34-
gtag?: (
35-
type: 'event' | 'config' | 'get' | 'set' | 'consent',
36-
action: 'login' | 'page_view',
37-
options?: any
38-
) => void;
39-
}
34+
interface Window {
35+
gtag?: (
36+
type: "event" | "config" | "get" | "set" | "consent",
37+
action: "login" | "page_view",
38+
options?: any
39+
) => void;
40+
}
4041
}
4142

4243
function App() {
43-
const notistackRef = useRef<SnackbarProvider>(null);
44-
useGetToken();
45-
useGoogleAnalytics();
44+
const notistackRef = useRef<SnackbarProvider>(null);
45+
useGetToken();
46+
useGoogleAnalytics();
4647

47-
const location = useLocation();
48-
useEffect(() => {
49-
if (window.gtag) {
50-
window.gtag('event', 'page_view', {
51-
page_path: `${location.pathname}${location.search}`,
52-
});
53-
}
54-
}, [location]);
48+
const location = useLocation();
49+
useEffect(() => {
50+
if (window.gtag) {
51+
window.gtag("event", "page_view", {
52+
page_path: `${location.pathname}${location.search}`,
53+
});
54+
}
55+
}, [location]);
5556

56-
const handleCloseSnackbar = (key: SnackbarKey) => (_event: React.MouseEvent) => {
57-
if (notistackRef?.current?.closeSnackbar) notistackRef.current?.closeSnackbar(key);
57+
const handleCloseSnackbar =
58+
(key: SnackbarKey) => (_event: React.MouseEvent) => {
59+
if (notistackRef?.current?.closeSnackbar)
60+
notistackRef.current?.closeSnackbar(key);
5861
};
5962

60-
return (
61-
<QueryClientProvider client={queryClient}>
62-
<SnackbarProvider
63-
ref={notistackRef}
64-
autoHideDuration={8000}
65-
action={(key) => (
66-
<IconButton onClick={handleCloseSnackbar(key)}>
67-
<Close sx={{ color: 'white' }} />
68-
</IconButton>
69-
)}
70-
>
71-
<Navbar />
72-
<BaseNavigation />
73-
</SnackbarProvider>
74-
</QueryClientProvider>
75-
);
63+
return (
64+
<QueryClientProvider client={queryClient}>
65+
<SnackbarProvider
66+
ref={notistackRef}
67+
autoHideDuration={8000}
68+
action={(key) => (
69+
<IconButton onClick={handleCloseSnackbar(key)}>
70+
<Close sx={{ color: "white" }} />
71+
</IconButton>
72+
)}
73+
>
74+
<Downbanner />
75+
<Navbar />
76+
<BaseNavigation />
77+
</SnackbarProvider>
78+
</QueryClientProvider>
79+
);
7680
}
7781

7882
export default App;
Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,65 @@
1-
import { Cancel } from '@mui/icons-material';
2-
import ErrorOutlineIcon from '@mui/icons-material/ErrorOutline';
3-
import { Box, IconButton } from '@mui/material';
4-
import BaseNavigationStyles from 'pages/BaseNavigation/BaseNavigation.styles';
5-
import { useState } from 'react';
1+
import { Cancel } from "@mui/icons-material";
2+
import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople";
3+
import { Box, IconButton, Link } from "@mui/material";
4+
import BaseNavigationStyles from "pages/BaseNavigation/BaseNavigation.styles";
5+
import { useState } from "react";
6+
7+
const localStorageDownBannerKey = "hide-downbanner-nov-6-2024";
68

79
const Downbanner: React.FC = () => {
8-
const shouldHide = !!localStorage.getItem('hide-downbanner-sep-13-2024');
9-
const [hideBanner, setHideBanner] = useState(shouldHide);
10+
const shouldHide = !!localStorage.getItem(localStorageDownBannerKey);
11+
const [hideBanner, setHideBanner] = useState(shouldHide);
1012

11-
if (hideBanner) return <></>;
13+
if (hideBanner) return <></>;
1214

13-
return (
14-
<Box
15-
sx={{
16-
backgroundColor: 'secondary.main',
17-
color: 'primary.contrastText',
18-
width: '100%',
19-
paddingY: '0.5rem',
20-
}}
21-
>
22-
<Box
23-
sx={[
24-
BaseNavigationStyles.pagesContainer,
25-
{
26-
marginY: '0',
27-
display: 'flex',
28-
alignItems: 'center',
29-
justifyContent: 'space-between',
30-
},
31-
]}
32-
>
33-
<Box display="flex" alignItems="center">
34-
<ErrorOutlineIcon sx={{ mr: '1rem' }} />
35-
Neurosynth-compose will be undergoing planned maintenance and will be offline on
36-
friday (Sep/13/2024)
37-
</Box>
38-
<IconButton
39-
onClick={() => {
40-
localStorage.setItem('hide-downbanner-sep-13-2024', 'true');
41-
setHideBanner(true);
42-
}}
43-
sx={{ padding: 0, ':hover': { backgroundColor: 'secondary.light' } }}
44-
>
45-
<Cancel />
46-
</IconButton>
47-
</Box>
15+
return (
16+
<Box
17+
sx={{
18+
backgroundColor: "primary.dark",
19+
color: "primary.contrastText",
20+
width: "100%",
21+
paddingY: "0.5rem",
22+
}}
23+
>
24+
<Box
25+
sx={[
26+
BaseNavigationStyles.pagesContainer,
27+
{
28+
marginY: "0",
29+
display: "flex",
30+
alignItems: "center",
31+
justifyContent: "space-between",
32+
},
33+
]}
34+
>
35+
<Box display="flex" alignItems="center">
36+
<EmojiPeopleIcon sx={{ mr: "1rem" }} />
37+
Join us next Wednesday, November 13th at 19:00 ET for the inaugural
38+
Neurosynth Compose Virtual Town Hall!{" "}
39+
<Link
40+
color="primary.contrastText"
41+
sx={{ marginLeft: "4px" }}
42+
href="https://smmo1.mjt.lu/lnk/AUUAAFUYj_MAAAAYAkQAAMQWKMIAAAABy9QAAd5pACejZgBnKVfVT2hXpDCyQC6H3aykCv_XyAAbJus/1/mr5Wo-0t0LWaATWN2bFHLA/aHR0cHM6Ly90YWxseS5zby9yLzN5cWIwNA"
43+
target="_blank"
44+
>
45+
Click here to register
46+
</Link>
4847
</Box>
49-
);
48+
<IconButton
49+
onClick={() => {
50+
localStorage.setItem(localStorageDownBannerKey, "true");
51+
setHideBanner(true);
52+
}}
53+
sx={{
54+
padding: 0,
55+
":hover": { backgroundColor: "secondary.light" },
56+
}}
57+
>
58+
<Cancel />
59+
</IconButton>
60+
</Box>
61+
</Box>
62+
);
5063
};
5164

5265
export default Downbanner;

0 commit comments

Comments
 (0)