Compare commits

..

5 Commits

Author SHA1 Message Date
Vincent Situ
6a67a32e4f feat: allow bypassing the 10-schedule limit (#675)
* feat: allow bypassing the 10-schedule limit

* feat: option to bypass 10 schedules- code done, not tested

* feat(ui): option to bypass 10 schedules

* feat(ui): button to lead to settings after reaching max limit

* Delete manifest.json

* Remove cross-env from build:watch script

* Remove cross-env and update caniuse-lite version

Removed cross-env dependency and updated caniuse-lite version.

* chore: lint

---------

Co-authored-by: Derek <derex1987@gmail.com>
2025-11-10 13:39:36 -06:00
Uthman
549c52a39f feat: add drag-and-drop import for schedules (#661)
* testing

* feat: add drag-and-drop support to FileUpload (#446)

* chore: remove testing comment

* chore: fix lint issues

* chore: format FileUpload.tsx with prettier

---------

Co-authored-by: Uthman Ogungbo <uthmanogungbo@Uthmans-MacBook-Pro.local>
Co-authored-by: Uthman Ogungbo <uthmanogungbo@wireless-10-148-166-229.public.utexas.edu>
Co-authored-by: Derek <derex1987@gmail.com>
2025-11-06 23:03:55 -06:00
doprz
36007b9d1a docs: add CODE_OF_CONDUCT.md (#651)
Added a Code of Conduct document to outline community guidelines and expectations.

Co-authored-by: Derek <derex1987@gmail.com>
2025-11-05 16:58:16 -06:00
cee5f0284f feat: condense resourceLinks course schedule (#676)
* chore: remove summer 2025 schedule list item

* feat: compress course schedules into one link

* Revise ResourceLinks with Spring '26 schedule

Updated course schedule links for Spring '26.
2025-11-05 16:38:00 -06:00
dependabot[bot]
e8a8b8e1ae chore(deps): bump the npm_and_yarn group across 1 directory with 4 updates (#639)
Bumps the npm_and_yarn group with 4 updates in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite), [@babel/helpers](https://github.com/babel/babel/tree/HEAD/packages/babel-helpers), [brace-expansion](https://github.com/juliangruber/brace-expansion) and [undici](https://github.com/nodejs/undici).


Updates `vite` from 5.4.14 to 5.4.20
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v5.4.20/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v5.4.20/packages/vite)

Updates `@babel/helpers` from 7.26.9 to 7.28.4
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.28.4/packages/babel-helpers)

Updates `brace-expansion` from 1.1.11 to 1.1.12
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/1.1.11...v1.1.12)

Updates `undici` from 6.21.1 to 6.22.0
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.21.1...v6.22.0)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 5.4.20
  dependency-type: direct:development
  dependency-group: npm_and_yarn
- dependency-name: "@babel/helpers"
  dependency-version: 7.28.4
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: brace-expansion
  dependency-version: 1.1.12
  dependency-type: indirect
  dependency-group: npm_and_yarn
- dependency-name: undici
  dependency-version: 6.22.0
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 11:36:53 -05:00
9 changed files with 801 additions and 381 deletions

32
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,32 @@
# UT Registration Plus Code of Conduct
Like the technical community as a whole, the UT Registration Plus team and community is made up of a mixture of professionals and volunteers from all over the world, working on every aspect of the mission - including mentorship, teaching, and connecting people.
Diversity is one of our huge strengths, but it can also lead to communication issues and unhappiness. To that end, we have a few ground rules that we ask people to adhere to. This code applies equally to founders, mentors and those seeking help and guidance.
This isnt an exhaustive list of things that you cant do. Rather, take it in the spirit in which its intended - a guide to make it easier to enrich all of us and the technical communities in which we participate.
This code of conduct applies to all spaces managed by the UT Registration Plus project or Longhorn Developers. This includes IRC, the mailing lists, the issue tracker, DSF events, and any other forums created by the project team which the community uses for communication. In addition, violations of this code outside these spaces may affect a person's ability to participate within them.
If you believe someone is violating the code of conduct, we ask that you report it by emailing [contact@longhorns.dev](mailto:contact@longhorns.dev). For more details please see our
- **Be friendly and patient.**
- **Be welcoming.** We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
- **Be considerate.** Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
- **Be respectful.** Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. Its important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the UT Registration Plus community should be respectful when dealing with other members as well as with people outside the UT Registration Plus community.
- **Be careful in the words that you choose.** We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to:
- Violent threats or language directed against another person.
- Discriminatory jokes and language.
- Posting sexually explicit or violent material.
- Posting (or threatening to post) other people's personally identifying information ("doxing").
- Personal insults, especially those using racist or sexist terms.
- Unwelcome sexual attention.
- Advocating for, or encouraging, any of the above behavior.
- Repeated harassment of others. In general, if someone asks you to stop, then stop.
- **When we disagree, try to understand why.** Disagreements, both social and technical, happen all the time and UT Registration Plus is no exception. It is important that we resolve disagreements and differing views constructively. Remember that were different. The strength of UT Registration Plus comes from its varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesnt mean that theyre wrong. Dont forget that it is human to err and blaming each other doesnt get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes.
Original text courtesy of the [Speak Up! project](http://web.archive.org/web/20141109123859/http://speakup.io/coc.html).
## Questions?
If you have questions, please see . If that doesn't answer your questions, feel free to [contact us](mailto:contact@longhorns.dev).

View File

@@ -144,7 +144,7 @@
"unocss": "^0.63.6",
"unocss-preset-primitives": "0.0.2-beta.1",
"unplugin-icons": "^0.19.3",
"vite": "^5.4.14",
"vite": "^5.4.20",
"vite-plugin-inspect": "^0.8.9",
"vitest": "^2.1.9"
},

935
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,6 +24,8 @@ export interface IOptionsStore {
/** whether the promo should be shown */
showUTDiningPromo: boolean;
/** whether users are allowed to bypass the 10 schedule limit */
allowMoreSchedules: boolean;
}
export const OptionsStore = createSyncStore<IOptionsStore>({
@@ -34,6 +36,7 @@ export const OptionsStore = createSyncStore<IOptionsStore>({
alwaysOpenCalendarInNewTab: false,
showCalendarSidebar: true,
showUTDiningPromo: true,
allowMoreSchedules: false,
});
/**
@@ -50,6 +53,7 @@ export const initSettings = async () =>
alwaysOpenCalendarInNewTab: await OptionsStore.get('alwaysOpenCalendarInNewTab'),
showCalendarSidebar: await OptionsStore.get('showCalendarSidebar'),
showUTDiningPromo: await OptionsStore.get('showUTDiningPromo'),
allowMoreSchedules: await OptionsStore.get('allowMoreSchedules'),
}) satisfies IOptionsStore;
// Clothing retailer right

View File

@@ -14,17 +14,21 @@ interface LinkItem {
}
const links: LinkItem[] = [
// {
// text: "Fall '25 Course Schedule",
// url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20259/',
// },
// {
// text: 'Course Schedule Archives',
// url: 'https://registrar.utexas.edu/schedules/archive',
// },
{
text: "Spring '26 Course Schedule",
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20262/',
},
{
text: "Fall '25 Course Schedule",
url: 'https://utdirect.utexas.edu/apps/registrar/course_schedule/20259/',
},
{
text: 'Course Schedule Archives',
url: 'https://registrar.utexas.edu/schedules/archive',
text: 'Other Course Schedules',
url: 'https://registrar.utexas.edu/schedules',
},
{
text: 'My Degree Audit (IDA)',

View File

@@ -4,7 +4,7 @@ import type { ThemeColor } from '@shared/types/ThemeColors';
import { getThemeColorHexByName, getThemeColorRgbByName } from '@shared/util/themeColors';
import Text from '@views/components/common/Text/Text';
import clsx from 'clsx';
import React from 'react';
import React, { useEffect, useRef, useState } from 'react';
interface Props {
className?: string;
@@ -21,9 +21,8 @@ interface Props {
}
/**
* A reusable input button component that follows the Button.tsx consistency
*
* @returns
* A reusable input button component that follows Button.tsx consistency.
* Now supports drag-and-drop file uploads (issue #446).
*/
export default function FileUpload({
className,
@@ -43,22 +42,74 @@ export default function FileUpload({
const isIconOnly = !children && !!icon;
const colorHex = getThemeColorHexByName(color);
const colorRgb = getThemeColorRgbByName(color)?.join(' ');
const inputRef = useRef<HTMLInputElement>(null);
const [isDragging, setIsDragging] = useState(false);
// Convert accept to a comma-separated string if it's an array
// Convert accept array to comma-separated list
const acceptValue = Array.isArray(accept) ? accept.join(',') : accept;
// --- Prevent Chrome from opening the file on drop anywhere else ---
useEffect(() => {
const preventDefault = (e: DragEvent) => {
e.preventDefault();
e.stopPropagation();
};
window.addEventListener('dragover', preventDefault);
window.addEventListener('drop', preventDefault);
return () => {
window.removeEventListener('dragover', preventDefault);
window.removeEventListener('drop', preventDefault);
};
}, []);
// ------------------------------------------------------------------
// --- Local drag and drop handlers for this button only -------------
const handleDrop = (event: React.DragEvent<HTMLLabelElement>) => {
event.preventDefault();
event.stopPropagation();
setIsDragging(false);
if (disabled) return;
const file = event.dataTransfer.files?.[0];
if (file && inputRef.current && onChange) {
const dataTransfer = new DataTransfer();
dataTransfer.items.add(file);
inputRef.current.files = dataTransfer.files;
// Trigger change event manually
onChange({ target: inputRef.current } as React.ChangeEvent<HTMLInputElement>);
}
};
const handleDragOver = (event: React.DragEvent<HTMLLabelElement>) => {
event.preventDefault();
event.stopPropagation();
if (!disabled) setIsDragging(true);
};
const handleDragLeave = (event: React.DragEvent<HTMLLabelElement>) => {
event.preventDefault();
event.stopPropagation();
setIsDragging(false);
};
// ------------------------------------------------------------------
return (
<label
style={
{
...style,
color: disabled ? 'ut-gray' : colorHex,
backgroundColor: `rgb(${colorRgb} / var(--un-bg-opacity)`,
} satisfies React.CSSProperties
}
onDrop={handleDrop}
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
style={{
...style,
color: disabled ? 'ut-gray' : colorHex,
backgroundColor: `rgb(${colorRgb} / var(--un-bg-opacity))`,
}}
className={clsx(
'btn',
'btn transition-colors select-none',
{
'ring-2 ring-offset-2 ring-blue-400': isDragging && !disabled,
'text-white! bg-opacity-100 hover:enabled:shadow-md active:enabled:shadow-sm shadow-black/20':
variant === 'filled',
'bg-opacity-0 border-current hover:enabled:bg-opacity-8 border stroke-width-[1px]':
@@ -70,6 +121,7 @@ export default function FileUpload({
'h-[35px] w-[35px] p-spacing-2': size === 'small' && isIconOnly,
'h-6 p-spacing-2': size === 'mini' && !isIconOnly,
'h-6 w-6 p-0': size === 'mini' && isIconOnly,
'opacity-60 cursor-not-allowed': disabled,
},
className
)}
@@ -85,6 +137,7 @@ export default function FileUpload({
</Text>
)}
<input
ref={inputRef}
type='file'
{...(accept ? { accept: acceptValue } : {})}
className='hidden'

View File

@@ -175,11 +175,11 @@ export default function HeadingAndActions({ course, activeSchedule, onClose }: H
description: (
<>
The section you&apos;re adding is for{' '}
<span className='text-ut-burntorange whitespace-nowrap'>
<span className='whitespace-nowrap text-ut-burntorange'>
{course.semester.season} {course.semester.year}
</span>
, but your current schedule contains sections in{' '}
<span className='text-ut-burntorange whitespace-nowrap'>{activeSemesters}</span>. Mixing
<span className='whitespace-nowrap text-ut-burntorange'>{activeSemesters}</span>. Mixing
semesters in one schedule may cause confusion.
</>
),

View File

@@ -92,6 +92,7 @@ export default function Settings(): JSX.Element {
const [loadAllCourses, setLoadAllCourses] = useState<boolean>(false);
const [_enableDataRefreshing, setEnableDataRefreshing] = useState<boolean>(false);
const [calendarNewTab, setCalendarNewTab] = useState<boolean>(false);
const [increaseScheduleLimit, setIncreaseScheduleLimit] = useState<boolean>(false);
const showMigrationDialog = useMigrationDialog();
@@ -126,6 +127,7 @@ export default function Settings(): JSX.Element {
enableScrollToLoad,
enableDataRefreshing,
alwaysOpenCalendarInNewTab,
allowMoreSchedules,
} = await initSettings();
setEnableCourseStatusChips(enableCourseStatusChips);
// setShowTimeLocation(enableTimeAndLocationInPopup);
@@ -133,6 +135,7 @@ export default function Settings(): JSX.Element {
setLoadAllCourses(enableScrollToLoad);
setEnableDataRefreshing(enableDataRefreshing);
setCalendarNewTab(alwaysOpenCalendarInNewTab);
setIncreaseScheduleLimit(allowMoreSchedules);
};
const initDS = async () => {
@@ -187,6 +190,15 @@ export default function Settings(): JSX.Element {
// console.log('alwaysOpenCalendarInNewTab', newValue);
});
const l6 = OptionsStore.listen('alwaysOpenCalendarInNewTab', async ({ newValue }) => {
setCalendarNewTab(newValue);
// console.log('alwaysOpenCalendarInNewTab', newValue);
});
const l7 = OptionsStore.listen('allowMoreSchedules', async ({ newValue }) => {
setIncreaseScheduleLimit(newValue);
});
// Remove listeners when the component is unmounted
return () => {
OptionsStore.removeListener(l1);
@@ -194,6 +206,8 @@ export default function Settings(): JSX.Element {
OptionsStore.removeListener(l3);
OptionsStore.removeListener(l4);
OptionsStore.removeListener(l5);
OptionsStore.removeListener(l6);
OptionsStore.removeListener(l7);
DevStore.removeListener(ds_l1);
@@ -232,21 +246,18 @@ export default function Settings(): JSX.Element {
const handleImportClick = async (event: React.ChangeEvent<HTMLInputElement>) => {
const file = event.target.files?.[0];
if (file) {
const reader = new FileReader();
reader.onload = async e => {
try {
const result = e.target?.result as string;
const jsonObject = JSON.parse(result);
await importSchedule(jsonObject);
} catch (error) {
console.error('Invalid import file!');
}
};
reader.readAsText(file);
if (!file) return;
try {
const text = await file.text();
const data = JSON.parse(text);
await importSchedule(data);
alert('Schedule imported successfully.');
} catch (error) {
console.error('Error importing schedule:', error);
alert('Failed to import schedule. Make sure the file is a valid .json format.');
}
};
// const handleAddCourseByLink = async () => {
// // todo: Use a proper modal instead of a prompt
// const link: string | null = prompt('Enter course link');
@@ -452,6 +463,25 @@ export default function Settings(): JSX.Element {
/>
</div>
<div className='flex items-center justify-between'>
<div className='max-w-xs'>
<Text variant='h4' className='text-ut-burntorange font-semibold'>
Allow more than 10 schedules
</Text>
<p className='text-sm text-gray-600'>
Allow bypassing the 10-schedule limit. Intended for advisors or staff who
need to create many schedules on behalf of students.
</p>
</div>
<SwitchButton
isChecked={increaseScheduleLimit}
onChange={() => {
setIncreaseScheduleLimit(!increaseScheduleLimit);
OptionsStore.set('allowMoreSchedules', !increaseScheduleLimit);
}}
/>
</div>
<Divider size='auto' orientation='horizontal' />
<div className='flex items-center justify-between'>

View File

@@ -1,5 +1,8 @@
import { background } from '@shared/messages';
import { OptionsStore } from '@shared/storage/OptionsStore';
import { CRX_PAGES } from '@shared/types/CRXPages';
import useSchedules from '@views/hooks/useSchedules';
import React, { useCallback } from 'react';
import React, { useCallback, useEffect, useState } from 'react';
import { Button } from '../components/common/Button';
import { usePrompt } from '../components/common/DialogProvider/DialogProvider';
@@ -17,8 +20,33 @@ const SCHEDULE_LIMIT = 10;
export function useEnforceScheduleLimit(): () => boolean {
const [, schedules] = useSchedules();
const showDialog = usePrompt();
const [allowMoreSchedules, setAllowMoreSchedules] = useState<boolean>(false);
useEffect(() => {
let mounted = true;
(async () => {
try {
const val = await OptionsStore.get('allowMoreSchedules');
if (mounted) setAllowMoreSchedules(val ?? false);
} catch (err) {
console.error('Failed to read allowMoreSchedules from OptionsStore:', err);
}
})();
const listener = OptionsStore.listen('allowMoreSchedules', async ({ newValue }) => {
setAllowMoreSchedules(newValue);
});
return () => {
mounted = false;
OptionsStore.removeListener(listener);
};
}, []);
return useCallback(() => {
// If user has enabled bypass, allow creating more schedules
if (allowMoreSchedules) return true;
if (schedules.length >= SCHEDULE_LIMIT) {
showDialog({
title: `You have too many schedules!`,
@@ -27,19 +55,33 @@ export function useEnforceScheduleLimit(): () => boolean {
<>
To encourage organization,{' '}
<span className='text-ut-burntorange'>please consider deleting any unused schedules</span> you
may have.
may have. You can increase the limit in the settings if its really necessary.
</>
),
buttons: close => (
<Button variant='filled' color='ut-burntorange' onClick={close}>
I understand
</Button>
<>
<Button
variant='outline'
color='ut-black'
onClick={() => {
close();
// open options/settings page so user can enable bypass if they are advising staff
const url = chrome.runtime.getURL(CRX_PAGES.OPTIONS);
background.openNewTab({ url });
}}
>
Open Settings
</Button>
<Button variant='filled' color='ut-burntorange' onClick={close}>
I understand
</Button>
</>
),
});
return false;
}
return true;
}, [schedules, showDialog]);
}, [schedules, showDialog, allowMoreSchedules]);
}