Skip to content

Commit

Permalink
Displaying mock user data in frontend hacker dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
ashrithathmaram committed Jan 11, 2024
1 parent 9bc577c commit 0c4d73f
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
"use client"

import AcmeLogo from '@/app/ui/acme-logo';
import LoginForm from '@/app/ui/login-form';
import { getSelf } from '@/app/lib/data.ts';

Check failure on line 5 in app/dashboard/page.tsx

View workflow job for this annotation

GitHub Actions / build (20)

An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.
import { useState, useEffect } from 'react';

export default function Dashboard() {

const [userData, setUserData] = useState<any>(null)

useEffect(() => {
async function fetchUser() {
try {
const data = await getSelf();
setUserData(data);
// setLoading(false);
} catch (error) {
console.log(error);
// setLoading(false);
}
}

fetchUser();
}, [])

return (
<main className="flex items-center justify-center md:h-screen">
<div className="relative mx-auto flex w-full max-w-[500px] flex-col space-y-2.5 p-4 md:-mt-32">
{!userData ? <div>Loading...</div> :
<>
<h1>Personal Info of {userData.first_name} {userData.last_name}:</h1>
<p>Role: {Object.keys(userData.role).find(key => userData.role[key])}</p>
<p>Email: {userData.email}</p>
<p>Github: {userData.github}</p>
<p>Major: {userData.major}</p>
<p>Short Answer: {userData.short_answer}</p>
<p>Shirt Size: {userData.shirt_size}</p>
<p>Dietary Restrictions: {userData.dietary_restrictions}</p>
<p>Special Needs: {userData.special_needs}</p>
<p>Date of Birth: {userData.date_of_birth}</p>
<p>School: {userData.school}</p>
<p>Grad Year: {userData.grad_year}</p>
<p>Gender: {userData.gender}</p>
<p>Registration Status: {userData.registration_status}</p>
<p>Level of study: {userData.level_of_study}</p>
<p>Country of Residence: {userData.country_of_residence}</p>
<p>Ethnicity: {userData.ethnicity}</p>
<p>Hackathon Count: {userData.hackathon_count}</p>
<p>Phone #: {userData.phone_number}</p>
<p>How you heard about hackru: {userData.how_you_heard_about_hackru}</p>
<p>Reasons: {userData.reasons}</p>
</>
}
</div>
</main>
);
}

0 comments on commit 0c4d73f

Please sign in to comment.