feat: modify Course Block text style and time and location text (#409)
This commit is contained in:
@@ -108,7 +108,7 @@ export class CourseMeeting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startTimeString += startMinute === 0 ? ':00' : `:${startMinute}`;
|
startTimeString += startMinute === 0 ? ':00' : `:${startMinute}`;
|
||||||
startTimeString += startHour >= 12 ? ' p.m.' : ' a.m.';
|
startTimeString += startHour >= 12 ? 'pm' : 'am';
|
||||||
|
|
||||||
if (endHour === 0) {
|
if (endHour === 0) {
|
||||||
endTimeString = '12';
|
endTimeString = '12';
|
||||||
@@ -117,13 +117,9 @@ export class CourseMeeting {
|
|||||||
} else {
|
} else {
|
||||||
endTimeString = `${endHour}`;
|
endTimeString = `${endHour}`;
|
||||||
}
|
}
|
||||||
endTimeString += endMinute === 0 ? ':00' : `:${endMinute}`;
|
|
||||||
endTimeString += endHour >= 12 ? ' p.m.' : ' a.m.';
|
|
||||||
|
|
||||||
if (options.capitalize) {
|
endTimeString += endMinute === 0 ? ':00' : `:${endMinute}`;
|
||||||
startTimeString = startTimeString.toUpperCase();
|
endTimeString += endHour >= 12 ? 'pm' : 'am';
|
||||||
endTimeString = endTimeString.toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${startTimeString} ${options.separator} ${endTimeString}`;
|
return `${startTimeString} ${options.separator} ${endTimeString}`;
|
||||||
}
|
}
|
||||||
@@ -135,8 +131,6 @@ export class CourseMeeting {
|
|||||||
type TimeStringOptions = {
|
type TimeStringOptions = {
|
||||||
/** the separator between the start and end times */
|
/** the separator between the start and end times */
|
||||||
separator: string;
|
separator: string;
|
||||||
/** capitalizes the AM/PM */
|
|
||||||
capitalize?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const meta = {
|
|||||||
courseDeptAndInstr: ExampleCourse.department,
|
courseDeptAndInstr: ExampleCourse.department,
|
||||||
className: ExampleCourse.number,
|
className: ExampleCourse.number,
|
||||||
status: ExampleCourse.status,
|
status: ExampleCourse.status,
|
||||||
timeAndLocation: ExampleCourse.schedule.meetings[0]!.getTimeString({ separator: '-' }),
|
timeAndLocation: ExampleCourse.schedule.meetings[0]!.getTimeString({ separator: '–' }),
|
||||||
|
|
||||||
colors: getCourseColors('emerald', 500),
|
colors: getCourseColors('emerald', 500),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export default function CalendarCourseCell({
|
|||||||
{courseDeptAndInstr}
|
{courseDeptAndInstr}
|
||||||
</Text>
|
</Text>
|
||||||
{timeAndLocation && (
|
{timeAndLocation && (
|
||||||
<Text variant='h3-course' as='p'>
|
<Text variant='h3-course' as='p' className='whitespace-pre-line'>
|
||||||
{timeAndLocation}
|
{timeAndLocation}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
font-size: 0.6875rem;
|
font-size: 0.6875rem;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
letter-spacing: 0;
|
letter-spacing: 0;
|
||||||
line-height: 100%; /* 0.6875rem */
|
line-height: 0.775rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.h3 {
|
.h3 {
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.h1-course {
|
.h1-course {
|
||||||
font-size: 1rem;
|
font-size: 0.9375rem;
|
||||||
font-weight: 550;
|
font-weight: 550;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
letter-spacing: 0;
|
letter-spacing: 0;
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ export default function HeadingAndActions({ course, activeSchedule, onClose }: H
|
|||||||
<div className='mt-1 flex flex-col'>
|
<div className='mt-1 flex flex-col'>
|
||||||
{schedule.meetings.map(meeting => {
|
{schedule.meetings.map(meeting => {
|
||||||
const daysString = meeting.getDaysString({ format: 'long', separator: 'long' });
|
const daysString = meeting.getDaysString({ format: 'long', separator: 'long' });
|
||||||
const timeString = meeting.getTimeString({ separator: ' to ', capitalize: false });
|
const timeString = meeting.getTimeString({ separator: ' to ' });
|
||||||
return (
|
return (
|
||||||
<Text
|
<Text
|
||||||
key={
|
key={
|
||||||
|
|||||||
@@ -147,10 +147,19 @@ function processInPersonMeetings(
|
|||||||
const { days, startTime, endTime, location } = meeting;
|
const { days, startTime, endTime, location } = meeting;
|
||||||
const midnightIndex = 1440;
|
const midnightIndex = 1440;
|
||||||
const normalizingTimeFactor = 720;
|
const normalizingTimeFactor = 720;
|
||||||
const time = meeting.getTimeString({ separator: '-', capitalize: true });
|
const oneHour = 60;
|
||||||
const timeAndLocation = `${time}${location ? ` - ${location.building}` : ''}`;
|
const time = meeting.getTimeString({ separator: '–' });
|
||||||
const normalizedStartTime = startTime >= midnightIndex ? startTime - normalizingTimeFactor : startTime;
|
const normalizedStartTime = startTime >= midnightIndex ? startTime - normalizingTimeFactor : startTime;
|
||||||
const normalizedEndTime = endTime >= midnightIndex ? endTime - normalizingTimeFactor : endTime;
|
const normalizedEndTime = endTime >= midnightIndex ? endTime - normalizingTimeFactor : endTime;
|
||||||
|
const courseDuration = normalizedEndTime - normalizedStartTime;
|
||||||
|
let timeAndLocation = `${time}`;
|
||||||
|
if (location) {
|
||||||
|
if (courseDuration > oneHour) {
|
||||||
|
timeAndLocation += `\n${location.building} ${location.room}`;
|
||||||
|
} else {
|
||||||
|
timeAndLocation += `, ${location.building} ${location.room}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return days.map(day => ({
|
return days.map(day => ({
|
||||||
calendarGridPoint: {
|
calendarGridPoint: {
|
||||||
|
|||||||
Reference in New Issue
Block a user