Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): calendar sidebar redesign #464

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
705ee07
Merge pull request #1 from Longhorn-Developers/main
EthanL06 Oct 21, 2024
e0aff38
Merge branch 'Longhorn-Developers:main' into main
EthanL06 Oct 23, 2024
da127d1
feat: update calendar sidebar, footer, and header with Figma design
EthanL06 Dec 23, 2024
b83207c
chore: run lint
EthanL06 Dec 23, 2024
5754c1c
Merge pull request #4 from Longhorn-Developers/main
EthanL06 Dec 23, 2024
eae6253
Merge remote-tracking branch 'origin/main' into feature/sidebar-redesign
EthanL06 Dec 23, 2024
5e4c38a
feat: update header with Figma design
EthanL06 Dec 23, 2024
2f30ce2
chore: run lint
EthanL06 Dec 23, 2024
aca0594
chore: remove unused vars
EthanL06 Dec 23, 2024
c87643f
chore: fix types
EthanL06 Dec 23, 2024
c5aab8a
fix: adjust sidebar minimum width
EthanL06 Dec 26, 2024
c437aaf
fix: update LogoIcon layout to ensure text is always displayed
EthanL06 Dec 26, 2024
d34ab80
feat: add spacing constants
EthanL06 Dec 28, 2024
83479b9
fix: add sidebar styling with spacing system and sticky header
EthanL06 Dec 28, 2024
0753f0a
fix: update spacing constants to use rem units
EthanL06 Dec 28, 2024
96f86d2
refactor: replace padding with spacing system and colors with UTRP theme
EthanL06 Dec 28, 2024
ab3eb50
refactor: rename ImportantLinks to ResourceLinks
EthanL06 Dec 28, 2024
9f8e331
refactor: simplify CalendarHeader button component by using icon prop
EthanL06 Dec 28, 2024
a039ea9
feat: add sidebar open and close transition
EthanL06 Dec 28, 2024
4027ece
refactor: rename unused var
EthanL06 Dec 28, 2024
68990ec
Merge branch 'main' into feature/sidebar-redesign
EthanL06 Dec 28, 2024
859c2b2
fix: update social icon color
EthanL06 Dec 31, 2024
fcc3581
feat: improve layout and spacing in calendar components
EthanL06 Jan 3, 2025
59a4993
Merge branch 'feature/sidebar-redesign' of https://github.com/EthanL0…
EthanL06 Jan 3, 2025
46fa071
refactor: remove unused GearSix icon and options handler
EthanL06 Jan 3, 2025
9bd0ec8
feat: update calendar components with new icons and improved spacing
EthanL06 Jan 3, 2025
a4ad6f7
fix: correct class name
EthanL06 Jan 3, 2025
4ca3025
refactor: organize social links into array and update link styling
EthanL06 Jan 3, 2025
7ed1ea3
refactor: remove unused import
EthanL06 Jan 3, 2025
f1804ab
fix: adjust gap spacing in radio button
EthanL06 Jan 8, 2025
af8a0b8
fix: update divider component to use theme offwhite1
EthanL06 Jan 8, 2025
f89cd43
fix: increase size of outward arrow icon
EthanL06 Jan 8, 2025
3f6332d
feat: add getSpacingInPx function to convert rem to pixels
EthanL06 Jan 8, 2025
11f5d08
fix: update gap spacing in CalendarSchedules component to use spacing…
EthanL06 Jan 8, 2025
d5dbf38
fix: rollback footer social icons to original icons
EthanL06 Jan 8, 2025
12c396b
fix: update Calendar styles to use theme offwhite1 and adjust padding…
EthanL06 Jan 8, 2025
01cf99a
fix: update LargeLogo component to use gap-spacing-3
EthanL06 Jan 8, 2025
f24e72a
Merge branch 'main' into feature/sidebar-redesign
EthanL06 Jan 8, 2025
6894a58
fix: update button variants to 'minimal' and adjust styles for consis…
EthanL06 Jan 8, 2025
1b00026
fix: adjust padding in Calendar component for better layout consistency
EthanL06 Jan 8, 2025
1592d4f
Merge branch 'main' into feature/sidebar-redesign
EthanL06 Jan 8, 2025
75fd48d
fix: increase size of arrow icon
EthanL06 Jan 8, 2025
b2f1bbd
fix: add shrink-0 to radio buttons
EthanL06 Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/shared/types/Spacing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* An object representing various spacing values used throughout the application.
* Each key corresponds to a specific spacing size based on the 4px grid system.
*/
export const spacing = {
spacing0: '.125rem',
spacing1: '.25rem',
spacing2: '.5rem',
spacing3: '.75rem',
spacing4: '1rem',
spacing5: '1.25rem',
spacing6: '1.5rem',
spacing7: '2rem',
} as const;
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { Meta, StoryObj } from '@storybook/react';
import ImportantLinks from '@views/components/calendar/ImportantLinks';
import ResourceLinks from '@views/components/calendar/ResourceLinks';

const meta = {
title: 'Components/Common/ImportantLinks',
component: ImportantLinks,
title: 'Components/Common/ResourceLinks',
component: ResourceLinks,
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
argTypes: {},
} satisfies Meta<typeof ImportantLinks>;
} satisfies Meta<typeof ResourceLinks>;
export default meta;

type Story = StoryObj<typeof meta>;
Expand Down
85 changes: 65 additions & 20 deletions src/views/components/calendar/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import type { CalendarTabMessages } from '@shared/messages/CalendarMessages';
import type { Course } from '@shared/types/Course';
import { CRX_PAGES } from '@shared/types/CRXPages';
import { openReportWindow } from '@shared/util/openReportWindow';
import CalendarBottomBar from '@views/components/calendar/CalendarBottomBar';
import CalendarGrid from '@views/components/calendar/CalendarGrid';
import CalendarHeader from '@views/components/calendar/CalendarHeader';
import { CalendarSchedules } from '@views/components/calendar/CalendarSchedules';
import ImportantLinks from '@views/components/calendar/ImportantLinks';
import ResourceLinks from '@views/components/calendar/ResourceLinks';
import Divider from '@views/components/common/Divider';
import CourseCatalogInjectedPopup from '@views/components/injected/CourseCatalogInjectedPopup/CourseCatalogInjectedPopup';
import { CalendarContext } from '@views/contexts/CalendarContext';
import useCourseFromUrl from '@views/hooks/useCourseFromUrl';
import { useFlattenedCourseSchedule } from '@views/hooks/useFlattenedCourseSchedule';
import { MessageListener } from 'chrome-extension-toolkit';
import clsx from 'clsx';
import React, { useEffect, useState } from 'react';

import CalendarFooter from './CalendarFooter';
import TeamLinks from './TeamLinks';
import OutwardArrowIcon from '~icons/material-symbols/arrow-outward';
import MenuIcon from '~icons/material-symbols/menu';

import { Button } from '../common/Button';
import { LargeLogo } from '../common/LogoIcon';
import Text from '../common/Text/Text';
import CalendarFooter from './CalendarFooter';
/**
* Calendar page component
*/
Expand Down Expand Up @@ -54,25 +61,63 @@ export default function Calendar(): JSX.Element {
return (
<CalendarContext.Provider value>
<div className='h-full w-full flex flex-col'>
<CalendarHeader
onSidebarToggle={() => {
setShowSidebar(!showSidebar);
}}
/>
<div className='h-full flex overflow-auto pl-3'>
{showSidebar && (
<div className='h-full flex flex-none flex-col justify-between pb-5 screenshot:hidden'>
<div className='mb-3 h-full w-fit flex flex-col overflow-auto pb-2 pl-4.5 pr-4 pt-5'>
<CalendarSchedules />
<Divider orientation='horizontal' size='100%' className='my-5' />
<ImportantLinks />
<Divider orientation='horizontal' size='100%' className='my-5' />
<TeamLinks />
</div>
<CalendarFooter />
<div className='h-screen flex overflow-auto'>
<div
className={clsx(
'gap-y-spacing6 py-spacing5 relative h-full min-h-screen w-full flex flex-none flex-col justify-between overflow-clip whitespace-nowrap border-r border-ut-offwhite/75 shadow-[2px_0_10px,rgba(214_210_196_/_.1)] duration-300 ease-out-expo transition-property-max-width screenshot:hidden',
{
'max-w-[20.3125rem] ': showSidebar,
'max-w-0 pointer-events-none': !showSidebar,
}
)}
tabIndex={showSidebar ? 0 : -1}
aria-hidden={!showSidebar}
{...{ inert: !showSidebar ? '' : undefined }}
EthanL06 marked this conversation as resolved.
Show resolved Hide resolved
>
<div className='px-spacing7 sticky top-0 z-50 w-full flex items-center justify-between gap-x-3xl bg-white'>
<LargeLogo />
<Button
variant='single'
color='theme-black'
onClick={() => {
setShowSidebar(!showSidebar);
}}
className='h-fit screenshot:hidden !p-0'
icon={MenuIcon}
/>
</div>

<div className='gap-y-spacing5 py-spacing5 px-spacing7 relative h-full w-full flex grow flex-col overflow-x-clip overflow-y-auto'>
<CalendarSchedules />
<Divider orientation='horizontal' size='100%' />
EthanL06 marked this conversation as resolved.
Show resolved Hide resolved
<ResourceLinks />
<Divider orientation='horizontal' size='100%' />
{/* <TeamLinks /> */}
<a
href={CRX_PAGES.REPORT}
className='gap-spacing1 flex items-center text-ut-burntorange underline-offset-2 hover:underline'
target='_blank'
rel='noreferrer'
onClick={event => {
event.preventDefault();
openReportWindow();
}}
>
<Text variant='p'>Send us Feedback!</Text>
<OutwardArrowIcon className='h-3 w-3' />
EthanL06 marked this conversation as resolved.
Show resolved Hide resolved
</a>
</div>
)}

<CalendarFooter />
</div>

<div className='h-full min-w-5xl flex flex-grow flex-col overflow-y-auto'>
<CalendarHeader
sidebarOpen={showSidebar}
onSidebarToggle={() => {
setShowSidebar(!showSidebar);
}}
/>
<div className='min-h-2xl flex-grow overflow-auto pl-2 pr-4 pt-6 screenshot:min-h-xl'>
<CalendarGrid courseCells={courseCells} setCourse={setCourse} />
</div>
Expand Down
37 changes: 27 additions & 10 deletions src/views/components/calendar/CalendarFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,57 @@
import { openTabFromContentScript } from '@views/lib/openNewTabFromContentScript';
import React from 'react';

import DiscordIcon from '~icons/bi/discord';
import SettingsIcon from '~icons/material-symbols/settings';
import GithubIcon from '~icons/ri/github-fill';
import InstagramIcon from '~icons/ri/instagram-line';
import LinkedinIcon from '~icons/ri/linkedin-box-fill';

import { Button } from '../common/Button';
import Link from '../common/Link';

/**
* Opens the options page in a new tab.
* @returns A promise that resolves when the options page is opened.
*/
const handleOpenOptions = async (): Promise<void> => {
const url = chrome.runtime.getURL('/options.html');
await openTabFromContentScript(url);
};

/**
* The footer section of the calendar's sidebar
* @returns
*/
export default function CalendarFooter(): JSX.Element {
return (
<footer className='min-w-full w-0 pl-4.5 space-y-2'>
<div className='flex gap-2'>
<footer className='px-spacing7 pt-spacing3 min-w-full w-0 flex items-center justify-between bg-white'>
<div className='gap-spacing4 flex'>
<Link className='linkanimate' href='https://www.instagram.com/longhorndevelopers'>
<InstagramIcon className='h-6 w-6' />
<InstagramIcon className='h-6 w-6 fill-ut-black' />
</Link>
<Link className='linkanimate' href='https://discord.gg/7pQDBGdmb7'>
<DiscordIcon className='h-6 w-6' />
<DiscordIcon className='h-6 w-6 fill-ut-black' />
</Link>
<Link className='linkanimate' href='https://github.com/Longhorn-Developers'>
<GithubIcon className='h-6 w-6' />
<GithubIcon className='h-6 w-6 fill-ut-black' />
</Link>
<Link
className='linkanimate'
href='https://www.linkedin.com/company/longhorn-developers/posts/?feedView=all'
>
<LinkedinIcon className='h-6 w-6 -mx-0.75' />
<LinkedinIcon className='h-6 w-6 fill-ut-black -mx-0.75' />
</Link>
</div>
<p className='text-2.5 text-ut-concrete font-light tracking-wide'>
UT Registration Plus is a project under Longhorn Developers, a student-led organization aimed at
addressing issues at UT Austin.
</p>
<div>
<Button
className='h-fit !p-0'
variant='single'
icon={SettingsIcon}
color='ut-black'
onClick={handleOpenOptions}
/>
</div>
</footer>
);
}
46 changes: 19 additions & 27 deletions src/views/components/calendar/CalendarHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,25 @@ import { initSettings, OptionsStore } from '@shared/storage/OptionsStore';
import { Button } from '@views/components/common/Button';
import CourseStatus from '@views/components/common/CourseStatus';
import Divider from '@views/components/common/Divider';
import { LargeLogo } from '@views/components/common/LogoIcon';
import ScheduleTotalHoursAndCourses from '@views/components/common/ScheduleTotalHoursAndCourses';
import useSchedules from '@views/hooks/useSchedules';
import { openTabFromContentScript } from '@views/lib/openNewTabFromContentScript';
import React, { useEffect, useState } from 'react';

import MenuIcon from '~icons/material-symbols/menu';
// import RefreshIcon from '~icons/material-symbols/refresh';
import SettingsIcon from '~icons/material-symbols/settings';

/**
* Opens the options page in a new tab.
* @returns A promise that resolves when the options page is opened.
*/
const handleOpenOptions = async (): Promise<void> => {
const url = chrome.runtime.getURL('/options.html');
await openTabFromContentScript(url);
};
import MenuIcon from '~icons/material-symbols/menu';

interface CalendarHeaderProps {
sidebarOpen?: boolean;
onSidebarToggle?: () => void;
}

/**
* Renders the header component for the calendar.
* @returns The JSX element representing the calendar header.
*/
export default function CalendarHeader({ onSidebarToggle }: CalendarHeaderProps): JSX.Element {
export default function CalendarHeader({ sidebarOpen, onSidebarToggle }: CalendarHeaderProps): JSX.Element {
const [enableCourseStatusChips, setEnableCourseStatusChips] = useState<boolean>(false);
const [_enableDataRefreshing, setEnableDataRefreshing] = useState<boolean>(false);
const [enableDataRefreshing, setEnableDataRefreshing] = useState<boolean>(false);

const [activeSchedule] = useSchedules();

Expand All @@ -58,23 +47,27 @@ export default function CalendarHeader({ onSidebarToggle }: CalendarHeaderProps)
}, []);

return (
<div className='flex items-center gap-5 overflow-x-auto overflow-y-hidden border-b border-ut-offwhite px-7 py-4 md:overflow-x-hidden'>
<Button
variant='single'
icon={MenuIcon}
color='ut-gray'
onClick={onSidebarToggle}
className='screenshot:hidden'
/>
<LargeLogo />
<Divider className='mx-2 self-center md:mx-4' size='2.5rem' orientation='vertical' />
<div className='flex-1 screenshot:transform-origin-left screenshot:scale-120'>
<div className='min-h-[91px] flex items-center gap-5 overflow-x-auto overflow-y-hidden px-7 py-4 md:overflow-x-hidden'>
{!sidebarOpen && (
<Button
variant='single'
color='theme-black'
onClick={onSidebarToggle}
className='h-fit screenshot:hidden !p-0'
icon={MenuIcon}
/>
)}

<div className='screenshot:transform-origin-left screenshot:scale-120'>
<ScheduleTotalHoursAndCourses
scheduleName={activeSchedule.name}
totalHours={activeSchedule.hours}
totalCourses={activeSchedule.courses.length}
/>
</div>

<Divider className='mx-2 self-center md:mx-4 screenshot:hidden' size='2.5rem' orientation='vertical' />

<div className='hidden flex-row items-center justify-end gap-6 screenshot:hidden lg:flex'>
{enableCourseStatusChips && (
<>
Expand All @@ -86,7 +79,6 @@ export default function CalendarHeader({ onSidebarToggle }: CalendarHeaderProps)

{/* <Button variant='single' icon={UndoIcon} color='ut-black' />
<Button variant='single' icon={RedoIcon} color='ut-black' /> */}
<Button variant='single' icon={SettingsIcon} color='theme-black' onClick={handleOpenOptions} />
</div>
</div>
);
Expand Down
18 changes: 11 additions & 7 deletions src/views/components/calendar/CalendarSchedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ export function CalendarSchedules() {
};

return (
<div className='min-w-full w-0 items-center'>
<div className='m0 m-b-2 w-full flex justify-between'>
<Text variant='h3' className='text-nowrap'>
<div className='space-y-spacing2 min-w-full w-0 items-center'>
<div className='m0 w-full flex justify-between'>
<Text variant='h3' className='text-nowrap text-theme-black'>
MY SCHEDULES
</Text>
<Button variant='single' color='theme-black' className='h-fit p-0 btn' onClick={handleAddSchedule}>
<AddSchedule className='h-6 w-6' />
</Button>
<Button
variant='single'
color='theme-black'
className='h-fit !p-0 btn'
onClick={handleAddSchedule}
icon={AddSchedule}
/>
</div>
<div className='flex flex-col space-y-2.5'>
<List
gap={10}
gap={8}
EthanL06 marked this conversation as resolved.
Show resolved Hide resolved
draggables={schedules}
itemKey={s => s.id}
onReordered={reordered => {
Expand Down
Loading
Loading