-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] introduces simple onboarding form (#16)
* adds queries to profile table in supabase * adds create profile page * responds to feedback * reruns npm install * makes edits to create profile page --------- Co-authored-by: Pragya Kallanagoudar <[email protected]>
- Loading branch information
Showing
3 changed files
with
86 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use client'; | ||
|
||
import { UUID } from 'crypto'; | ||
import { useState } from 'react'; | ||
import { insertProfile } from '../../api/supabase/queries/profiles'; | ||
import { Profile } from '../../types/schema'; | ||
import styles from '../page.module.css'; | ||
|
||
export default function Profile() { | ||
const [firstName, setFirstName] = useState<string>(''); | ||
const [lastName, setLastName] = useState<string>(''); | ||
|
||
const handleInsert = async () => { | ||
if (!firstName || !lastName) return; | ||
const newProfile: Profile = { | ||
// hardcoded values for now | ||
location: 'Berkeley, CA', | ||
user_id: crypto.randomUUID() as UUID, | ||
roles: ['blah'], | ||
languages: ['blah', 'blah'], | ||
hours_per_month: 40, | ||
immigration_law_experience: '5 years', | ||
bar_number: '12345', | ||
start_date: new Date().toDateString(), | ||
interest_ids: [crypto.randomUUID()] as UUID[], | ||
availability_description: 'blah blah blah', | ||
eoir_registered: false, | ||
first_name: firstName, | ||
last_name: lastName, | ||
}; | ||
await insertProfile(newProfile); | ||
setFirstName(''); | ||
setLastName(''); | ||
}; | ||
|
||
return ( | ||
<main className={styles.main}> | ||
<div className={styles.description}>Create Profile Form</div> | ||
<form> | ||
<div> | ||
<label htmlFor="firstName"> | ||
First Name: | ||
<input | ||
type="text" | ||
name="firstName" | ||
required | ||
value={firstName} | ||
onChange={event => setFirstName(event.target.value)} | ||
/> | ||
</label> | ||
</div> | ||
<div> | ||
<label htmlFor="lastName"> | ||
Last Name: | ||
<input | ||
type="text" | ||
name="lastName" | ||
required | ||
value={lastName} | ||
onChange={event => setLastName(event.target.value)} | ||
/> | ||
</label> | ||
</div> | ||
<button type="button" onClick={handleInsert}> | ||
Submit | ||
</button> | ||
</form> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters