generating calendar html

This commit is contained in:
Sriram Hariharan
2023-09-17 15:20:42 -05:00
parent e199a0b766
commit 1fac71dbd1
6 changed files with 26 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ import getSiteSupport, { SiteSupport } from './lib/getSiteSupport';
import PopupMain from './components/PopupMain';
const support = getSiteSupport(window.location.href);
if (!support) {
throw new Error('UT Registration Plus does not support this page, even though it should...');
}
@@ -15,6 +16,10 @@ if (support === SiteSupport.EXTENSION_POPUP) {
render(<PopupMain />, document.getElementById('root'));
}
if (support === SiteSupport.MY_CALENDAR) {
render(<div>My Calendar</div>, document.getElementById('root'));
}
if (support === SiteSupport.COURSE_CATALOG_DETAILS || support === SiteSupport.COURSE_CATALOG_LIST) {
const shadowDom = createShadowDOM('ut-registration-plus-container');
render(<CourseCatalogMain support={support} />, shadowDom.shadowRoot);

View File

@@ -1,4 +1,4 @@
import { isExtensionPopup } from 'chrome-extension-toolkit';
import { isExtensionPage, isExtensionPopup } from 'chrome-extension-toolkit';
/**
* An enum that represents the different types of pages that we support
@@ -10,6 +10,7 @@ export enum SiteSupport {
UT_PLANNER = 'UT_PLANNER',
WAITLIST = 'WAITLIST',
EXTENSION_POPUP = 'EXTENSION_POPUP',
MY_CALENDAR = 'MY_CALENDAR',
}
/**
@@ -21,6 +22,9 @@ export default function getSiteSupport(url: string): SiteSupport | null {
if (isExtensionPopup()) {
return SiteSupport.EXTENSION_POPUP;
}
if (isExtensionPage('MyCalendar.html')) {
return SiteSupport.MY_CALENDAR;
}
if (url.includes('utexas.collegescheduler.com')) {
return SiteSupport.UT_PLANNER;
}