From ed4fbe56519f79decd907d9cb775256575f9faf8 Mon Sep 17 00:00:00 2001 From: Razboy20 Date: Fri, 15 Mar 2024 23:49:26 -0500 Subject: [PATCH] refactor: ccpopup (#172) * refactor: dialog animation improvements * refactor: update ccpopup to match designs --- src/views/components/common/Chip/Chip.tsx | 2 +- src/views/components/common/Dialog/Dialog.tsx | 18 +++--- .../components/common/Text/Text.module.scss | 4 +- .../CourseCatalogInjectedPopup.tsx | 8 ++- .../Description.tsx | 24 ++++---- .../GradeDistribution.tsx | 4 +- .../HeadingAndActions.tsx | 59 +++++++++++++------ 7 files changed, 70 insertions(+), 49 deletions(-) diff --git a/src/views/components/common/Chip/Chip.tsx b/src/views/components/common/Chip/Chip.tsx index f21e20c3..1357250c 100644 --- a/src/views/components/common/Chip/Chip.tsx +++ b/src/views/components/common/Chip/Chip.tsx @@ -27,7 +27,7 @@ export function Chip({ label }: React.PropsWithChildren): JSX.Element { ): JSX.Eleme -
+
diff --git a/src/views/components/common/Text/Text.module.scss b/src/views/components/common/Text/Text.module.scss index 7b0aab64..7fd48d68 100644 --- a/src/views/components/common/Text/Text.module.scss +++ b/src/views/components/common/Text/Text.module.scss @@ -19,7 +19,7 @@ .p { font-size: 1rem; font-weight: 400; - letter-spacing: 0.025rem; + letter-spacing: 0.02em; } .h4 { @@ -42,7 +42,7 @@ .h2-course { font-size: 1rem; font-weight: 500; - letter-spacing: 0.03125rem; + letter-spacing: 0.03125em; text-transform: capitalize; } diff --git a/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx index ed7416af..d053d723 100644 --- a/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup.tsx @@ -27,11 +27,13 @@ function CourseCatalogInjectedPopup({ course, ...rest }: CourseCatalogInjectedPo const [activeSchedule] = useSchedules(); return ( - +
void} activeSchedule={activeSchedule} /> - - +
+ + +
); } diff --git a/src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx index 2443c616..422bc858 100644 --- a/src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/Description.tsx @@ -56,26 +56,24 @@ export default function Description({ course }: DescriptionProps): JSX.Element { return ( <> {status === LoadStatus.ERROR && ( - Please refresh the page and log back in using your UT EID and password + Please refresh the page and log back in using your UT EID and password. )} {/* TODO (achadaga): would be nice to have a new spinner here */} {status === LoadStatus.LOADING && } {status === LoadStatus.DONE && ( -
    +
      {description.map(line => { const isKeywordPresent = keywords.some(keyword => line.toLowerCase().includes(keyword)); return ( -
      - -
    • - - {line} - -
    • -
      +
    • + {line} +
    • ); })}
    diff --git a/src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx index 7a27bb13..4a52d1a8 100644 --- a/src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/GradeDistribution.tsx @@ -97,13 +97,13 @@ export default function GradeDistribution({ course }: GradeDistributionProps): J subtitle: { text: undefined }, legend: { enabled: false }, xAxis: { - title: { text: 'Grade' }, + title: { text: 'Grades' }, categories: ['A', 'A-', 'B+', 'B', 'B-', 'C+', 'C', 'C-', 'D+', 'D', 'D-', 'F'], crosshair: true, }, yAxis: { min: 0, - title: { text: 'Number of Students' }, + title: { text: 'Students' }, }, chart: { style: { fontFamily: 'Roboto Flex, Roboto Flex Local', fontWeight: '600' }, diff --git a/src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx b/src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx index e3a30de8..45d24b2d 100644 --- a/src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx +++ b/src/views/components/injected/CourseCatalogInjectedPopup/HeadingAndActions.tsx @@ -1,11 +1,11 @@ import { background } from '@shared/messages'; import type { Course } from '@shared/types/Course'; -import { Status } from '@shared/types/Course'; import type Instructor from '@shared/types/Instructor'; import type { UserSchedule } from '@shared/types/UserSchedule'; import { Button } from '@views/components/common/Button/Button'; import { Chip, flagMap } from '@views/components/common/Chip/Chip'; import Divider from '@views/components/common/Divider/Divider'; +import Link from '@views/components/common/Link/Link'; import Text from '@views/components/common/Text/Text'; import React from 'react'; @@ -66,7 +66,8 @@ export default function HeadingAndActions({ course, activeSchedule, onClose }: H return `${capitalizeString(firstName)} ${capitalizeString(lastName)}`; }; - const instructorString = instructors.map(getInstructorFullName).join(', '); + const getBuildingUrl = (building: string) => + `https://utdirect.utexas.edu/apps/campus/buildings/nlogon/maps/UTM/${building}`; const handleCopy = () => { navigator.clipboard.writeText(formattedUniqueId); @@ -108,50 +109,71 @@ export default function HeadingAndActions({ course, activeSchedule, onClose }: H }; return ( -
    +
    - + {courseName} - - {' '} + ({department} {courseNumber}) -
    -
    - {instructorString.length > 0 && ( - - with {instructorString} +
    + {instructors.length > 0 && ( + + with{' '} + {instructors + .map(instructor => ( + + {getInstructorFullName(instructor)} + + )) + .flatMap((el, i) => (i === 0 ? [el] : [', ', el]))} )} -
    +
    {flags.map(flag => ( ))}
    -
    +
    {schedule.meetings.map(meeting => { const daysString = meeting.getDaysString({ format: 'long', separator: 'long' }); const timeString = meeting.getTimeString({ separator: ' to ', capitalize: false }); - const locationString = meeting.location ? ` in ${meeting.location.building}` : ''; return ( - + {daysString} {timeString} - {locationString} + {meeting.location && ( + <> + {' in '} + + {meeting.location.building} + + + )} ); })}
    -
    +