Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS-734: Add alumni events to federated search #936

Merged
merged 39 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9ff46e1
Preview search with events.
sherakama Aug 28, 2024
06efbf8
Preview search with events.
sherakama Aug 28, 2024
fe5fd2c
Allow BR tags.
sherakama Aug 28, 2024
e0d9bb6
Allow BR tags.
sherakama Aug 29, 2024
cfc62bf
Thing.
sherakama Sep 6, 2024
7fae149
WIP! Re-write for instantsearch.
sherakama Sep 7, 2024
032e9e0
WIP! Re-write for instantsearch.
sherakama Sep 10, 2024
bd8067b
WIP: Fixes and modal progress.
sherakama Sep 11, 2024
aa2311e
Merge branch 'dev' into DS-734/events-federated
sherakama Sep 11, 2024
178df94
Merge branch 'dev' of github.com:su-sws/saa_alumni into DS-734/events…
sherakama Sep 11, 2024
be4b0fb
wip!
sherakama Sep 20, 2024
cf13b89
Merge branch 'dev' into DS-734/events-federated
sherakama Sep 20, 2024
d16bc0c
Merge branch 'DS-734/events-federated' of github.com:su-sws/saa_alumn…
sherakama Sep 24, 2024
1f62207
Merge branch 'dev' of github.com:su-sws/saa_alumni into DS-734/events…
sherakama Sep 24, 2024
0bb670d
DS-734: Theming search modal.
sherakama Sep 25, 2024
6ba0b50
Merge branch 'dev' of github.com:su-sws/saa_alumni into DS-734/events…
sherakama Sep 25, 2024
4feb264
Refactor modal.
sherakama Sep 25, 2024
b5678f1
Merge branch 'dev' of github.com:su-sws/saa_alumni into DS-734/events…
sherakama Sep 27, 2024
13f4a50
Ready to start mobile for search page.
sherakama Sep 27, 2024
2fb3dfa
Merge branch 'dev' of github.com:su-sws/saa_alumni into DS-734/events…
sherakama Oct 16, 2024
a7dfa08
Fixes and updates.
sherakama Oct 16, 2024
07a5dbd
Wip.
sherakama Oct 17, 2024
82cee30
Wip.
sherakama Oct 18, 2024
2c61d18
Capitals are hard.
sherakama Oct 21, 2024
76f2075
Added icons instead of words to result.
sherakama Oct 21, 2024
4d7c541
Remove event body.
sherakama Oct 22, 2024
cc85ead
Rename check UTM params.
sherakama Oct 22, 2024
60000c6
Discard changes to src/utilities/synchronizedEvents.js
sherakama Oct 22, 2024
aae5d23
Handle pager config.
sherakama Oct 23, 2024
3ff09bf
Merge branch 'DS-734/events-federated' of github.com:su-sws/saa_alumn…
sherakama Oct 23, 2024
ceb5d95
Set focus on field after clear.
sherakama Oct 23, 2024
2f47970
Bugfixes and refinements.
sherakama Oct 26, 2024
4dd8280
Bugs
sherakama Oct 28, 2024
8493d22
Bugs
sherakama Oct 28, 2024
a6b64c3
Bug fixes.
sherakama Oct 29, 2024
a176ed9
Bug fixes.
sherakama Oct 29, 2024
d35d266
Fixup! Tests.
sherakama Oct 29, 2024
3be38e7
UI bug fix.
sherakama Oct 29, 2024
098f0f3
Update src/components/accessibility/Skiplink.jsx
sherakama Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React from 'react';
// Contexts.
import { GlobalStateProvider } from './src/contexts/GlobalContext';
import { AuthContextProvider } from './src/contexts/AuthContext';
import { SearchModalProvider } from './src/components/search/Modal/SearchModalContext';
sherakama marked this conversation as resolved.
Show resolved Hide resolved

// CSS
import './src/styles/global.css';
Expand All @@ -19,7 +20,9 @@ import './src/styles/light-forms.css';
// Exports.
export const wrapRootElement = ({ element }) => (
<GlobalStateProvider>
<AuthContextProvider>{element}</AuthContextProvider>
<AuthContextProvider>
<SearchModalProvider>{element}</SearchModalProvider>
</AuthContextProvider>
</GlobalStateProvider>
);

Expand Down
10 changes: 5 additions & 5 deletions src/components/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ import Redirect from './redirect/Redirect';
import RegistrationFormPage from './page-types/registrationFormPage/registrationFormPage';
import { SBSAAMainNav } from './storyblok/saaMainNav';
import { SBSAAMainMenuGroup } from './storyblok/saaMainMenuGroup';
import SearchFacet from './search/searchFacet';
import SearchField from './search/searchField';
import SearchFacet from './search/SearchFacet';
import SearchField from './search/SearchField';
import SearchPage from './page-types/searchPage';
import SearchPager from './search/searchPager';
import SearchResults from './search/searchResults';
import SearchSuggestions from './search/searchSuggestions';
import SearchPager from './search/SearchPager';
import SearchResults from './search/SearchResults';
import SearchSuggestions from './search/SearchSuggestions';
import Section from './layout/section';
import SimpleImage from './media/simpleImage';
import Story from './content-types/story/story';
Expand Down
2 changes: 1 addition & 1 deletion src/components/content-types/perk/perkPageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import SbEditable from 'storyblok-react';
import React from 'react';
import { Heading } from '../../simple/Heading';
import CardImage from '../../media/cardImage';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
sherakama marked this conversation as resolved.
Show resolved Hide resolved

const PerkPageView = (props) => {
// Destructure props
Expand Down
2 changes: 1 addition & 1 deletion src/components/content-types/story/storyPageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { DateTime } from 'luxon';
import { Container } from '../../layout/Container';
import { Heading } from '../../simple/Heading';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import CreateBloks from '../../../utilities/createBloks';
import FullWidthImage from '../../media/fullWidthImage';
import getNumBloks from '../../../utilities/getNumBloks';
Expand Down
64 changes: 12 additions & 52 deletions src/components/identity/GlobalHeader/GlobalHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React, { useState, useRef } from 'react';
import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import { FlexBox } from '../../layout/FlexBox';
import { SBLinkType } from '../../../types/storyblok/SBLinkType';
import * as styles from './GlobalHeader.styles';
import CreateBloks from '../../../utilities/createBloks';
import Logo from '../logo';
import OpenSearchModalButton from '../../search/openSearchModalButton';
import OpenSearchModalButton from '../../search/Modal/OpenSearchModalButton';
import SbLink from '../../../utilities/sbLink';
import SearchModal from '../../search/searchModal';
import SearchModal from '../../search/Modal/SearchModal';
import AlumniLogo from '../../../images/saa-logo-white.svg';
import { SBBlokType } from '../../../types/storyblok/SBBlokType';
import useEscape from '../../../hooks/useEscape';
import useDisplay from '../../../hooks/useDisplay';
import SearchModalContext from '../../search/Modal/SearchModalContext';

export const GlobalHeaderProps = {
siteName: PropTypes.string,
Expand All @@ -30,48 +30,15 @@ const GlobalHeader = ({
mainNav,
hasHero,
isDark,
searchPageUrl,
}) => {
const [modalOpen, setModalOpen] = useState(false);
const desktopRef = useRef(null);
const mobileRef = useRef(null);
const openSearchRef = useRef(null);
const openSearchMobileRef = useRef(null);

const returnFocus = () => {
if (openSearchRef.current) {
openSearchRef.current.focus();
} else if (openSearchMobileRef.current) {
openSearchMobileRef.current.focus();
}
};

const handleClose = () => {
setModalOpen(false);
returnFocus();
};

useEscape(() => {
// Only do this if the search modal is open
if (modalOpen) {
const searchInputModal =
document.getElementsByClassName('search-input-modal')[0];

// Only close the modal with Escape key if the autocomplete dropdown is not open
if (searchInputModal.getAttribute('aria-expanded') !== 'true') {
setModalOpen(false);
returnFocus();
}
}
});

// Use the useDisplay hook to determine whether to display the desktop of mobile header
const { showDesktop, showMobile } = useDisplay();
const { desktopButtonRef, mobileButtonRef } = useContext(SearchModalContext);

return (
<>
{showMobile && (
<div className={styles.rootMobile} ref={mobileRef}>
<div className={styles.rootMobile}>
<CreateBloks
blokSection={utilityNav}
ariaLabel="Utility Menu"
Expand All @@ -98,17 +65,16 @@ const GlobalHeader = ({
</div>
<FlexBox>
<OpenSearchModalButton
openOpen={modalOpen}
setModalOpen={setModalOpen}
ref={openSearchMobileRef}
id="mastead-search-openmodal-mobile"
ref={mobileButtonRef}
/>
<CreateBloks blokSection={mainNav} ariaLabel="Main Menu" />
</FlexBox>
</FlexBox>
</div>
)}
{showDesktop && (
<div className={styles.root({ hasHero, isDark })} ref={desktopRef}>
<div className={styles.root({ hasHero, isDark })}>
<FlexBox justifyContent="between" alignItems="start">
<div className={styles.logoWrapper}>
<Logo className={styles.logo} />
Expand All @@ -122,9 +88,8 @@ const GlobalHeader = ({
itemClasses={styles.utilNavItem}
/>
<OpenSearchModalButton
openOpen={modalOpen}
setModalOpen={setModalOpen}
ref={openSearchRef}
id="mastead-search-openmodal-desktop"
ref={desktopButtonRef}
/>
</div>
</FlexBox>
Expand All @@ -136,12 +101,7 @@ const GlobalHeader = ({
<CreateBloks blokSection={mainNav} ariaLabel="Main Menu" />
</div>
)}
<SearchModal
isOpen={modalOpen}
setIsOpen={setModalOpen}
searchPageUrl={searchPageUrl}
onClose={handleClose}
/>
<SearchModal />
</>
);
};
Expand Down
74 changes: 14 additions & 60 deletions src/components/identity/masthead.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import React, { useState, useRef } from 'react';
import React, { useContext } from 'react';
import SbEditable from 'storyblok-react';
import { dcnb } from 'cnbuilder';
import CreateBloks from '../../utilities/createBloks';
import Logo from './logo';
import { FlexBox } from '../layout/FlexBox';
import OpenSearchModalButton from '../search/openSearchModalButton';
import SearchModal from '../search/searchModal';
import OpenSearchModalButton from '../search/Modal/OpenSearchModalButton';
import SearchModal from '../search/Modal/SearchModal';
import * as styles from './GlobalHeader/GlobalHeader.styles';
import useEscape from '../../hooks/useEscape';
import useDisplay from '../../hooks/useDisplay';
import AccountLinks from '../navigation/accountLinks';
import SearchModalContext from '../search/Modal/SearchModalContext';

const Masthead = ({
blok: { mainNav, utilityNav, searchPageUrl },
blok,
hasHero,
isDark,
}) => {
const [modalOpen, setModalOpen] = useState(false);
const desktopRef = useRef(null);
const mobileRef = useRef(null);
const openSearchRef = useRef(null);
const openSearchMobileRef = useRef(null);

const Masthead = ({ blok: { mainNav, utilityNav }, blok, hasHero, isDark }) => {
let mainNavBgColorXl =
'xl:su-bg-transparent xl:su-bg-gradient-to-b xl:su-from-masthead-black-top xl:su-to-masthead-black-bottom su-backface-hidden';
let mainNavBgColorLg =
Expand All @@ -33,43 +22,16 @@ const Masthead = ({
mainNavBgColorLg = 'su-bg-saa-black';
}

const returnFocus = () => {
if (openSearchRef.current) {
openSearchRef.current.focus();
} else if (openSearchMobileRef.current) {
openSearchMobileRef.current.focus();
}
};

const handleClose = () => {
setModalOpen(false);
returnFocus();
};

useEscape(() => {
// Only do this if the search modal is open
if (modalOpen) {
const searchInputModal =
document.getElementsByClassName('search-input-modal')[0];

// Only close the modal with Escape key if the autocomplete dropdown is not open
if (searchInputModal.getAttribute('aria-expanded') !== 'true') {
setModalOpen(false);
returnFocus();
}
}
});

// Use the useDisplay hook to determine whether to display the desktop of mobile header
const { showDesktop, showMobile } = useDisplay();

// Get refs from the SearchModalContext
const { desktopButtonRef, mobileButtonRef } = useContext(SearchModalContext);

return (
<SbEditable content={blok}>
{showMobile && (
<div
className="masthead-mobile su-relative su-w-full lg:su-hidden su-bg-cardinal-red-xdark"
ref={mobileRef}
>
<div className="masthead-mobile su-relative su-w-full lg:su-hidden su-bg-cardinal-red-xdark">
<nav aria-label="Utility Menu" className={styles.utilNavMobile}>
<ul className={styles.utilNavMenuMobile}>
<CreateBloks
Expand All @@ -89,9 +51,8 @@ const Masthead = ({
</FlexBox>
<FlexBox>
<OpenSearchModalButton
openOpen={modalOpen}
setModalOpen={setModalOpen}
ref={openSearchMobileRef}
id="mastead-search-openmodal-mobile"
ref={mobileButtonRef}
/>
<CreateBloks blokSection={mainNav} className="su-shrink-0" />
</FlexBox>
Expand All @@ -102,7 +63,6 @@ const Masthead = ({
<div
className={`masthead-desktop su-hidden lg:su-block su-w-full su-z-20
${hasHero ? 'su-absolute' : 'su-relative'}`}
ref={desktopRef}
>
<FlexBox>
<FlexBox
Expand Down Expand Up @@ -133,9 +93,8 @@ const Masthead = ({
</ul>
</nav>
<OpenSearchModalButton
openOpen={modalOpen}
setModalOpen={setModalOpen}
ref={openSearchRef}
id="mastead-search-openmodal-desktop"
ref={desktopButtonRef}
/>
</FlexBox>
<CreateBloks
Expand All @@ -153,12 +112,7 @@ const Masthead = ({
/>
</div>
)}
<SearchModal
isOpen={modalOpen}
setIsOpen={setModalOpen}
onClose={handleClose}
searchPageUrl={searchPageUrl}
/>
<SearchModal />
</SbEditable>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/page-types/TripFilterPage/TripFilterPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GridCell } from '../../layout/GridCell';
import { Container } from '../../layout/Container';
import { Heading } from '../../simple/Heading';
import { Skiplink } from '../../accessibility/Skiplink';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import CreateBloks from '../../../utilities/createBloks';
import { useTripFilters } from '../../../hooks/useTripFilters';
import { TripFilterList } from '../../composite/TripFilterList/TripFilterList';
Expand Down Expand Up @@ -183,7 +183,7 @@ const TripFilterPage = (props) => {
className={dcnb('filtered-trips-list', styles.trips)}
>
{trips.map((trip) => (
<TripCard key={trip.id} trip={trip} />
<TripCard key={`trip-${trip.id}`} trip={trip} />
))}
</Grid>
{totalPages > 1 && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/page-types/TripPage/TripPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SbEditable from 'storyblok-react';
import useScrollSpy from 'react-use-scrollspy';
import { Alert } from '../../composite/Alert/Alert';
import { luxonDate, luxonToday } from '../../../utilities/dates';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import { TripContent } from '../../../types/TripType';
import * as styles from './TripPage.styles';
import Ankle from '../../partials/ankle/ankle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SbEditable from 'storyblok-react';
import { dcnb } from 'cnbuilder';
import { Container } from '../../layout/Container';
import { Heading } from '../../simple/Heading';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import hasRichText from '../../../utilities/hasRichText';
import RichTextRenderer from '../../../utilities/richTextRenderer';
import CreateBloks from '../../../utilities/createBloks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SbEditable from 'storyblok-react';
import { dcnb } from 'cnbuilder';
import { Container } from '../layout/Container';
import { Heading } from '../simple/Heading';
import Layout from '../partials/layout';
import Layout from '../partials/Layout';
import CreateBloks from '../../utilities/createBloks';
import getNumBloks from '../../utilities/getNumBloks';
import Ankle from '../partials/ankle/ankle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import SbEditable from 'storyblok-react';
import { Container } from '../layout/Container';
import { Heading } from '../simple/Heading';
import Layout from '../partials/layout';
import Layout from '../partials/Layout';
import Ankle from '../partials/ankle/ankle';
import CreateBloks from '../../utilities/createBloks';
import getNumBloks from '../../utilities/getNumBloks';
Expand Down
2 changes: 1 addition & 1 deletion src/components/page-types/formPage/formPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect, useContext } from 'react';
import SbEditable from 'storyblok-react';
import { Container } from '../../layout/Container';
import { Heading } from '../../simple/Heading';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import CreateBloks from '../../../utilities/createBloks';
import getNumBloks from '../../../utilities/getNumBloks';
import Ankle from '../../partials/ankle/ankle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import GsbLogoColor from '../../images/gsb_logo-color.png';
import RichTextRenderer from '../../utilities/richTextRenderer';
import { Grid } from '../layout/Grid';
import { GridCell } from '../layout/GridCell';
import Layout from '../partials/layout';
import Layout from '../partials/Layout';
import AuthenticatedPage from '../auth/AuthenticatedPage';
import { Container } from '../layout/Container';
import { Heading } from '../simple/Heading';
Expand Down
2 changes: 1 addition & 1 deletion src/components/page-types/lightFormPage/lightFormPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { dcnb } from 'cnbuilder';
import { ClipLoader } from 'react-spinners';
import { Container } from '../../layout/Container';
import { Heading } from '../../simple/Heading';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import CreateBloks from '../../../utilities/createBloks';
import getNumBloks from '../../../utilities/getNumBloks';
import Ankle from '../../partials/ankle/ankle';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Link } from 'gatsby';
import { useLocation } from '@reach/router';
import { Container } from '../../layout/Container';
import { Heading } from '../../simple/Heading';
import Layout from '../../partials/layout';
import Layout from '../../partials/Layout';
import { HeroImage } from '../../composite/HeroImage/HeroImage';
import { Grid } from '../../layout/Grid';
import AuthenticatedPage from '../../auth/AuthenticatedPage';
Expand Down
Loading
Loading