Skip to content

Commit 0e16fbc

Browse files
committed
Updated sign up page
1 parent 42e8f7d commit 0e16fbc

4 files changed

Lines changed: 86 additions & 11 deletions

File tree

src/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Routes, Route, Link, useLocation } from 'react-router';
22
import Signup from './pages/Signup';
33
import Preferences from './pages/Preferences';
44
import Home from './pages/home/Home';
5-
import Signup from './pages/Signup';
65
import Explore from './pages/Explore';
76
import Chat from './pages/Chat';
87
import { Rocket } from 'lucide-react';
@@ -19,7 +18,7 @@ function App() {
1918
<Rocket className="inline-block mr-2" size={24} style={{ verticalAlign: 'text-bottom', color: 'var(--color-secondary)' }} />
2019
SSTRUK
2120
</Link>
22-
{!isHomePage && (
21+
{!hideExploreLink && (
2322
<div style={{ display: 'flex', gap: '16px' }}>
2423
<Link to="/explore" className="btn-outline" style={{ padding: '6px 16px', fontSize: '0.9rem' }}>Explore</Link>
2524
</div>
@@ -28,10 +27,9 @@ function App() {
2827

2928
<main className="main-content">
3029
<Routes>
31-
<Route path="/" element={<Signup />} />
32-
<Route path="/preferences" element={<Preferences />} />
3330
<Route path="/" element={<Home />} />
3431
<Route path="/signup" element={<Signup />} />
32+
<Route path="/preferences" element={<Preferences />} />
3533
<Route path="/explore" element={<Explore />} />
3634
<Route path="/chat/:id" element={<Chat />} />
3735
</Routes>

src/context/AppContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface UserPreferences {
77
species: string;
88
planet: string;
99
bio: string;
10+
interests: string[];
1011
limbs: number;
1112
alienType: string;
1213
size: string;

src/pages/Preferences.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function Preferences() {
4646
<h3 style={{ color: 'var(--color-secondary)', marginBottom: '16px', fontSize: '1.2rem', borderBottom: '1px solid rgba(255,255,255,0.1)', paddingBottom: '8px' }}>Biological Preferences</h3>
4747

4848
<div style={{ marginBottom: '16px' }}>
49-
<label style={{ display: 'block', marginBottom: '8px', fontSize: '0.9rem' }}>Preferred Species</label>
49+
<label style={{ display: 'block', marginBottom: '8px', fontSize: '0.9rem' }}>Preferred Biological Type</label>
5050
<select name="alienType" value={formData.alienType} onChange={handleChange}>
5151
<option value="Human">Human</option>
5252
<option value="Alien">Alien</option>

src/pages/Signup.tsx

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default function Signup() {
1717
species: preferences?.species || 'Human',
1818
planet: preferences?.planet || '',
1919
bio: preferences?.bio || '',
20+
interests: preferences?.interests || [],
2021
profilePic: preferences?.profilePic || '',
2122
// Default preferences for now, will be updated on the next page
2223
limbs: preferences?.limbs || 4,
@@ -25,6 +26,8 @@ export default function Signup() {
2526
maxDistanceAU: preferences?.maxDistanceAU || 10,
2627
goals: preferences?.goals || 'Long term fusion',
2728
});
29+
const [interestInput, setInterestInput] = useState('');
30+
const interestSuggestions = ['Stargazing', 'Volcano Diving', 'Heavy Metal (Literally)', 'Asteroid Mining'];
2831

2932
const handleSubmit = (e: React.FormEvent) => {
3033
e.preventDefault();
@@ -40,6 +43,30 @@ export default function Signup() {
4043
}));
4144
};
4245

46+
const addInterest = (value: string) => {
47+
const trimmed = value.trim();
48+
if (!trimmed || formData.interests.includes(trimmed) || formData.interests.length >= 3) return;
49+
setFormData(prev => ({
50+
...prev,
51+
interests: [...prev.interests, trimmed]
52+
}));
53+
setInterestInput('');
54+
};
55+
56+
const removeInterest = (value: string) => {
57+
setFormData(prev => ({
58+
...prev,
59+
interests: prev.interests.filter(item => item !== value)
60+
}));
61+
};
62+
63+
const handleInterestKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
64+
if (e.key === 'Enter') {
65+
e.preventDefault();
66+
addInterest(interestInput);
67+
}
68+
};
69+
4370
const handlePhotoClick = () => {
4471
// Only open the file dialog if we don't already have a photo,
4572
// or if they click the overlay. (Actually, clicking the overlay could mean changing photo)
@@ -170,12 +197,7 @@ export default function Signup() {
170197
</div>
171198
<div>
172199
<label style={{ display: 'block', marginBottom: '8px', fontSize: '0.9rem' }}>Species:</label>
173-
<select name="species" value={formData.species} onChange={handleChange}>
174-
<option value="Human">Human</option>
175-
<option value="Alien">Alien</option>
176-
<option value="Hybrid">Hybrid</option>
177-
<option value="Open to all">Open to all</option>
178-
</select>
200+
<input type="text" name="species" value={formData.species} onChange={handleChange} placeholder="Type your species" />
179201
</div>
180202
</div>
181203

@@ -203,6 +225,60 @@ export default function Signup() {
203225
}}
204226
/>
205227
</div>
228+
229+
<div>
230+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '8px' }}>
231+
<label style={{ fontSize: '0.9rem' }}>Interests:</label>
232+
<span style={{ fontSize: '0.8rem', color: 'rgba(234, 222, 218, 0.7)' }}>Up to 3</span>
233+
</div>
234+
<input
235+
type="text"
236+
value={interestInput}
237+
onChange={e => setInterestInput(e.target.value)}
238+
onKeyDown={handleInterestKeyDown}
239+
placeholder="Type an interest and press Enter"
240+
/>
241+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '8px', margin: '12px 0' }}>
242+
{formData.interests.map(interest => (
243+
<button
244+
type="button"
245+
key={interest}
246+
onClick={() => removeInterest(interest)}
247+
style={{
248+
padding: '8px 12px',
249+
borderRadius: '999px',
250+
border: '1px solid rgba(255,255,255,0.2)',
251+
background: 'rgba(255,255,255,0.08)',
252+
color: 'white',
253+
cursor: 'pointer'
254+
}}
255+
>
256+
{interest} ×
257+
</button>
258+
))}
259+
</div>
260+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '8px' }}>
261+
{interestSuggestions
262+
.filter(suggestion => !formData.interests.includes(suggestion))
263+
.map(suggestion => (
264+
<button
265+
type="button"
266+
key={suggestion}
267+
onClick={() => addInterest(suggestion)}
268+
style={{
269+
padding: '8px 12px',
270+
borderRadius: '999px',
271+
border: '1px solid rgba(255,255,255,0.2)',
272+
background: 'rgba(255,255,255,0.05)',
273+
color: 'rgba(234, 222, 218, 0.9)',
274+
cursor: 'pointer'
275+
}}
276+
>
277+
{suggestion}
278+
</button>
279+
))}
280+
</div>
281+
</div>
206282

207283
<div style={{ marginTop: '16px' }}>
208284
<button type="submit" className="btn-primary" style={{ width: '100%' }}>Next</button>

0 commit comments

Comments
 (0)