diff --git a/compose/neurosynth-frontend/cypress/e2e/pages/HelpPage.cy.tsx b/compose/neurosynth-frontend/cypress/e2e/pages/HelpPage.cy.tsx new file mode 100644 index 00000000..551d0478 --- /dev/null +++ b/compose/neurosynth-frontend/cypress/e2e/pages/HelpPage.cy.tsx @@ -0,0 +1,42 @@ +describe('HelpPage', () => { + beforeEach(() => { + cy.visit('/help'); + }); + + it('should display Community Support section', () => { + cy.contains('Community Support').should('be.visible'); + }); + + it('should display Email Support section', () => { + cy.contains('Email Support').should('be.visible'); + }); + + it('should have Visit NeuroStars button with correct link', () => { + cy.contains('a', 'Visit NeuroStars') + .should('be.visible') + .and('have.attr', 'href', 'https://neurostars.org/tag/neurosynth-compose') + .and('have.attr', 'target', '_blank') + .and('have.attr', 'rel', 'noopener noreferrer'); + }); + + it('should have Send Email button with correct mailto link', () => { + cy.contains('a', 'Send Email') + .should('be.visible') + .and('have.attr', 'href', 'mailto:neurosynthorg@gmail.com') + .and('have.attr', 'target', '_blank') + .and('have.attr', 'rel', 'noopener noreferrer'); + }); + + it('should display the email address link in Email Support section', () => { + cy.contains('a', 'neurosynthorg@gmail.com') + .should('be.visible') + .and('have.attr', 'href', 'mailto:neurosynthorg@gmail.com'); + }); + + it('should display documentation link in tip section', () => { + cy.contains('a', 'documentation') + .should('be.visible') + .and('have.attr', 'href', 'https://neurostuff.github.io/compose-docs/') + .and('have.attr', 'target', '_blank'); + }); +}); diff --git a/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.spec.tsx b/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.spec.tsx index 2b888d7c..30bdac5c 100644 --- a/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.spec.tsx +++ b/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.spec.tsx @@ -36,7 +36,7 @@ describe('NavDrawer component', () => { expect(screen.queryByText('LOGOUT')).not.toBeInTheDocument(); expect(screen.queryByText('EXPLORE')).toBeInTheDocument(); - expect(screen.queryByText('DOCS')).toBeInTheDocument(); + expect(screen.queryByText('Help')).toBeInTheDocument(); expect(screen.queryByText('SIGN IN/SIGN UP')).toBeInTheDocument(); }); @@ -49,7 +49,7 @@ describe('NavDrawer component', () => { expect(screen.queryByText('MY PROJECTS')).toBeInTheDocument(); expect(screen.queryByText('LOGOUT')).toBeInTheDocument(); expect(screen.queryByText('EXPLORE')).toBeInTheDocument(); - expect(screen.queryByText('DOCS')).toBeInTheDocument(); + expect(screen.queryByText('Help')).toBeInTheDocument(); }); it('should login', () => { diff --git a/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.tsx b/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.tsx index 4b8c7a01..a1a2499f 100644 --- a/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.tsx +++ b/compose/neurosynth-frontend/src/components/Navbar/NavDrawer.tsx @@ -26,14 +26,6 @@ const NavDrawer: React.FC = (props) => { const [isOpen, setIsOpen] = useState(false); const navigate = useNavigate(); - const handleOpenDrawer = (_event: React.MouseEvent) => { - setIsOpen(true); - }; - - const handleCloseDrawer = (_event: React.MouseEvent) => { - setIsOpen(false); - }; - return ( = (props) => { to="/" sx={[NavbarStyles.logoContainer, { flexGrow: 1, justifyContent: 'flex-end' }]} > - neurosynth compose logo + neurosynth compose logo neurosynth compose - + setIsOpen(true)}> - + setIsOpen(false)}> {isAuthenticated && ( <> @@ -62,10 +50,7 @@ const NavDrawer: React.FC = (props) => { - + @@ -92,7 +77,27 @@ const NavDrawer: React.FC = (props) => { - + + + + window.open('https://neurostuff.github.io/compose-docs/', '_blank')} + > + + + Documentation + + + + + navigate('/help')}> + + + + + + + {/* - + */} { - isAuthenticated ? props.onLogout() : props.onLogin(); + if (isAuthenticated) { + props.onLogout(); + } else { + props.onLogin(); + } }} > diff --git a/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.spec.tsx b/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.spec.tsx index b5eed12e..766783f9 100644 --- a/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.spec.tsx +++ b/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.spec.tsx @@ -29,7 +29,7 @@ describe('NavToolbar Component', () => { expect(screen.queryByTestId('PersonIcon')).not.toBeInTheDocument(); expect(screen.queryByText('explore')).toBeInTheDocument(); - expect(screen.queryByText('DOCS')).toBeInTheDocument(); + expect(screen.queryByText('help')).toBeInTheDocument(); expect(screen.queryByText('Sign In/Sign Up')).toBeInTheDocument(); }); @@ -41,7 +41,7 @@ describe('NavToolbar Component', () => { expect(screen.queryByText('NEW PROJECT')).toBeInTheDocument(); expect(screen.queryByText('my projects')).toBeInTheDocument(); expect(screen.queryByText('explore')).toBeInTheDocument(); - expect(screen.queryByText('DOCS')).toBeInTheDocument(); + expect(screen.queryByText('help')).toBeInTheDocument(); expect(screen.getByTestId('PersonIcon')).toBeInTheDocument(); }); @@ -66,7 +66,8 @@ describe('NavToolbar Component', () => { it('should open the navpopup menu with the given menu items', () => { render(); - userEvent.click(screen.getByTestId('mock-trigger-show-popup')); + // get the first element (the Explore button) + userEvent.click(screen.getAllByTestId('mock-trigger-show-popup')[0]); expect(screen.getByText('Studies')).toBeInTheDocument(); expect(screen.getByText('Meta-Analyses')).toBeInTheDocument(); }); diff --git a/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.tsx b/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.tsx index c4502553..bd2ed570 100644 --- a/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.tsx +++ b/compose/neurosynth-frontend/src/components/Navbar/NavToolbar.tsx @@ -61,20 +61,31 @@ const NavToolbar: React.FC = (props) => { buttonLabel="explore" /> - + buttonLabel="help" + /> diff --git a/compose/neurosynth-frontend/src/components/Navbar/NavToolbarPopupSubMenu.tsx b/compose/neurosynth-frontend/src/components/Navbar/NavToolbarPopupSubMenu.tsx index 73cf1b78..64b3ede8 100644 --- a/compose/neurosynth-frontend/src/components/Navbar/NavToolbarPopupSubMenu.tsx +++ b/compose/neurosynth-frontend/src/components/Navbar/NavToolbarPopupSubMenu.tsx @@ -5,7 +5,7 @@ export interface INavToolbarPopupSubMenu { buttonProps: ButtonProps; buttonLabel: string; options: { - label: string; + label: string | React.ReactNode; secondary?: string; onClick: () => void; }[]; @@ -37,10 +37,7 @@ const NavToolbarPopupSubMenu: React.FC = (props) => { handleCloseNavMenu(); }} > - + ))} diff --git a/compose/neurosynth-frontend/src/pages/BaseNavigation/BaseNavigation.tsx b/compose/neurosynth-frontend/src/pages/BaseNavigation/BaseNavigation.tsx index e30b442c..0ae319a8 100644 --- a/compose/neurosynth-frontend/src/pages/BaseNavigation/BaseNavigation.tsx +++ b/compose/neurosynth-frontend/src/pages/BaseNavigation/BaseNavigation.tsx @@ -19,6 +19,7 @@ import { Navigate, Route, Routes } from 'react-router-dom'; import LandingPage from '../LandingPage/LandingPage'; import BaseNavigationStyles from './BaseNavigation.styles'; import ProtectedRoute from './components/ProtectedRoute'; +import HelpPage from 'pages/HelpPage/HelpPage'; const EditStudyPage = React.lazy(() => import('pages/Study/EditStudyPage')); const ProjectStudyPage = React.lazy(() => import('pages/Study/ProjectStudyPage')); @@ -215,6 +216,7 @@ const BaseNavigation: React.FC = () => { } /> + } /> { + return ( + + + + + How Can We Help? + + + We're here to support you. Choose the best way to get in touch with us. + + + + + {[ + { + title: 'Community Support', + descriptionElement: ( + + Join our community on NeuroStars to ask questions, share insights, and connect with + other researchers. Get answers from both the Neurosynth team and the wider + neuroscience community. + + ), + icon: , + button: { + label: 'Visit NeuroStars', + href: 'https://neurostars.org/tag/neurosynth-compose', + }, + }, + { + title: 'Email Support', + descriptionElement: ( + + Prefer direct contact? Send us an email at{' '} + + neurosynthorg@gmail.com + {' '} + Our team will get back to you as soon as possible to help resolve your questions or + issues. + + ), + icon: , + button: { + label: 'Send Email', + href: 'mailto:neurosynthorg@gmail.com', + }, + }, + ].map(({ title, descriptionElement, icon, button }) => ( + + + + {icon} + + + {title} + + {descriptionElement} + + + + ))} + + + + + Tip: Before reaching out, you might find answers in our{' '} + + documentation + + . + + + + + ); +}; + +export default HelpPage;