-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: course-catalog-injected-popup (#98)
* some work * some work on course popup update the stories and create the header component * use chip component in header * complete CourseHeaderAndActions Component added course buttons, using proper subcomponents now. * Change test course to 314 * Add rmp callback * some unocss updates * add course button onclick handlers * add todo for calendar button * Rename CoursePopup Old one to "Old", remove "2" from new one * description stuff done * Modify story to use proper course info * Add Grade Distribution Stuff * Minor tweaks change style in header * Add TODO replace current grade colors with a tailwind palette * Fix syllabi url Remove unused variable and unnecessary args to url * Bunch of renaming * Kinda complete the handlers * change grade distribution colors to match updated figma * change from reducer pattern to state variables, remove chartData from state * add additional story * disabled add when course is not open * use array fill * Some changes with the instructor names * trying to get the CES stuff to work * CES button is working * remove a todo * add actual color for dminus * fix description, start no distribution state * post merge fixes * small fixes * fix: import as type * fix: some better typescript stuff i think * fix: manifest.ts * fix: pr feedback * Apply suggestions from code review --------- Co-authored-by: doprz <[email protected]>
- Loading branch information
1 parent
0c5bec8
commit 89d03f4
Showing
11 changed files
with
284 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import openNewTab from '@background/util/openNewTab'; | ||
import type CESMessage from '@shared/messages/CESMessage'; | ||
import type { MessageHandler } from 'chrome-extension-toolkit'; | ||
|
||
const CESFall2023Url = 'https://utexas.bluera.com/utexas/rpvl.aspx?rid=d3db767b-049f-46c5-9a67-29c21c29c580®l=en-US'; | ||
|
||
const CESHandler: MessageHandler<CESMessage> = { | ||
openCESPage({ data, sendResponse }) { | ||
const { instructorFirstName, instructorLastName } = data; | ||
openNewTab(CESFall2023Url).then(tab => { | ||
const instructorFirstAndLastName = [instructorFirstName, instructorLastName]; | ||
chrome.scripting.executeScript({ | ||
target: { tabId: tab.id }, | ||
func: (...instructorFirstAndLastName: String[]) => { | ||
const inputElement = document.getElementById( | ||
'ctl00_ContentPlaceHolder1_ViewList_tbxValue' | ||
) as HTMLInputElement | null; | ||
const [instructorFirstName, instructorLastName] = instructorFirstAndLastName; | ||
if (inputElement) { | ||
inputElement.value = `${instructorFirstName} ${instructorLastName}`; | ||
inputElement.focus(); | ||
const enterKeyEvent = new KeyboardEvent('keydown', { | ||
key: 'Enter', | ||
code: 'Enter', | ||
keyCode: 13, | ||
which: 13, | ||
bubbles: true, | ||
}); | ||
inputElement.dispatchEvent(enterKeyEvent); | ||
} | ||
}, | ||
args: instructorFirstAndLastName, | ||
}); | ||
sendResponse(tab); | ||
}); | ||
}, | ||
}; | ||
|
||
export default CESHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
interface CESMessage { | ||
/** | ||
* Opens the CES page for the specified instructor | ||
* | ||
* @param data first and last name of the instructor | ||
*/ | ||
openCESPage: (data: { instructorFirstName: string; instructorLastName: string }) => chrome.tabs.Tab; | ||
} | ||
|
||
export default CESMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 67 additions & 18 deletions
85
src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.