Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] introduces simple onboarding form #16

Merged
merged 5 commits into from
Oct 24, 2023

Conversation

rahihazra
Copy link
Contributor

🎋 Description

This PR creates a simple "create profile" form, that takes first/last names and then inserts a corresponding profile row to the profiles table in supabase.

🌴 What's new in this PR

  • header: "Create Profile Form"
  • two text boxes: "First Name:" and "Last Name:"
  • mock data for the rest of the profile fields are inputted into the supabase table
  • after clicking submit, the text boxes clear and are ready to take in new inputs

🌲 Screenshots

Screen Shot 2023-10-10 at 3 01 39 PM

🌳 How to review

  • there is only 1 file to review: src/app/profile/page.tsx
  • go to the localhost page thingy, and there should be a heading that says "Create Profile Form"
  • there should be 2 text boxes with "First Name:" and "Last Name:" in front of them
  • you should be able to input values for both, and once you click submit, the text boxes should be cleared
  • once you have clicked submit, to make sure the values were inputted into the profiles table, go to supabase and look for a bunch of "blahs" for many of the row values, in addition to the first and last name you manually entered

🌱 Next steps

We're going to need to expand this form to take in more values for the other attributes of the user profile, and it will also obviously need formatting and styling.

🔗 Relevant Links

ℹ️ Online sources

🪴 Related PRs

CC: @pragyakallanagoudar

@linear
Copy link

linear bot commented Oct 10, 2023

IJP-19 Simple create profile form.

Routes:

/app/create-profile (src/app/create-profile/page.tsx)

/api/supabase/queries (src/api/supabase/queries)

Task:

Create a simple, unstyled form to create a new profile. Include text entry boxes for just the following profile attributes:

  • first_name
  • last_name

IJP-29 is complete, so the name should now be part of the profile schema. Make sure you pull the latest main branch and work off of that (let me know if you need support with this!)

(The way the other attributes will be handled is pending more information from Ambreen, so we will not write any code for that right now.)

Generate a random user_id for the new profile, and hardcode all of the other attributes to whatever you want.

Add a submit button at the bottom. When the button is pressed, call the method you wrote in /api/supabase/queries to add the new user profile to the profiles table.

@pragyakallanagoudar pragyakallanagoudar changed the title adds queries to profile table in supabase [feat] introduces simple onboarding form Oct 11, 2023
@ccatherinetan ccatherinetan self-assigned this Oct 12, 2023
@@ -40,6 +40,8 @@ export default function Page() {
await updateProfile(mockProfile.user_id, {
hours_per_week: 100, // Update the roles field with new data
});

console.log('test');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to delete all console.log's before merging!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ma'am yes ma'am

Copy link
Contributor

@ccatherinetan ccatherinetan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really good! The profile pages isn't working for me (which would be nice to fix), but create-profile is working! Just make sure that we're requiring them to input both first and last name (see comment) :)

src/app/profile/page.tsx Show resolved Hide resolved
@@ -51,18 +53,17 @@ export default function Page() {
{profiles.map(profile => (
<li key={profile.user_id}>
<h2>Profile ID: {profile.user_id}</h2>
<p>First Name: {profile.first_name}</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I ask what this function does, and why we are deleting the First Name and Last Name?
Is it because we're now collecting First and Last Name in the Create Profile page?

const [lastName, setLastName] = useState<string>('');

const handleInsert = async () => {
if (!firstName && !lastName) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we allowing users to not input a first name or a last name? This line allows user to have either first or last (rather than requiring them to have both). Change to !firstName || !lastName if we want to require both first and last?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh such good feedback THANKS!!

@@ -40,6 +40,8 @@ export default function Page() {
await updateProfile(mockProfile.user_id, {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github is not letting me comment on the actual line lol but can we comment out line 38, i.e.

await insertProfile(mockProfile);

as part of this PR?

cc @jinkang-0 on this thread

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes ma'am

@jinkang-0
Copy link
Contributor

I resolved the merge conflict with package-lock.json (even though it's literally all incoming changes..)
@rahihazra make sure you delete package-lock.json on your computer then git pull this branch (git pull origin rahi/ijp-19...) so it avoids the merge conflicts!

@davidqing6432
Copy link
Contributor

Looking great rahi!!! great work!

@rahihazra rahihazra force-pushed the rahihazra/ijp-19-simple-create-profile-form branch from d368c48 to 80d9fa4 Compare October 24, 2023 21:35
@pragyakallanagoudar pragyakallanagoudar merged commit 1988eac into main Oct 24, 2023
2 checks passed
@pragyakallanagoudar pragyakallanagoudar deleted the rahihazra/ijp-19-simple-create-profile-form branch October 30, 2023 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants