@@ -12,29 +12,14 @@ import {
1212 IconSchool , IconStar , IconApple , IconQrcode
1313} from '@tabler/icons-react' ;
1414import { config } from '../../config' ;
15- import { RsvpProfile } from '../../common/types/rsvp' ;
15+ import { RsvpProfile , SCHOOL_YEARS , MAJORS , COMMON_INTERESTS } from '../../common/types/rsvp' ;
1616import { CheckInModal } from '../../components/ProfileQR' ;
1717
1818interface 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-
3823const 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 } />
0 commit comments