Skip to content

Commit

Permalink
Merge branch 'bog-changes-s23-merged' into 267-special-prereqs
Browse files Browse the repository at this point in the history
  • Loading branch information
aeluro1 authored Apr 8, 2024
2 parents 042559d + 9046686 commit 3d3b71f
Show file tree
Hide file tree
Showing 43 changed files with 1,043 additions and 476 deletions.
Binary file added public/donate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/invitation-succesful.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions public/invitation-succesful.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/scheduled.png
Binary file not shown.
3 changes: 3 additions & 0 deletions src/components/AccountDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ export default function AccountDropdown({
items = [
{
label: <SignedInLabel state={state} />,
id: 'signed-in-label',
},
{
label: 'Sign out',
icon: faSignOutAlt,
onClick: (): void => state.signOut(),
id: 'sign-out-dropdown',
},
{
label: 'Theme',
Expand All @@ -86,6 +88,7 @@ export default function AccountDropdown({
onClick: (): void => {
setLoginOpen(true);
},
id: 'sign-in-button-dropdown',
},
{
label: 'Theme',
Expand Down
2 changes: 2 additions & 0 deletions src/components/App/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ErrorBoundary from '../ErrorBoundary';
import HeaderDisplay from '../HeaderDisplay';
import Map from '../Map';
import Finals from '../Finals';
import DonateBanner from '../DonateBanner';
import {
AppNavigationContext,
AppMobileNav,
Expand Down Expand Up @@ -39,6 +40,7 @@ function AppContentBase(): React.ReactElement {
tabs={NAV_TABS}
captureRef={captureRef}
/>
<DonateBanner />
<ErrorBoundary
// ErrorBoundary.fallback is a normal render prop, not a component.
// eslint-disable-next-line react/no-unstable-nested-components
Expand Down
2 changes: 2 additions & 0 deletions src/components/AppDataLoader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ function ContextProvider({
allFriends,
currentFriends: scheduleVersion.friends ?? {},
...castDraft(scheduleVersion.schedule),
versions: termScheduleData.versions,
},
{
setTerm,
Expand Down Expand Up @@ -511,6 +512,7 @@ function ContextProvider({
deleteVersion,
renameVersion,
cloneVersion,
termScheduleData.versions,
]
);

Expand Down
13 changes: 13 additions & 0 deletions src/components/Attribution/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { faGithub } from '@fortawesome/free-brands-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

import { Button } from '..';
import { classes } from '../../utils/misc';
import { DESKTOP_BREAKPOINT } from '../../constants';
import useScreenWidth from '../../hooks/useScreenWidth';
Expand All @@ -10,6 +13,15 @@ export default function Attribution(): React.ReactElement {
const mobile = !useScreenWidth(DESKTOP_BREAKPOINT);
return (
<div className={classes('Attribution')}>
{!mobile ? (
<Button href="https://github.com/gt-scheduler/website">
<FontAwesomeIcon fixedWidth icon={faGithub} size="2xl" />
<span className="githubText">GitHub</span>
</Button>
) : (
<div />
)}

<p>
Copyright (c) 2023 with{' '}
<span role="img" aria-label="love">
Expand All @@ -22,6 +34,7 @@ export default function Attribution(): React.ReactElement {
</a>
.
</p>
<p>&nbsp;</p>
</div>
);
}
6 changes: 5 additions & 1 deletion src/components/Attribution/stylesheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
justify-content: space-between;
text-align: center;
color: inherit;
border-top: 1px solid $color-border;
Expand All @@ -20,4 +20,8 @@
flex-wrap: wrap;
justify-content: center;
}

.githubText {
margin-left: 5px;
}
}
8 changes: 7 additions & 1 deletion src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type ButtonProps = {
href?: string;
onClick?: (e: React.SyntheticEvent<HTMLDivElement>) => void;
children?: React.ReactNode;
id?: string;
};

export default function Button({
Expand All @@ -18,10 +19,13 @@ export default function Button({
href,
onClick,
children,
id,
}: ButtonProps): React.ReactElement {
if (disabled)
return (
<div className={classes('Button', 'disabled', className)}>{children}</div>
<div className={classes('Button', 'disabled', className)} id={id}>
{children}
</div>
);

if (href != null)
Expand All @@ -31,6 +35,7 @@ export default function Button({
href={href}
rel="noopener noreferrer"
target="_blank"
id={id}
>
{children}
</a>
Expand All @@ -46,6 +51,7 @@ export default function Button({
if (event.key === 'Enter' && onClick != null) onClick(event);
}}
role="button"
id={id}
>
{children}
</div>
Expand Down
38 changes: 27 additions & 11 deletions src/components/Calendar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useContext } from 'react';
import { Immutable } from 'immer';

import { FriendScheduleData } from '../../data/types';
import { Section } from '../../data/beans';
import { CLOSE, DAYS, OPEN } from '../../constants';
import { classes, timeToShortString } from '../../utils/misc';
Expand Down Expand Up @@ -59,7 +61,7 @@ export default function Calendar({
overlayFriendSchedules = [],
isAutosized = false,
}: CalendarProps): React.ReactElement {
const [{ pinnedCrns, oscar, events, currentVersion }] =
const [{ pinnedCrns, oscar, events, currentVersion, versions }] =
useContext(ScheduleContext);

const [{ friends }] = useContext(FriendContext);
Expand Down Expand Up @@ -107,9 +109,10 @@ export default function Calendar({
});
};

const crns = pinSelf
? Array.from(new Set([...pinnedCrns, ...(overlayCrns || [])]))
: [];
const crns =
pinSelf && !compare
? Array.from(new Set([...pinnedCrns, ...(overlayCrns || [])]))
: [];

// Find section using crn and convert the meetings into
// an array of CommonMeetingObject
Expand Down Expand Up @@ -154,10 +157,23 @@ export default function Calendar({
a.period.end - a.period.start - (b.period.end - b.period.start) ?? 0
);

const friendSchedules: { data: FriendCrnData; overlay: boolean }[] = [];
const friendEvents: { data: FriendEventData; overlay: boolean }[] = [];
const userSchedules: { data: FriendCrnData; overlay: boolean }[] = [];
const userEvents: { data: FriendEventData; overlay: boolean }[] = [];
if (compare) {
Object.values(friends).forEach((friend) =>
/*
Create a dummy friend schedule data object for self schedules for
conforming types to iterate over all schedules in one go
*/
const selfFriend: Immutable<FriendScheduleData> = {
self: {
name: 'Me',
email: '',
versions,
},
};
const allUsers = { ...friends, ...selfFriend };

Object.values(allUsers).forEach((friend) =>
Object.entries(friend.versions)
.filter(
(schedule) =>
Expand All @@ -167,7 +183,7 @@ export default function Calendar({
.forEach((schedule) => {
const friendMeetings: CommonMeetingObject[] = [];
schedule[1].schedule.pinnedCrns.forEach((crn) => {
friendSchedules.push({
userSchedules.push({
data: {
friend: friend.name,
scheduleName: schedule[1].name,
Expand All @@ -191,7 +207,7 @@ export default function Calendar({
});
});
schedule[1].schedule.events.forEach((event) => {
friendEvents.push({
userEvents.push({
data: {
friend: friend.name,
scheduleName: schedule[1].name,
Expand Down Expand Up @@ -423,7 +439,7 @@ export default function Calendar({
/>
))}
{compare &&
friendSchedules.map(({ data, overlay }) => (
userSchedules.map(({ data, overlay }) => (
<CompareBlocks
key={`${data.scheduleId}-${data.crn}`}
crn={data.crn}
Expand Down Expand Up @@ -457,7 +473,7 @@ export default function Calendar({
/>
))}
{compare &&
friendEvents.map(({ data, overlay }) => (
userEvents.map(({ data, overlay }) => (
<EventBlocks
key={`${data.scheduleId}-${data.id}`}
event={data.event}
Expand Down
Loading

0 comments on commit 3d3b71f

Please sign in to comment.