Skip to content

Commit 70264f4

Browse files
committed
feat: added help page and tests
1 parent 7f95bac commit 70264f4

File tree

4 files changed

+81
-21
lines changed

4 files changed

+81
-21
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
describe('HelpPage', () => {
2+
beforeEach(() => {
3+
cy.visit('/help');
4+
});
5+
6+
it('should display Community Support section', () => {
7+
cy.contains('Community Support').should('be.visible');
8+
});
9+
10+
it('should display Email Support section', () => {
11+
cy.contains('Email Support').should('be.visible');
12+
});
13+
14+
it('should have Visit NeuroStars button with correct link', () => {
15+
cy.contains('a', 'Visit NeuroStars')
16+
.should('be.visible')
17+
.and('have.attr', 'href', 'https://neurostars.org/tag/neurosynth-compose')
18+
.and('have.attr', 'target', '_blank')
19+
.and('have.attr', 'rel', 'noopener noreferrer');
20+
});
21+
22+
it('should have Send Email button with correct mailto link', () => {
23+
cy.contains('a', 'Send Email')
24+
.should('be.visible')
25+
.and('have.attr', 'href', 'mailto:[email protected]')
26+
.and('have.attr', 'target', '_blank')
27+
.and('have.attr', 'rel', 'noopener noreferrer');
28+
});
29+
30+
it('should display the email address link in Email Support section', () => {
31+
cy.contains('a', '[email protected]')
32+
.should('be.visible')
33+
.and('have.attr', 'href', 'mailto:[email protected]');
34+
});
35+
36+
it('should display documentation link in tip section', () => {
37+
cy.contains('a', 'documentation')
38+
.should('be.visible')
39+
.and('have.attr', 'href', 'https://neurostuff.github.io/compose-docs/')
40+
.and('have.attr', 'target', '_blank');
41+
});
42+
});

compose/neurosynth-frontend/src/components/Navbar/NavToolbar.tsx

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,33 @@ const NavToolbar: React.FC<INav> = (props) => {
6161
buttonLabel="explore"
6262
/>
6363

64-
<Button
64+
<NavToolbarPopupSubMenu
65+
buttonProps={{
66+
sx: [
67+
NavToolbarStyles.menuItemColor,
68+
NavToolbarStyles.menuItemPadding,
69+
NavToolbarStyles.menuItem,
70+
],
71+
endIcon: <KeyboardArrowDownIcon />,
72+
}}
73+
options={[
74+
{
75+
label: (
76+
<Box sx={{ display: 'flex', alignItems: 'center' }}>
77+
Documentation <OpenInNewIcon fontSize="small" sx={{ ml: 1 }} />
78+
</Box>
79+
),
80+
onClick: () => window.open('https://neurostuff.github.io/compose-docs/', '_blank'),
81+
},
82+
{
83+
label: 'Contact Us',
84+
onClick: () => navigate('/help'),
85+
},
86+
]}
87+
buttonLabel="help"
88+
/>
89+
90+
{/* <Button
6591
sx={[
6692
NavToolbarStyles.menuItemColor,
6793
NavToolbarStyles.menuItemPadding,
@@ -74,7 +100,7 @@ const NavToolbar: React.FC<INav> = (props) => {
74100
>
75101
DOCS
76102
<OpenInNewIcon sx={{ marginLeft: '8px', fontSize: '1.2rem' }} />
77-
</Button>
103+
</Button> */}
78104
<NeurosynthAvatar onLogout={props.onLogout} onLogin={props.onLogin} />
79105
</Box>
80106
</Box>

compose/neurosynth-frontend/src/components/Navbar/NavToolbarPopupSubMenu.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface INavToolbarPopupSubMenu {
55
buttonProps: ButtonProps;
66
buttonLabel: string;
77
options: {
8-
label: string;
8+
label: string | React.ReactNode;
99
secondary?: string;
1010
onClick: () => void;
1111
}[];
@@ -37,10 +37,7 @@ const NavToolbarPopupSubMenu: React.FC<INavToolbarPopupSubMenu> = (props) => {
3737
handleCloseNavMenu();
3838
}}
3939
>
40-
<ListItemText
41-
primary={option.label}
42-
secondary={option?.secondary || ''}
43-
/>
40+
<ListItemText primary={option.label} secondary={option?.secondary || ''} />
4441
</ListItemButton>
4542
</ListItem>
4643
))}

compose/neurosynth-frontend/src/pages/HelpPage/HelpPage.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ import EmailIcon from '@mui/icons-material/Email';
44
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
55

66
const HelpPage: React.FC = () => {
7-
const handleNeuroStarsClick = () => {
8-
window.open('https://neurostars.org/tag/neurosynth-compose', '_blank', 'noopener,noreferrer');
9-
};
10-
11-
const handleEmailClick = () => {
12-
window.location.href = 'mailto:[email protected]';
13-
};
14-
157
return (
168
<Box
179
sx={{
@@ -56,15 +48,15 @@ const HelpPage: React.FC = () => {
5648
marginBottom: '1rem',
5749
}}
5850
>
59-
'Join our community on NeuroStars to ask questions, share insights, and connect with
51+
Join our community on NeuroStars to ask questions, share insights, and connect with
6052
other researchers. Get answers from both the Neurosynth team and the wider
61-
neuroscience community.',
53+
neuroscience community.
6254
</Typography>
6355
),
6456
icon: <ForumIcon sx={{ fontSize: '2rem', color: 'white' }} />,
6557
button: {
6658
label: 'Visit NeuroStars',
67-
onClick: handleNeuroStarsClick,
59+
href: 'https://neurostars.org/tag/neurosynth-compose',
6860
},
6961
},
7062
{
@@ -82,13 +74,13 @@ const HelpPage: React.FC = () => {
8274
8375
</Link>{' '}
8476
Our team will get back to you as soon as possible to help resolve your questions or
85-
issues.,
77+
issues.
8678
</Typography>
8779
),
8880
icon: <EmailIcon sx={{ fontSize: '2rem', color: 'white' }} />,
8981
button: {
9082
label: 'Send Email',
91-
onClick: handleEmailClick,
83+
href: 'mailto:[email protected]',
9284
},
9385
},
9486
].map(({ title, descriptionElement, icon, button }) => (
@@ -137,10 +129,13 @@ const HelpPage: React.FC = () => {
137129
<Box>{descriptionElement}</Box>
138130
<Button
139131
variant="contained"
132+
target="_blank"
133+
rel="noopener noreferrer"
140134
size="large"
141135
disableElevation
142136
endIcon={<OpenInNewIcon />}
143-
onClick={button.onClick}
137+
href={button.href}
138+
component="a"
144139
sx={{
145140
width: '230px',
146141
marginTop: 'auto',

0 commit comments

Comments
 (0)