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] Uperting profiles to Supabase for onboarding #12

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kevin3656
Copy link

What's new in this PR 🧑‍🌾

Description

Added 3 onboarding questions on one page, updates profile and sends to supa base accordingly. The questions added update a profiles state, user_type and has_plot. Removed folders for individual pages in onboarding from previous pr but kept styles.ts.

Screenshots

How to review

checkout supabase/queries/profile.ts for supabase profile upserting and app/onboarding/page.tsx for the unstyled frontend. Run app and go to /onboarding and go through the questions, after pressing submit it should appear on supabase.

Next steps

Adding more functions to the profile query, styling

Relevant links

Online sources

Related PRs

CC: @ccatherinetan

import { upsertProfile } from '@/api/supabase/queries/profiles';
import { Profile } from '@/types/schema';

type UUID = `${string}-${string}-${string}-${string}-${string}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we can import the UUID type!
import type { UUID } from 'crypto';

}) => {
return (
<div>
<h2>Which state do you live in?</h2>
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will probably be a radio button as well eventually, but this is all right for now!

Comment on lines 139 to 141
} finally {
}
console.log('Submitted data: ', profile);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is good for testing, but we can remove this eventually. we can leave it for now, but can we add a comment like "TODO: Remove the console log"?

};
try {
const updatedProfile = await upsertProfile(profile);
console.log('Profile successfully upserted:', updatedProfile);
Copy link
Collaborator

Choose a reason for hiding this comment

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

same thing about removing the console log eventually. let's remove this line

Copy link
Collaborator

@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.

looking great so far kevin! main things are

  1. import UUID from crypto
  2. remove the email and phone_num fields from the Profile type
  3. throw errors and remove/comment out console.log's
  4. we may want to hardcode the user_id to an id of an existing auth user for now.

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.

Implement Unstyled One-page Onboarding Flow + Update Profiles Table
2 participants