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

Feature/ia tickets 27 72 user preferences #92

Merged
merged 27 commits into from
Sep 7, 2022

Conversation

ialej001
Copy link
Contributor

@ialej001 ialej001 commented Sep 6, 2022

Please advise:

You need to run npm install in order for the prisma schema on your machine to update properly. If you do not do this, you'll get some errors related to unknown fields.

A big one for y'all!

Features:

  • Added user ability to configure their preferences
    • Location info (country is mandatory, state is optional)
    • Unit preference between metric and imperial
    • Feedback given through the change of the button:
      • Green button with checkmark on successful save
      • Blue button all other times. Will revert back to blue on any field change.
  • Vehicle controls:
    • Can save cars using a similar style form to the travel/driving calculator from within a modal
    • Can remove a saved car via a pop-up modal
      • If a car to be removed is the primary selected (and saved) car, it will clear that id field in the DB
    • Able to select the primary car once a car has been saved
    • Renders a message when there are no saved cars

There are also some non related fixes in here that I did not want to split out:

  • Account level layout
    • This includes a ControlPanel component that has three buttons that route to different /account pages
    • This gives the /account route and all subsequent routes the same layout, offering consistency
  • Assorted images that were broken by file name changes in other PRs are now fixed

Closes #27 #72

Copy link
Contributor

@TiciaD TiciaD left a comment

Choose a reason for hiding this comment

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

On top of the Spinner issue, I'm getting an error when I try to add a Vehicle:

Something went wrong Error: 
[0] Invalid `prisma.user.findFirst()` invocation:
[0] 
[0] {
[0]   select: {
[0]     primaryVehicleId: true,
[0]     ~~~~~~~~~~~~~~~~
[0] ?   id?: true,
[0] ?   name?: true,
[0] ?   email?: true,
[0] ?   emailVerified?: true,
[0] ?   image?: true,
[0] ?   country?: true,
[0] ?   state?: true,
[0] ?   unitPref?: true,
[0] ?   accounts?: true,
[0] ?   sessions?: true,
[0] ?   vehicles?: true,
[0] ?   electricityUse?: true,
[0] ?   fuelUsed?: true,
[0] ?   flights?: true,
[0] ?   _count?: true
[0]   },
[0]   where: {
[0]     id: 'cl7qvrlab0006vem3xs1lqowx'
[0]   }
[0] }
[0] 
[0] 
[0] Unknown field `primaryVehicleId` for select statement on model User. Available options are listed in green.

src/pages/account/preferences.tsx Show resolved Hide resolved
@TiciaD
Copy link
Contributor

TiciaD commented Sep 7, 2022

On top of the Spinner issue, I'm getting an error when I try to add a Vehicle:

Something went wrong Error: 
[0] Invalid `prisma.user.findFirst()` invocation:
[0] 
[0] {
[0]   select: {
[0]     primaryVehicleId: true,
[0]     ~~~~~~~~~~~~~~~~
[0] ?   id?: true,
[0] ?   name?: true,
[0] ?   email?: true,
[0] ?   emailVerified?: true,
[0] ?   image?: true,
[0] ?   country?: true,
[0] ?   state?: true,
[0] ?   unitPref?: true,
[0] ?   accounts?: true,
[0] ?   sessions?: true,
[0] ?   vehicles?: true,
[0] ?   electricityUse?: true,
[0] ?   fuelUsed?: true,
[0] ?   flights?: true,
[0] ?   _count?: true
[0]   },
[0]   where: {
[0]     id: 'cl7qvrlab0006vem3xs1lqowx'
[0]   }
[0] }
[0] 
[0] 
[0] Unknown field `primaryVehicleId` for select statement on model User. Available options are listed in green.

SOLVED: Ivan pair programmed with me, since some changes were made to the schema, I had to run npm install again to get it to update the database properly and it worked fine. Leaving this comment here in case anyone runs into the same error I did!

Copy link
Contributor

@TiciaD TiciaD left a comment

Choose a reason for hiding this comment

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

Thanks for adding that Toast for user feedback, I think it helps the UX a little more, approved!

@ialej001 ialej001 merged commit 1c90936 into development Sep 7, 2022
@ialej001 ialej001 deleted the feature/ia-tickets-27-72-user-preferences branch September 7, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants