feat: modify Course Block text style and time and location text (#409)

This commit is contained in:
Tony Dinh
2024-11-15 13:43:41 -06:00
committed by GitHub
parent 91fa78e2d0
commit 0d51cae4c8
6 changed files with 19 additions and 16 deletions

View File

@@ -101,7 +101,7 @@ export default function CalendarCourseCell({
{courseDeptAndInstr}
</Text>
{timeAndLocation && (
<Text variant='h3-course' as='p'>
<Text variant='h3-course' as='p' className='whitespace-pre-line'>
{timeAndLocation}
</Text>
)}

View File

@@ -34,7 +34,7 @@
font-size: 0.6875rem;
font-weight: 400;
letter-spacing: 0;
line-height: 100%; /* 0.6875rem */
line-height: 0.775rem;
}
.h3 {
@@ -58,7 +58,7 @@
}
.h1-course {
font-size: 1rem;
font-size: 0.9375rem;
font-weight: 550;
text-transform: capitalize;
letter-spacing: 0;

View File

@@ -168,7 +168,7 @@ export default function HeadingAndActions({ course, activeSchedule, onClose }: H
<div className='mt-1 flex flex-col'>
{schedule.meetings.map(meeting => {
const daysString = meeting.getDaysString({ format: 'long', separator: 'long' });
const timeString = meeting.getTimeString({ separator: ' to ', capitalize: false });
const timeString = meeting.getTimeString({ separator: ' to ' });
return (
<Text
key={

View File

@@ -147,10 +147,19 @@ function processInPersonMeetings(
const { days, startTime, endTime, location } = meeting;
const midnightIndex = 1440;
const normalizingTimeFactor = 720;
const time = meeting.getTimeString({ separator: '-', capitalize: true });
const timeAndLocation = `${time}${location ? ` - ${location.building}` : ''}`;
const oneHour = 60;
const time = meeting.getTimeString({ separator: '' });
const normalizedStartTime = startTime >= midnightIndex ? startTime - normalizingTimeFactor : startTime;
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 => ({
calendarGridPoint: {