diff --git a/src/shared/types/Instructor.ts b/src/shared/types/Instructor.ts
index eb5ffd2f..d9a00dca 100644
--- a/src/shared/types/Instructor.ts
+++ b/src/shared/types/Instructor.ts
@@ -16,25 +16,6 @@ export default class Instructor {
});
}
- /**
- * Get the URL to the instructor's directory page on the UT Directory website
- *
- * @returns A URL string to the instructor's directory page
- */
- getDirectoryUrl(): string {
- const name = this.toString({
- format: 'full_name',
- case: 'capitalize',
- });
-
- const url = new URL('https://directory.utexas.edu/index.php');
- url.searchParams.set('q', name);
- url.searchParams.set('scope', 'faculty/staff');
- url.searchParams.set('submit', 'Search');
-
- return url.toString();
- }
-
/**
* Get a string representation of the instructor
*
@@ -43,32 +24,36 @@ export default class Instructor {
*/
toString(options: InstructorFormatOptions): string {
const { firstName, lastName, fullName } = this;
- const { format, case: caseType } = options;
+ const { format } = options;
- const process = (str: string) => {
- if (caseType === 'lowercase') {
- return str.toLowerCase();
- }
- if (caseType === 'uppercase') {
- return str.toUpperCase();
- }
- return capitalize(str);
- };
+ switch (format) {
+ case 'first_last':
+ if (firstName && lastName) {
+ return `${capitalize(firstName)} ${capitalize(lastName)}`;
+ }
- if (format === 'abbr' && firstName && lastName && firstName[0]) {
- return `${process(firstName[0])}. ${process(lastName)}`;
- }
- if (format === 'full_name' && fullName) {
- return process(fullName);
- }
- if (format === 'first_last' && firstName && lastName) {
- return `${process(firstName)} ${process(lastName)}`;
- }
- if (format === 'last' && lastName) {
- return process(lastName);
- }
+ if (lastName) {
+ return capitalize(lastName);
+ }
- throw new Error(`Invalid Instructor String format: ${format}`);
+ if (fullName) {
+ return fullName;
+ }
+
+ return '';
+ case 'last':
+ if (lastName) {
+ return capitalize(lastName);
+ }
+
+ if (fullName) {
+ return fullName;
+ }
+
+ return '';
+ default:
+ throw new Error(`Invalid Instructor String format: ${format}`);
+ }
}
}
@@ -77,9 +62,5 @@ export default class Instructor {
*/
type InstructorFormatOptions = {
/** How do you want the names of the professors formatted */
- format: 'abbr' | 'first_last' | 'last' | 'full_name';
- /**
- * What the case of the string should be
- */
- case: 'capitalize' | 'lowercase' | 'uppercase';
+ format: 'first_last' | 'last';
};
diff --git a/src/views/components/common/PopupCourseBlock.tsx b/src/views/components/common/PopupCourseBlock.tsx
index 5011c235..852682be 100644
--- a/src/views/components/common/PopupCourseBlock.tsx
+++ b/src/views/components/common/PopupCourseBlock.tsx
@@ -84,7 +84,7 @@ export default function PopupCourseBlock({