-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dashboard fix #65
Dashboard fix #65
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -93,6 +93,18 @@ export const formatBirthday = (value: string) => { | |||
)}`; | |||
}; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this to util module since it's a good helper function to reuse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I help you refactor the code a little. Please take a look at the changes and comments. Nice work!
@@ -0,0 +1,19 @@ | |||
import { fetchData } from '@/utils/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a custom hook to avoid duplicate code.
@@ -1,13 +1,18 @@ | |||
import React from 'react'; | |||
import Image from 'next/image'; | |||
import { useEffect, useState } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only need username here so using session data would be enough
@@ -27,48 +30,58 @@ import { | |||
* dollarsDonated: number; | |||
* } | |||
*/ | |||
const MainDashboard = ({ userData }: any) => { | |||
const MainDashboard = ({ userData }: { userData: QueriedUserData | null }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using "any" type
Replaced the hard coded user information on main dashboard to real user data.
Modified
index.tsx
to fetch user data from mongodb by callingindex.ts
.Modified
userIcon.tsx
to match the user name with the fetched user data.Changed the information displayed on home. Modified
MainDashboard.tsx
to show the user's events volunteered and date joined.Make the infoIcon on home page clickable. Modified
MainDashboard.tsx
's content inside InfoIcon.