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

Folasade/imp 19 profile tab #31

Closed
wants to merge 14 commits into from
Closed

Conversation

foloye
Copy link
Contributor

@foloye foloye commented Nov 6, 2023

What's new in this PR

Description

In the settings tab, a user can edit their name, address, and/or delete their account. Updated auth functions to not use public users table.

Screenshots

How to review

In order to review delete account, a review MUST ADD SUPABASE_SERVICE_KEY variable to .env file. Be sure to Not
name it NEXT_PUBLIC_SUPABASE_SERVICE_KEY. Service key can be obtained by going into impact fund's supabase settings.

To test edit name and edit address, a user can log into an account then change input forms to whatever new name/address is desired and click button. To see changes use the SQL editor in supabase to look at the auth.users table, specifically the raw_user_meta_data column.

To test delete account, make sure logged into non-essential dummy account, and click yes when prompted if wanted to delete account.

Next steps

Front end for this tab still needs to be done.

Relevant Links

Online sources

Related PRs

CC: @stephaniewong2

Copy link

linear bot commented Nov 6, 2023

IMP-19 Profile Tab Queries

Description

Build out the Profile/Settings tab with the following functionality:

  • Sign out: Sign Out should redirect to the Welcome Screen, which should not require any new logic
  • Edit Account: A user should be able to edit their account information here, including email, password, and mailing address. Once this information is updated, the user should be able to stay in the app as normal.
  • Change Password: This might be under edit account, though a separate query would be necessary here. Follow Supabase Auth here!
  • Delete Account: After confirmation, the user's account should be deleted and they should be redirected to the Welcome Screen, similar to Sign Out

Start by writing the queries for the three above and build out the screens/frontend after (I will add screenshots once Figma is updated!)

Useful Links

Related PRs

Copy link
Collaborator

@stephaniewong2 stephaniewong2 left a comment

Choose a reason for hiding this comment

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

Nice!! Functionality is completely there!

src/supabase/queries/auth.ts Show resolved Hide resolved
src/supabase/queries/auth.ts Outdated Show resolved Hide resolved
src/supabase/queries/auth.ts Outdated Show resolved Hide resolved
src/supabase/queries/auth.ts Show resolved Hide resolved
src/app/(BottomTabNavigation)/Profile/EditName/index.tsx Outdated Show resolved Hide resolved
src/app/(BottomTabNavigation)/Profile/EditName/index.tsx Outdated Show resolved Hide resolved
src/app/(BottomTabNavigation)/Profile/EditName/index.tsx Outdated Show resolved Hide resolved
src/app/(BottomTabNavigation)/Profile/EditName/index.tsx Outdated Show resolved Hide resolved
@foloye foloye force-pushed the folasade/imp-19-profile-tab branch from 83dd09a to 0b9f7f5 Compare November 9, 2023 06:06
ronniebeggs and others added 5 commits November 13, 2023 15:44
* [feat] build base layout.

* [feat] style component with hardcoded data.

* [feat] conditional render case data; fix styling.

* [feat] add navigation to CaseSummaryScreen page.

* [feat] pass case data into case summary screen.

* [style] section off information by type.

* [style] continue styling to match figma.

* [wip][feat] implement base external link component.

* [feat] add routing to link within external browser.

* [feat] add header component with impact fund logo to all Cases related screens.

* [cleanup] final cleanup before PR.

* [fix] fix rendering issue on the bottom of CaseSummaryScreen.

* [feat] implement date format util.

* [style] restyle sub text to better reflect figma designs.

* [feat] build base layout.

* [feat] style component with hardcoded data.

* [feat] conditional render case data; fix styling.

* [feat] add navigation to CaseSummaryScreen page.

* [feat] pass case data into case summary screen.

* [style] section off information by type.

* [style] continue styling to match figma.

* [wip][feat] implement base external link component.

* [feat] add routing to link within external browser.

* [feat] add header component with impact fund logo to all Cases related screens.

* [cleanup] final cleanup before PR.

* [fix] fix rendering issue on the bottom of CaseSummaryScreen.

* [feat] implement date format util.

* [style] restyle sub text to better reflect figma designs.

* [style] change div dimensions to percentages/aspect ratios.

* [style] implement global colors.

* [style] final styling changes + shadows.

* [fix] prevent eslint error.

* [style] replace react icons with svgs.

* [refactor] restructure image fetch from supabase storage; redo typing case-related data.

* [wip]

* [cleanup] minor query refactoring and style fixes.

* [style] setup scroll view container for CaseScreen.

* [cleanup] fix styling.
 yes
Copy link
Collaborator

@stephaniewong2 stephaniewong2 left a comment

Choose a reason for hiding this comment

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

SO GOOD SO CLEAN!! Let's just update anything that uses address to the different address fields instead of one full address!

src/supabase/queries/auth.ts Show resolved Hide resolved
src/supabase/queries/auth.ts Outdated Show resolved Hide resolved
src/types/types.tsx Outdated Show resolved Hide resolved
src/types/types.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@stephaniewong2 stephaniewong2 left a comment

Choose a reason for hiding this comment

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

Small bugs :(( will do some exploring but besides that looks good!

<TouchableOpacity
style={styles.button}
onPress={() => {
if (fullName) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This if statement is reached every time because fullName always has the user's name since we fetch it and set it at the start. I don't know how big of an issue it would be to run this query each time or if this would change with AuthContext but if you think running the query each time is okay, let's remove the if-else and just run both every time since that is what it is currently doing. Context: tested by logging inside if statement and reached even when name was not changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is something that's probably best to fix after auth context is implemented as it will be easier/less power to check if the name changed at all. But I agree that it's not the best to query each time and I need to fix.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay let's just address this when we implement Auth Context then

onPress={() => {
if (fullName) {
updateCurrUserName(fullName);
router.push('/Profile/');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Weird bug but whenever I click Update Name, I am redirected to the Cases screen with all the Case Cards instead of the Profile screen. Tried changing to /Profile but that did not do anything :(

<TouchableOpacity
style={styles.button}
onPress={() => {
if (streetName && city && usState && zip) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comments as above for Edit Name!

@@ -1,3 +1,5 @@
import { User } from '../../types/types';
import supabaseAdmin from '../createAdminClient';
import supabase from '../createClient';

export const signUpUser = async (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's update the signUpUser function to add address fields to the auth table rather than full address

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comments addressed: changed signupuser to full name and various address fields, router issue fixed, will focus on redundant querying after auth context implemented 💃

@foloye foloye force-pushed the folasade/imp-19-profile-tab branch from 5a19d81 to 1e33bcd Compare November 19, 2023 22:54
@stephaniewong2 stephaniewong2 deleted the folasade/imp-19-profile-tab branch November 21, 2023 21:12
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.

3 participants