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

Dashboard fix #65

Merged
merged 11 commits into from
Nov 15, 2023
Merged

Dashboard fix #65

merged 11 commits into from
Nov 15, 2023

Conversation

Josephine0110
Copy link
Collaborator

@Josephine0110 Josephine0110 commented Nov 13, 2023

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.

Screenshot 2023-11-15 at 10 42 37 AM

Copy link

vercel bot commented Nov 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bookem-user ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2023 8:13pm

@@ -93,6 +93,18 @@ export const formatBirthday = (value: string) => {
)}`;
};

/**
Copy link
Collaborator

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

Copy link
Collaborator

@JiashuHarryHuang JiashuHarryHuang left a 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';
Copy link
Collaborator

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';
Copy link
Collaborator

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 }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid using "any" type

@JiashuHarryHuang JiashuHarryHuang merged commit e59e4cd into main Nov 15, 2023
6 checks passed
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.

2 participants