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

feat: add open calendar button #457

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
20 changes: 16 additions & 4 deletions src/views/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import useSchedules from '@views/hooks/useSchedules';
// import { CourseCatalogScraper } from '@views/lib/CourseCatalogScraper';
// import getCourseTableRows from '@views/lib/getCourseTableRows';
import { GitHubStatsService, LONGHORN_DEVELOPERS_ADMINS, LONGHORN_DEVELOPERS_SWE } from '@views/lib/getGitHubStats';
import { openTabFromContentScript } from '@views/lib/openNewTabFromContentScript';
// import { SiteSupport } from '@views/lib/getSiteSupport';
import clsx from 'clsx';
import React, { useCallback, useEffect, useState } from 'react';

import IconoirGitFork from '~icons/iconoir/git-fork';
import CalendarIcon from '~icons/material-symbols/calendar-month';
// import { ExampleCourse } from 'src/stories/components/ConflictsWithWarning.stories';
import DeleteForeverIcon from '~icons/material-symbols/delete-forever';

Expand All @@ -39,11 +41,19 @@ const DISPLAY_PREVIEWS = false;
const PREVIEW_SECTION_DIV_CLASSNAME = DISPLAY_PREVIEWS ? 'w-1/2 space-y-4' : 'flex-grow space-y-4';

const manifest = chrome.runtime.getManifest();
const LDIconURL = new URL('/src/assets/LD-icon.png', import.meta.url).href;

const gitHubStatsService = new GitHubStatsService();
const includeMergedPRs = false;

/**
* Opens the calendar page in a new tab.
* @returns A promise that resolves when the options page is opened.
*/
const handleOpenCalendar = async (): Promise<void> => {
const url = chrome.runtime.getURL('/calendar.html');
await openTabFromContentScript(url);
};

Comment on lines +50 to +58
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing as this is a useful global util, we're planning on moving it somewhere else.

/**
* Custom hook for enabling developer mode.
*
Expand Down Expand Up @@ -256,8 +266,8 @@ export default function Settings(): JSX.Element {
<header className='flex items-center gap-5 overflow-x-auto overflow-y-hidden border-b border-ut-offwhite px-7 py-4 md:overflow-x-hidden'>
<LargeLogo />
<Divider className='mx-2 self-center md:mx-4' size='2.5rem' orientation='vertical' />
<Text variant='h1' className='flex-1 text-ut-burntorange'>
UTRP SETTINGS & CREDITS PAGE
<Text variant='h1' className='flex-1 text-ut-burntorange normal-case!'>
Settings and Credits
</Text>
<div className='hidden flex-row items-center justify-end gap-6 screenshot:hidden lg:flex'>
<Button variant='single' color='theme-black' onClick={handleChangelogOnClick}>
Expand All @@ -266,7 +276,9 @@ export default function Settings(): JSX.Element {
v{manifest.version} - {process.env.NODE_ENV}
</Text>
</Button>
<img src={LDIconURL} alt='LD Icon' className='h-10 w-10 rounded-lg' />
<Button variant='filled' icon={CalendarIcon} color='ut-burntorange' onClick={handleOpenCalendar}>
Calendar
</Button>
</div>
</header>

Expand Down
Loading