diff --git a/apps/frontpage/components/community/events.tsx b/apps/frontpage/components/community/events.tsx index 8da5f31b..d5776e6f 100644 --- a/apps/frontpage/components/community/events.tsx +++ b/apps/frontpage/components/community/events.tsx @@ -4,91 +4,10 @@ import { TwitterIcon, } from '@storybook/icons'; import type { FC } from 'react'; -import { useMemo } from 'react'; -import { zonedTimeToUtc, format } from 'date-fns-tz'; -import { isPast } from 'date-fns'; import { Youtube } from '../logos/youtube'; import { Section } from './section'; -const rezoneDate = (date: Date) => zonedTimeToUtc(date, 'America/Los_Angeles'); - -const formatDate = (date: Date) => { - // https://github.com/date-fns/date-fns/issues/946 - return { - date: format(date, 'd LLLL, y, h:mmaaa (zzzz)'), - dateShort: format(date, 'd LLL, y, haaa (zzz)'), - }; -}; - -interface Session { - id: number; - title: string; - date: string; - dateShort?: string; - registrationLink: string; -} - -const sessionsData: Session[] = [ - { - id: 0, - title: 'Storybook for Developers', - date: 'July 20, 2023 8:30 AM', - registrationLink: - 'https://docs.google.com/forms/d/e/1FAIpQLSeLAB8aoLNRiW5M5Jpn78qxVnnCETDJYpTAph5732tRFXoFDw/viewform?usp=pp_url&entry.146778204=July+20,+2023', - }, - { - id: 1, - title: 'Storybook for Developers', - date: 'Aug 29, 2023 7:00 AM', - registrationLink: - 'https://docs.google.com/forms/d/e/1FAIpQLSeLAB8aoLNRiW5M5Jpn78qxVnnCETDJYpTAph5732tRFXoFDw/viewform?usp=pp_url&entry.146778204=Aug+29,+2023', - }, - { - id: 2, - title: 'Chromatic & Storybook for Designers', - date: 'Oct 12, 2023 8:30 AM', - registrationLink: - 'https://docs.google.com/forms/d/e/1FAIpQLSeLAB8aoLNRiW5M5Jpn78qxVnnCETDJYpTAph5732tRFXoFDw/viewform?usp=pp_url&entry.146778204=Oct+12,+2023', - }, - { - id: 3, - title: 'Storybook Workflows for Frontend Teams', - date: 'Nov 7, 2023 9:00 AM', - registrationLink: - 'https://docs.google.com/forms/d/e/1FAIpQLSeLAB8aoLNRiW5M5Jpn78qxVnnCETDJYpTAph5732tRFXoFDw/viewform?usp=pp_url&entry.146778204=Nov+7,+2023', - }, -]; - export const Events: FC = () => { - const localizedSessions = useMemo(() => { - return sessionsData - .map((session) => { - const date = rezoneDate(new Date(session.date)); - const info = formatDate(date); - return { - ...session, - isPast: isPast(date), - date: info.date, - dateShort: info.dateShort, - rawDate: new Date(session.date), - }; - }) - .sort( - (a, b) => new Date(a.rawDate).valueOf() - new Date(b.rawDate).valueOf(), - ) - .reduce<{ upcoming: Session[]; past: Session[] }>( - (acc, session) => { - if (session.isPast) { - acc.past.push(session); - } else { - acc.upcoming.push(session); - } - return acc; - }, - { upcoming: [], past: [] }, - ); - }, []); - return (

Join live events & streams

diff --git a/apps/frontpage/package.json b/apps/frontpage/package.json index 14741aba..a42c2ea4 100644 --- a/apps/frontpage/package.json +++ b/apps/frontpage/package.json @@ -38,8 +38,6 @@ "class-variance-authority": "^0.7.0", "cookies-next": "^4.1.1", "copy-to-clipboard": "^3.3.3", - "date-fns": "^2.0.0", - "date-fns-tz": "^2.0.0", "dedent": "^1.5.3", "framer-motion": "^11.3.2", "fs-extra": "^11.2.0", diff --git a/package-lock.json b/package-lock.json index 16f01de6..9b1dd122 100644 --- a/package-lock.json +++ b/package-lock.json @@ -88,8 +88,6 @@ "class-variance-authority": "^0.7.0", "cookies-next": "^4.1.1", "copy-to-clipboard": "^3.3.3", - "date-fns": "^2.0.0", - "date-fns-tz": "^2.0.0", "dedent": "^1.5.3", "framer-motion": "^11.3.2", "fs-extra": "^11.2.0", @@ -10437,29 +10435,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/date-fns": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", - "dependencies": { - "@babel/runtime": "^7.21.0" - }, - "engines": { - "node": ">=0.11" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/date-fns" - } - }, - "node_modules/date-fns-tz": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-2.0.1.tgz", - "integrity": "sha512-fJCG3Pwx8HUoLhkepdsP7Z5RsucUi+ZBOxyM5d0ZZ6c4SdYustq0VMmOu6Wf7bli+yS/Jwp91TOCqn9jMcVrUA==", - "peerDependencies": { - "date-fns": "2.x" - } - }, "node_modules/debounce": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",