From 643ea1320798aabb7783d267f5e6fd7c00fc2e3f Mon Sep 17 00:00:00 2001 From: Tony Dinh <88163609+tonydnh@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:17:12 -0500 Subject: [PATCH] feat: add more relevant links to the From the Team section (#380) * feat: add more relevant links to the From the Team section * feat: add CRXPages.ts * chore: update to TS 4.9 satisfies --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com> --- src/shared/types/CRXPages.ts | 15 ++++++++ src/views/components/calendar/TeamLinks.tsx | 38 +++++++++++++++------ 2 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 src/shared/types/CRXPages.ts diff --git a/src/shared/types/CRXPages.ts b/src/shared/types/CRXPages.ts new file mode 100644 index 000000000..a52ad899c --- /dev/null +++ b/src/shared/types/CRXPages.ts @@ -0,0 +1,15 @@ +/** + * An object containing the paths to various pages used in the CRX application. + */ +export const CRX_PAGES = { + DEBUG: '/debug.html', + CALENDAR: '/calendar.html', + OPTIONS: '/options.html', + REPORT: '/report.html', +} as const; + +/** + * Represents a type that corresponds to the keys of the `CRX_PAGES` object. + * This type is used to ensure that only valid page keys are used within the application. + */ +export type CRX_Page = keyof typeof CRX_PAGES; diff --git a/src/views/components/calendar/TeamLinks.tsx b/src/views/components/calendar/TeamLinks.tsx index fb696961d..8edcbd405 100644 --- a/src/views/components/calendar/TeamLinks.tsx +++ b/src/views/components/calendar/TeamLinks.tsx @@ -1,3 +1,5 @@ +import { CRX_PAGES } from '@shared/types/CRXPages'; +import { openReportWindow } from '@shared/util/openReportWindow'; import Text from '@views/components/common/Text/Text'; import clsx from 'clsx'; import React from 'react'; @@ -13,26 +15,41 @@ interface LinkItem { url: string; } -const links: LinkItem[] = [ - // { - // text: 'Feedback Form', - // url: '#', - // }, - // { - // text: 'Apply to Longhorn Developers', - // url: '#', - // }, +const links = [ + { + text: 'Rate us on Chrome Web Store', + url: 'https://chromewebstore.google.com/detail/ut-registration-plus/hboadpjkoaieogjimneceaahlppnipaa', + }, + { + text: 'Send us Feedback & Ideas', + url: CRX_PAGES.REPORT, + }, { text: 'Become a Beta Tester', url: 'https://forms.gle/Y9dmQAb1yzW5PRg48', }, -]; + { + text: 'Credits – Meet the team', + url: CRX_PAGES.OPTIONS, + }, + { + text: 'Apply to Longhorn Developers', + url: 'https://forms.gle/cdkLKmFwPmvHmiBe9', + }, +] as const satisfies LinkItem[]; /** * The "From The Team" section of the calendar website * @returns */ export default function TeamLinks({ className }: Props): JSX.Element { + const handleClick = (link: LinkItem, event: React.MouseEvent) => { + if (link.url === CRX_PAGES.REPORT) { + event.preventDefault(); + openReportWindow(); + } + }; + return (
From the Team @@ -43,6 +60,7 @@ export default function TeamLinks({ className }: Props): JSX.Element { className='flex items-center gap-0.5 text-ut-burntorange underline-offset-2 hover:underline' target='_blank' rel='noreferrer' + onClick={event => handleClick(link, event)} > {link.text}