added onclose to popup, coursepopup now displaying time info, renamed vars, added compiler for scss to typescript and tsconfig plugins
This commit is contained in:
@@ -17,11 +17,11 @@ export const DAY_MAP = {
|
||||
export type Day = typeof DAY_MAP[keyof typeof DAY_MAP];
|
||||
|
||||
/** A physical room that a class is taught in */
|
||||
export type Room = {
|
||||
export type Location = {
|
||||
/** The UT building code for where the class is taught */
|
||||
building: string;
|
||||
/** The room number for where the class is taught */
|
||||
number: string;
|
||||
room: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ export class CourseMeeting {
|
||||
/** The end time of the course, in minutes since midnight */
|
||||
endTime: number;
|
||||
/** The location that the course is taught */
|
||||
room?: Room;
|
||||
location?: Location;
|
||||
|
||||
constructor(meeting: Serialized<CourseMeeting>) {
|
||||
Object.assign(this, meeting);
|
||||
@@ -124,5 +124,16 @@ type TimeStringOptions = {
|
||||
type DaysStringOptions = {
|
||||
/** The format of the days string, short = MWF, long = Monday, Wednesday, Friday */
|
||||
format: 'short' | 'long';
|
||||
/**
|
||||
* The separator between the days
|
||||
*
|
||||
* 'none' = `MWF`
|
||||
*
|
||||
* 'conjunction' = `Monday, Wednesday, and Friday`
|
||||
*
|
||||
* 'disjunction' = `Monday, Wednesday, or Friday`
|
||||
*
|
||||
* 'narrow' = `Monday Wednesday Friday`
|
||||
*/
|
||||
separator: Intl.ListFormatStyle | 'none';
|
||||
};
|
||||
|
||||
@@ -18,10 +18,10 @@ export class CourseSchedule {
|
||||
* Given a string representation of the meeting information for a class, parse it into a CourseMeeting object
|
||||
* @param dayLine a string representation of the days of the week that the course is taught: MWF, TR, etc.
|
||||
* @param timeLine a string representation of a time-range that the course is taught: 10:00 am - 11:00 am, 1:00 pm - 2:00 pm, etc.
|
||||
* @param roomLine a string representation of the room that the course is taught in: JGB 2.302, etc.
|
||||
* @param locLine a string representation of the location that the course is taught in: JGB 2.302, etc.
|
||||
* @returns CourseMeeting object representing the meeting information
|
||||
*/
|
||||
static parse(dayLine: string, timeLine: string, roomLine: string): CourseMeeting {
|
||||
static parse(dayLine: string, timeLine: string, locLine: string): CourseMeeting {
|
||||
try {
|
||||
let days: Day[] = dayLine
|
||||
.split('')
|
||||
@@ -51,19 +51,19 @@ export class CourseSchedule {
|
||||
return Number(hour) * 60 + Number(minute);
|
||||
});
|
||||
|
||||
const [building, number] = roomLine.split(' ');
|
||||
const [building, room] = locLine.split(' ');
|
||||
|
||||
return new CourseMeeting({
|
||||
days,
|
||||
startTime,
|
||||
endTime,
|
||||
room: {
|
||||
location: {
|
||||
building,
|
||||
number,
|
||||
room,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error(`Failed to parse schedule: ${dayLine} ${timeLine} ${roomLine}`);
|
||||
throw new Error(`Failed to parse schedule: ${dayLine} ${timeLine} ${locLine}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user