Skip to content

Commit

Permalink
Merge branch 'main' into derek/injectedAddButton3
Browse files Browse the repository at this point in the history
  • Loading branch information
doprz authored Jan 6, 2025
2 parents c7d2bf4 + 0d73b13 commit 30ec43b
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 63 deletions.
16 changes: 7 additions & 9 deletions src/pages/background/lib/deleteSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@ export default async function deleteSchedule(scheduleId: string): Promise<string
if (scheduleIndex === -1) {
throw new Error(`Schedule ${scheduleId} does not exist`);
}
if (scheduleIndex === activeIndex) {
throw new Error(`Cannot delete active schedule`);
}

if (scheduleIndex < activeIndex) {
await UserScheduleStore.set('activeIndex', activeIndex - 1);
}

schedules.splice(scheduleIndex, 1);
await UserScheduleStore.set('schedules', schedules);

if (activeIndex >= schedules.length) {
await UserScheduleStore.set('activeIndex', schedules.length - 1);
let newActiveIndex = activeIndex;
if (scheduleIndex < activeIndex) {
newActiveIndex = activeIndex - 1;
} else if (activeIndex >= schedules.length) {
newActiveIndex = schedules.length - 1;
}
await UserScheduleStore.set('activeIndex', newActiveIndex);

return undefined;
}

Expand Down
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 = {
'spacing-1': '0.125rem',
'spacing-2': '0.25rem',
'spacing-3': '0.5rem',
'spacing-4': '0.75rem',
'spacing-5': '1rem',
'spacing-6': '1.25rem',
'spacing-7': '1.5rem',
'spacing-8': '2rem',
} as const;
11 changes: 9 additions & 2 deletions src/shared/types/ThemeColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ export const colors = {
blue: '#005F86',
gray: '#9CADB7',
offwhite: '#D6D2C4',
concrete: '#95A5A6',
},
theme: {
red: '#D10000',
black: '#1A2024',
offwhite1: ' #D6D2C450',
offwhite2: '#D6D2C420',
black1: '#333F4850',
black2: '#333F4820',
staticwhite: '#FFFFFF',
staticblack: '#1A2024',
majorgridline: '#D1D5DB',
minorgridline: '#F3F4F6',
},
} as const satisfies Record<string, Record<string, string>>;

Expand All @@ -37,7 +44,7 @@ export const extendedColors = {
d: '#DC2626',
dminus: '#B91C1C',
f: '#B91C1C',
other: '#6B7280',
other: '#D6D3D1',
},
} as const;

Expand Down
2 changes: 1 addition & 1 deletion src/views/components/calendar/CalendarFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function CalendarFooter(): JSX.Element {
<LinkedinIcon className='h-6 w-6 -mx-0.75' />
</Link>
</div>
<p className='text-2.5 text-ut-concrete font-light tracking-wide'>
<p className='text-2.5 text-ut-gray 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>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@import 'src/views/styles/base.module.scss';
@use 'sass:meta';
@use 'src/views/styles/base.module.scss';

@layer base {
.extensionRoot {
@import 'tailwind-compat';
@include meta.load-css('tailwind-compat');
}

span {
Expand Down
74 changes: 27 additions & 47 deletions src/views/components/common/ScheduleListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,54 +61,34 @@ export default function ScheduleListItem({ schedule, dragHandleProps, onClick }:
};

const handleDelete = () => {
if (schedule.id === activeSchedule.id) {
showDialog({
title: `Unable to delete active schedule.`,

description: (
<>
<Text>Deleting the active schedule</Text>
<Text className='text-ut-burntorange'> {schedule.name} </Text>
<Text>is not allowed. Please switch to another schedule and try again.</Text>
</>
),
// eslint-disable-next-line react/no-unstable-nested-components
buttons: close => (
<Button variant='filled' color='ut-burntorange' onClick={close}>
I Understand
showDialog({
title: `Are you sure?`,
description: (
<>
<Text>Deleting</Text>
<Text className='text-ut-burntorange'> {schedule.name} </Text>
<Text>is permanent and will remove all added courses from that schedule.</Text>
</>
),
// eslint-disable-next-line react/no-unstable-nested-components
buttons: close => (
<>
<Button variant='single' color='ut-black' onClick={close}>
Cancel
</Button>
),
});
} else {
showDialog({
title: `Are you sure?`,
description: (
<>
<Text>Deleting</Text>
<Text className='text-ut-burntorange'> {schedule.name} </Text>
<Text>is permanent and will remove all added courses from that schedule.</Text>
</>
),
// eslint-disable-next-line react/no-unstable-nested-components
buttons: close => (
<>
<Button variant='single' color='ut-black' onClick={close}>
Cancel
</Button>
<Button
variant='filled'
color='theme-red'
onClick={() => {
close();
deleteSchedule(schedule.id);
}}
>
Delete Permanently
</Button>
</>
),
});
}
<Button
variant='filled'
color='theme-red'
onClick={() => {
close();
deleteSchedule(schedule.id);
}}
>
Delete Permanently
</Button>
</>
),
});
};

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'src/views/styles/base.module.scss';
@use 'src/views/styles/base.module.scss';

.autoLoad {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion src/views/components/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default function Settings(): JSX.Element {
accept();
}}
>
I Understand hello
I Understand
</Button>
),
});
Expand Down
2 changes: 2 additions & 0 deletions unocss.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import transformerDirectives from '@unocss/transformer-directives';
import transformerVariantGroup from '@unocss/transformer-variant-group';
import { defineConfig } from 'unocss';

import { spacing } from './src/shared/types/Spacing';
import { colors } from './src/shared/types/ThemeColors';

export default defineConfig({
Expand Down Expand Up @@ -36,6 +37,7 @@ export default defineConfig({
'out-expo': 'cubic-bezier(0.19, 1, 0.22, 1)',
},
colors,
spacing,
},
variants: [
matcher => {
Expand Down

0 comments on commit 30ec43b

Please sign in to comment.