Skip to content

Commit e0cf459

Browse files
committed
linting fixes
1 parent be91d89 commit e0cf459

11 files changed

Lines changed: 11 additions & 72 deletions

File tree

src/App.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
import { MantineProvider } from "@mantine/core";
2-
import { useColorScheme, useLocalStorage } from "@mantine/hooks";
32
import { Notifications } from "@mantine/notifications";
4-
5-
// import ColorSchemeContext from "./ColorSchemeContext";
63
import { Router } from "./Router";
7-
// import { UserResolverProvider } from "./components/NameOptionalCard";
84

95
export default function App() {
10-
// const preferredColorScheme = useColorScheme();
11-
// const [colorScheme, setColorScheme] = useLocalStorage({
12-
// key: "acm-manage-color-scheme",
13-
// defaultValue: preferredColorScheme,
14-
// });
156
return (
167
<MantineProvider>
178
<Notifications position="top-right" />

src/common/utils/apiCache.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/**
2-
* API Cache Utility
3-
* Provides caching with TTL (Time To Live) support to reduce unnecessary API calls
4-
*/
5-
61
interface CacheEntry<T> {
72
data: T;
83
timestamp: number;
@@ -28,7 +23,6 @@ class ApiCache {
2823
const age = now - entry.timestamp;
2924

3025
if (age > entry.ttl) {
31-
// Cache expired, remove it
3226
this.cache.delete(key);
3327
return null;
3428
}
@@ -105,8 +99,8 @@ class ApiCache {
10599
export const apiCache = new ApiCache();
106100

107101
export const CacheTTL = {
108-
SHORT: 1 * 60 * 1000, // 1 minute
109-
MEDIUM: 5 * 60 * 1000, // 5 minutes
110-
LONG: 15 * 60 * 1000, // 15 minutes
111-
VERY_LONG: 60 * 60 * 1000, // 1 hour
102+
SHORT: 1 * 60 * 1000,
103+
MEDIUM: 5 * 60 * 1000,
104+
LONG: 15 * 60 * 1000,
105+
VERY_LONG: 60 * 60 * 1000,
112106
} as const;

src/components/Layout/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function Header({ opened, toggle }: HeaderProps) {
4444
<Menu.Dropdown>
4545
<Menu.Label>My Account</Menu.Label>
4646
<Menu.Item leftSection={<IconUser style={{ width: rem(14), height: rem(14) }} />}
47-
onClick={() => navigate("/profile", { replace: true })}
47+
onClick={() => navigate("/profile", { replace: true })}
4848
>
4949
Profile
5050
</Menu.Item>

src/components/ProfileQR/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useState } from 'react';
22
import { Modal, Stack, Text, Loader, Center, Box, Button } from '@mantine/core';
33
import QRCode from 'react-qr-code';
4-
import { useAuth } from '../AuthContext'; // Adjust path as needed
4+
import { useAuth } from '../AuthContext';
55
import { IconAlertCircle } from '@tabler/icons-react';
66

77
interface CheckInModalProps {
@@ -33,7 +33,6 @@ export function CheckInModal({ opened, onClose }: CheckInModalProps) {
3333
};
3434
fetchToken();
3535
} else {
36-
// Security: Clear token when modal closes
3736
setToken(null);
3837
setError(null);
3938
}
@@ -53,7 +52,6 @@ export function CheckInModal({ opened, onClose }: CheckInModalProps) {
5352
<Loader size="xl" />
5453
</Center>
5554
) : error ? (
56-
// ❌ Replaced <Alert> with this Modal Error View
5755
<>
5856
<IconAlertCircle size={48} color="red" style={{ alignSelf: 'center' }} />
5957
<Text ta="center" fw={500}>Generation Failed</Text>
@@ -65,7 +63,6 @@ export function CheckInModal({ opened, onClose }: CheckInModalProps) {
6563
</Button>
6664
</>
6765
) : token ? (
68-
// ✅ Success View
6966
<>
7067
<Box p="md" bg="white" style={{ borderRadius: 8 }}>
7168
<QRCode

src/pages/Login.page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ export function LoginPage() {
3232
if (response.status === 400 || response.status === 404) {
3333
navigate("/profile?firstTime=true", { replace: true });
3434
} else if (response.ok) {
35-
// Profile exists, redirect to returnTo or home
3635
navigate(returnTo || "/home", { replace: true });
3736
} else {
38-
// Other errors, send to profile setup to be safe
3937
navigate("/profile?firstTime=true", { replace: true });
4038
}
4139
} catch (error) {

src/pages/events/UpcomingEvents.page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ export function UpcomingEventsPage() {
4444
if (!response.ok) {
4545
const errData = await response.text();
4646

47-
// Handle specific error cases
4847
if (response.status === 400) {
49-
// Check if it's a profile error
5048
if (errData.toLowerCase().includes('profile') ||
5149
errData.toLowerCase().includes('complete') ||
5250
errData.toLowerCase().includes('required')) {

src/pages/events/UpcomingEvents.view.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,13 @@ export function UpcomingEventsView({ getEvents, onRsvp, onRefresh }: UpcomingEve
7575
try {
7676
await onRsvp(selectedEvent, token);
7777

78-
// Add to RSVPed events set
7978
setRsvpedEvents(prev => new Set(prev).add(selectedEvent.id));
8079

8180
close();
8281

8382
} catch (e: any) {
8483
console.error(e);
8584

86-
// Handle specific error cases
8785
if (e.message?.includes('400') || e.message?.toLowerCase().includes('profile')) {
8886
setRsvpError('profile');
8987
} else if (e.message?.toLowerCase().includes('full') || e.message?.toLowerCase().includes('capacity')) {
@@ -235,7 +233,6 @@ export function UpcomingEventsView({ getEvents, onRsvp, onRefresh }: UpcomingEve
235233
</SimpleGrid>
236234
)}
237235

238-
{/* RSVP Modal */}
239236
<Modal
240237
opened={opened}
241238
onClose={() => !rsvpLoading && close()}

src/pages/profile/MyProfile.page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@ export function MyProfilePage() {
2828

2929
if (!response.ok) {
3030
if (response.status === 404) {
31-
// Profile doesn't exist yet - redirect to first-time setup if not already there
3231
if (!isFirstTime) {
3332
navigate("/profile?firstTime=true", { replace: true });
3433
}
3534
return null;
3635
}
3736

3837
if (response.status === 400) {
39-
// Validation error or incomplete profile
4038
const errData = await response.text();
4139
console.error('Profile validation error:', errData);
4240
if (!isFirstTime) {
@@ -50,7 +48,7 @@ export function MyProfilePage() {
5048

5149
return await response.json();
5250
},
53-
CacheTTL.MEDIUM // Cache for 5 minutes
51+
CacheTTL.MEDIUM
5452
);
5553
}, [getToken, navigate, isFirstTime]);
5654

src/pages/profile/MyProfile.view.tsx

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,14 @@ import {
1212
IconSchool, IconStar, IconApple, IconQrcode
1313
} from '@tabler/icons-react';
1414
import { config } from '../../config';
15-
import { RsvpProfile } from '../../common/types/rsvp';
15+
import { RsvpProfile, SCHOOL_YEARS, MAJORS, COMMON_INTERESTS } from '../../common/types/rsvp';
1616
import { CheckInModal } from '../../components/ProfileQR';
1717

1818
interface MyProfileViewProps {
1919
getProfile: () => Promise<RsvpProfile | null>;
2020
updateProfile: (profile: Omit<RsvpProfile, 'updatedAt'>, turnstileToken: string) => Promise<void>;
2121
isFirstTime: boolean;
2222
}
23-
24-
const SCHOOL_YEARS = ["Freshman", "Sophomore", "Junior", "Senior", "Graduate"];
25-
26-
// ... (Keep MAJORS, COMMON_INTERESTS, and DIETARY_RESTRICTIONS_OPTIONS arrays exactly as they were) ...
27-
const MAJORS = [
28-
"ACES Undeclared", "Accountancy", "Computer Science", "Electrical Engineering", "Mechanical Engineering",
29-
// ... (Abbreviated for brevity, keep your full list) ...
30-
"Other"
31-
];
32-
33-
const COMMON_INTERESTS = [
34-
"AI/Machine Learning", "Web Development", "Mobile Development", "Cybersecurity", "Game Development",
35-
"Data Science", "Cloud Computing", "Robotics", "Blockchain", "UI/UX Design"
36-
];
37-
3823
const DIETARY_RESTRICTIONS_OPTIONS = [
3924
"Vegetarian", "Vegan", "Gluten-Free", "Dairy-Free", "Nut Allergy", "Shellfish Allergy", "Halal", "Kosher", "Lactose Intolerant", "Pescatarian"
4025
];
@@ -46,19 +31,16 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
4631
const [error, setError] = useState<string | null>(null);
4732
const [isEditing, setIsEditing] = useState(isFirstTime);
4833

49-
// Form state
5034
const [schoolYear, setSchoolYear] = useState<string>('');
5135
const [intendedMajor, setIntendedMajor] = useState<string>('');
5236
const [interests, setInterests] = useState<string[]>([]);
5337
const [dietaryRestrictions, setDietaryRestrictions] = useState<string[]>([]);
5438
const [customInterest, setCustomInterest] = useState('');
5539

56-
// Modal and turnstile state
5740
const [opened, { open, close }] = useDisclosure(false);
5841
const [welcomeOpened, { open: openWelcome, close: closeWelcome }] = useDisclosure(isFirstTime);
5942
const [saveLoading, setSaveLoading] = useState(false);
6043

61-
// QR Modal State
6244
const [qrModalOpened, { open: openQrModal, close: closeQrModal }] = useDisclosure(false);
6345

6446
useEffect(() => {
@@ -76,7 +58,6 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
7658
setDietaryRestrictions(data.dietaryRestrictions);
7759
setError(null);
7860
} else if (!isFirstTime) {
79-
// Explicitly set error if no data found and not in setup mode
8061
setError("Profile not found.");
8162
}
8263
} catch (err: any) {
@@ -165,7 +146,6 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
165146
return Math.round((completed / total) * 100);
166147
};
167148

168-
// 1. Critical Error State: If not loading, not first time, and no profile
169149
if (!loading && !isFirstTime && !profile) {
170150
return (
171151
<Container size="md" py="xl">
@@ -186,7 +166,6 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
186166

187167
return (
188168
<Container size="md" py="xl">
189-
{/* 2. QR Code Modal Component */}
190169
<CheckInModal opened={qrModalOpened} onClose={closeQrModal} />
191170

192171
<Stack gap="lg">
@@ -196,7 +175,6 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
196175
<Text c="dimmed" size="sm">Manage your personal information and preferences</Text>
197176
</Box>
198177

199-
{/* 3. Header Actions (Edit & QR) */}
200178
{!isEditing && profile && (
201179
<Group gap="xs">
202180
<Button
@@ -242,7 +220,6 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
242220
<Stack gap="md">
243221
{isEditing ? (
244222
<>
245-
{/* ... (Keep existing Editing Form JSX exactly as is) ... */}
246223
<Select
247224
label={<Group gap="xs"><IconSchool size={16} /><Text size="sm" fw={500}>School Year</Text></Group>}
248225
placeholder="Select your year"
@@ -308,7 +285,6 @@ export function MyProfileView({ getProfile, updateProfile, isFirstTime }: MyProf
308285
</>
309286
) : (
310287
<>
311-
{/* ... (Keep existing View Mode JSX exactly as is) ... */}
312288
<Box>
313289
<Group gap="xs" mb={4}>
314290
<IconSchool size={16} stroke={1.5} />

src/pages/rsvps/MyRsvps.page.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export function MyRsvpsPage() {
2121
const token = await getToken();
2222
if (!token) throw new Error("Unable to authenticate.");
2323

24-
// Fetch RSVPs and events in parallel
2524
const [rsvpRes, eventsRes] = await Promise.all([
2625
fetch(config.apiBaseUrl + '/api/v1/rsvp/me', {
2726
headers: {
@@ -78,7 +77,7 @@ export function MyRsvpsPage() {
7877
}).sort((a, b) => {
7978
const dateA = a.startTime ? new Date(a.startTime).getTime() : 0;
8079
const dateB = b.startTime ? new Date(b.startTime).getTime() : 0;
81-
return dateB - dateA; // Most recent/upcoming first
80+
return dateB - dateA;
8281
});
8382
},
8483
CacheTTL.MEDIUM
@@ -104,7 +103,6 @@ export function MyRsvpsPage() {
104103
if (!response.ok) {
105104
const txt = await response.text();
106105

107-
// Handle specific error cases
108106
if (response.status === 404) {
109107
throw new Error('RSVP not found. It may have already been cancelled.');
110108
}
@@ -116,9 +114,8 @@ export function MyRsvpsPage() {
116114
throw new Error(txt || 'Failed to cancel RSVP');
117115
}
118116

119-
// Invalidate caches after successful cancellation
120117
apiCache.invalidate('rsvps:my');
121-
apiCache.invalidate('events:upcoming'); // Event capacity may have changed
118+
apiCache.invalidate('events:upcoming');
122119
}, [getToken]);
123120

124121
return (

0 commit comments

Comments
 (0)