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

Faris/cleanup optimizations #113

Merged
merged 9 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/components/events/CalendarButtons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const CalendarButtons = ({ event }: CalendarButtonProps) => {
className={styles.calendarLink}
href={appleCalInfo.href}
download={appleCalInfo.download}
suppressHydrationWarning
>
<AppleCalendarLogo className={styles.appleCalLogo} alt="apple calendar" />
<Typography variant="h6/bold">Add to Apple Calendar</Typography>
Expand Down
5 changes: 4 additions & 1 deletion src/components/events/EventModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const EventModal = ({ open, attended, event, onClose }: EventModalProps) => {
const { cover, title, start, end, location, description, eventLink } = event;

const displayCover = cover || '/assets/graphics/store/hero-photo.jpg';
const displayEventLink = eventLink || `https://acmucsd.com/events/${event.uuid}`;
const formattedEventLink = eventLink?.includes('https://') ? eventLink : `https://${eventLink}`;
const displayEventLink = eventLink
? formattedEventLink
: `https://acmucsd.com/events/${event.uuid}`;

const ref = useRef<HTMLDialogElement>(null);

Expand Down
3 changes: 2 additions & 1 deletion src/components/leaderboard/TopThreeCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { trim } from '@/lib/utils';
import { isSrcAGif, trim } from '@/lib/utils';
import Image from 'next/image';
import Link from 'next/link';
import styles from './style.module.scss';
Expand All @@ -24,6 +24,7 @@ const TopThreeCard = ({ position, rank, name, url, points, image }: UserCardProp
alt="User Profile Pic"
width={80}
height={80}
unoptimized={isSrcAGif(image)}
/>
<span className={styles.cardText}>{trim(name, 25)}</span>
<span className={styles.cardText}>{rank}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ROWS_PER_PAGE = 25;
const EventsPage = ({ events, attendances }: EventsPageProps) => {
const [page, setPage] = useState(0);
const [communityFilter, setCommunityFilter] = useState('all');
const [dateFilter, setDateFilter] = useState('upcoming');
const [dateFilter, setDateFilter] = useState('all-time');
const [attendedFilter, setAttendedFilter] = useState('all');
const [query, setQuery] = useState('');

Expand Down
12 changes: 6 additions & 6 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventCarousel } from '@/components/events';
import Hero from '@/components/home/Hero';
import { showToast } from '@/lib';
import { config, showToast } from '@/lib';
import { EventAPI, UserAPI } from '@/lib/api';
import withAccessType from '@/lib/hoc/withAccessType';
import { attendEvent } from '@/lib/managers/EventManager';
Expand Down Expand Up @@ -75,7 +75,7 @@ const PortalHomePage = ({
// This will only be run once in prod or deployment.
processCheckInResponse(checkInResponse);
// Clear the query params without re-triggering getServerSideProps.
window.history.replaceState(null, '', '/');
window.history.replaceState(null, '', config.homeRoute);
}
}, [checkInResponse]);

Expand All @@ -96,7 +96,7 @@ const PortalHomePage = ({
<EventCarousel
title="Upcoming Events"
description="Mark your calendars! These events are just around the corner!"
events={upcomingEvents.slice(0, 10)} // Slicing past events so the carousel doesn't balloon.
events={upcomingEvents} // Slicing past events so the carousel doesn't balloon.
attendances={attendance}
/>
)}
Expand All @@ -105,7 +105,7 @@ const PortalHomePage = ({
<EventCarousel
title="Past Events"
description="Take a look at some of ACM's past events!"
events={pastEvents.slice(-10).reverse()} // Slicing past events so the carousel doesn't balloon.
events={pastEvents} // Slicing past events so the carousel doesn't balloon.
attendances={attendance}
/>
)}
Expand Down Expand Up @@ -156,8 +156,8 @@ const getServerSidePropsFunc: GetServerSideProps = async ({ req, res, query }) =
return {
props: {
user,
pastEvents,
upcomingEvents,
pastEvents: pastEvents.slice(-10).reverse(),
upcomingEvents: upcomingEvents.slice(0, 10),
liveEvents,
attendances,
checkInResponse: checkInResponse,
Expand Down