This commit is contained in:
MartinBraquet
2025-07-31 12:19:36 +02:00
parent 1a5bb39b54
commit bc03086159
6 changed files with 57 additions and 12 deletions

View File

@@ -23,6 +23,7 @@ function RegisterComponent() {
const [contactInfo, setContactInfo] = useState('');
const [location, setLocation] = useState('');
const [gender, setGender] = useState('');
const [age, setAge] = useState(0);
const [personalityType, setPersonalityType] = useState('');
const [conflictStyle, setConflictStyle] = useState('');
const [image, setImage] = useState<string | null>(null);
@@ -59,6 +60,9 @@ function RegisterComponent() {
setGender(profile.gender || '');
setPersonalityType(profile.personalityType || null);
setConflictStyle(profile.conflictStyle || '');
if (profile.birthYear) {
setAge(new Date().getFullYear() - profile.birthYear);
}
await parseImage(profile.image, setImage);
// Set selected interests if any
@@ -356,6 +360,21 @@ function RegisterComponent() {
</select>
</div>
<div>
<label htmlFor="age" className={headingStyle}>
Age
</label>
<input
id="age"
name="age"
type="number"
value={age}
onChange={(e) => setAge(e.target.value)}
className="appearance-none rounded-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
// placeholder=""
/>
</div>
<div>
<label htmlFor="location" className={headingStyle}>
Location
@@ -365,6 +384,7 @@ function RegisterComponent() {
name="location"
type="text"
value={location}
maxLength="100"
onChange={(e) => setLocation(e.target.value)}
className="appearance-none rounded-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
placeholder="City, Country"
@@ -421,6 +441,7 @@ function RegisterComponent() {
<input
type="text"
value={newInterest}
maxLength="100"
onChange={(e) => setNewInterest(e.target.value)}
onFocus={() => setShowDropdown(true)}
onKeyDown={handleKeyDown}
@@ -546,6 +567,7 @@ function RegisterComponent() {
rows={4}
// required
value={description}
maxLength="30000"
onChange={(e) => setDescription(e.target.value)}
className="appearance-none rounded-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
placeholder="Tell us about yourself, your background, and what you're looking for."
@@ -561,6 +583,7 @@ function RegisterComponent() {
name="contactInfo"
rows={2}
value={contactInfo}
maxLength="5000"
onChange={(e) => setContactInfo(e.target.value)}
className="appearance-none rounded-md relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
placeholder="How can people reach you? (Email, social media, phone, Google Forms, etc.)"

View File

@@ -162,6 +162,7 @@ function RegisterComponent() {
id="name"
name="name"
type="text"
maxLength={100}
required
className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 rounded-t-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
placeholder="Full name"

View File

@@ -81,6 +81,16 @@ export function getProfile(userData: ProfileData, image, header = null) {
)
}
{
userData?.profile?.birthYear && (
<div>
<h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Age </h2>
< p
className="mt-1 capitalize"> {new Date().getFullYear() - userData.profile.birthYear} </p>
</div>
)
}
{
userData?.profile?.location && (
<div>
@@ -204,12 +214,7 @@ export function getProfile(userData: ProfileData, image, header = null) {
key={idx}
// className="px-3 py-1 text-sm bg-gray-100 rounded-full hover:bg-gray-200 transition"
>
{
value.prompt
}
{
value.answer
}
{value.prompt} {value.answer}
</li>
))
}
@@ -218,6 +223,16 @@ export function getProfile(userData: ProfileData, image, header = null) {
)
}
{
userData?.profile?.images && (
<div>
<h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider"> Contact </h2>
< p
className={pStyle}> {userData.profile.images} </p> TODO
</div>
)
}
{/*<div>*/
}
{/* <h2 className="text-sm font-medium text-gray-500 uppercase tracking-wider">Creation Date</h2>*/

View File

@@ -5,6 +5,7 @@ export interface ProfileData {
profile: {
location: string;
gender: string;
birthYear: number;
occupation: string;
personalityType: string;
conflictStyle: string;
@@ -14,5 +15,6 @@ export interface ProfileData {
causeAreas: { causeArea?: { name?: string, id?: string } }[];
desiredConnections: { connection?: { name?: string, id?: string } }[];
promptAnswers: { prompt?: string; answer?: string, id?: string }[];
images: string[];
};
}

View File

@@ -35,15 +35,19 @@ model Profile {
location String? // Need to normalize later for geospatial
description String?
contactInfo String?
occupation String?
birthYear Int?
occupation String?
gender Gender?
personalityType PersonalityType?
conflictStyle ConflictStyle?
images String[]
// communicationPreferences CommunicationPreferences[]
promptAnswers PromptAnswer[] // See below (list of answers)
// Many-to-many
promptAnswers PromptAnswer[]
desiredConnections ProfileConnection[]
intellectualInterests ProfileInterest[] // Many-to-many (see below)
causeAreas ProfileCauseArea[] // Many-to-many (see below)
intellectualInterests ProfileInterest[]
causeAreas ProfileCauseArea[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
@@ -51,7 +55,6 @@ model Profile {
enum Gender {
Male
Female
NonBinary
Other
}

View File

@@ -106,10 +106,11 @@ async function main() {
data: {
email: `user${i + 1}@bayesbond.com`,
name: profile.name,
image: null,
image: 'profile-pictures/57a821c0-cda0-4797-8654-f54f26fed414.jpg',
profile: {
create: {
location: profile.location,
birthYear: 2025 - profile.age,
description: `[Dummy profile for demo purposes] ${profile.bio}`,
gender: i % 2 === 0 ? 'Male' : 'Female',
personalityType: i % 3 === 0 ? 'Extrovert' : 'Introvert',