Skip to content

Commit a4bd62a

Browse files
author
Ema
committed
fix for back button and remove interest suggestions
1 parent 9319af0 commit a4bd62a

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

src/components/OrbitSystem.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useState, useEffect } from 'react';
2+
import { useNavigate } from 'react-router';
23
import { Heart } from 'lucide-react';
34
import { mockAliens } from '../data/mockAliens';
45
import type { AlienProfile } from '../data/mockAliens';
@@ -12,6 +13,7 @@ import { getScientificWarnings } from '../utils/scienceWarnings';
1213
export default function OrbitSystem() {
1314

1415
const { preferences, addMatch, matches } = useAppContext();
16+
const navigate = useNavigate();
1517
const triggerRocketNav = useRocketNav();
1618
const [selectedAlien, setSelectedAlien] = useState<AlienProfile | null>(null);
1719
const [dismissedIds, setDismissedIds] = useState<Set<string>>(new Set());
@@ -330,7 +332,13 @@ export default function OrbitSystem() {
330332
<button
331333
onClick={() => { window.location.href = '/preferences'; }}
332334
className="btn-outline"
333-
style={{ marginTop: '8px', padding: '12px 40px', fontSize: '1rem', fontWeight: 'bold', cursor: 'pointer' }}
335+
style={{
336+
marginTop: '8px',
337+
padding: '12px 40px',
338+
fontSize: '1rem',
339+
fontWeight: 'bold',
340+
cursor: 'pointer'
341+
}}
334342
>
335343
Back
336344
</button>

src/context/AppContext.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createContext, useState, useContext } from 'react';
1+
import { createContext, useState, useContext, useEffect } from 'react';
22
import type { ReactNode } from 'react';
33
import type { AlienProfile } from '../data/mockAliens';
44

@@ -27,8 +27,24 @@ interface AppContextType {
2727
export const AppContext = createContext<AppContextType | undefined>(undefined);
2828

2929
export const AppProvider = ({ children }: { children: ReactNode }) => {
30-
const [preferences, setPreferencesState] = useState<UserPreferences | null>(null);
31-
const [matches, setMatches] = useState<AlienProfile[]>([]);
30+
const [preferences, setPreferencesState] = useState<UserPreferences | null>(() => {
31+
const saved = localStorage.getItem('aligned_preferences');
32+
return saved ? JSON.parse(saved) : null;
33+
});
34+
const [matches, setMatches] = useState<AlienProfile[]>(() => {
35+
const saved = localStorage.getItem('aligned_matches');
36+
return saved ? JSON.parse(saved) : [];
37+
});
38+
39+
useEffect(() => {
40+
if (preferences) {
41+
localStorage.setItem('aligned_preferences', JSON.stringify(preferences));
42+
}
43+
}, [preferences]);
44+
45+
useEffect(() => {
46+
localStorage.setItem('aligned_matches', JSON.stringify(matches));
47+
}, [matches]);
3248

3349
const setPreferences = (prefs: UserPreferences) => {
3450
setPreferencesState(prefs);

src/pages/Signup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function Signup() {
2727
goals: preferences?.goals || 'Long term fusion',
2828
});
2929
const [interestInput, setInterestInput] = useState('');
30-
const interestSuggestions = ['Stargazing', 'Volcano Diving', 'Heavy Metal (Literally)', 'Asteroid Mining'];
30+
const interestSuggestions: any[] = [];
3131

3232
const handleSubmit = (e: React.FormEvent) => {
3333
e.preventDefault();

0 commit comments

Comments
 (0)