Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #21 from Programming-Club-Ahmedabad-University/all…
Browse files Browse the repository at this point in the history
…/leaderboards-carousel

Pushing all the changes i made previously for a fresh start
  • Loading branch information
JeelRajodiya authored Oct 5, 2023
2 parents 2d46e6f + 807b736 commit d539ada
Show file tree
Hide file tree
Showing 19 changed files with 239 additions and 194 deletions.
288 changes: 120 additions & 168 deletions client/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"eslint-config-next": "13.4.16",
"framer-motion": "^10.16.0",
"mongodb": "^6.1.0",
"next": "13.4.16",
"next": "^13.5.4",
"next-auth": "^4.23.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
3 changes: 1 addition & 2 deletions client/pages/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// import "./globals.css";

import type { Metadata } from "next";
import { Inter } from "next/font/google";
import styles from "./Layout.module.css";
import NavBar from "./components/NavBar/NavBar";

const inter = Inter({ subsets: ["latin"] });
// for the fonts:

export const metadata: Metadata = {
title: "Create Next App",
Expand Down
2 changes: 1 addition & 1 deletion client/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SessionProvider } from "next-auth/react";

import type { AppProps } from "next/app";
import type { Session } from "next-auth";
import "./globals.css";
import "./styles/globals.css";

import { NextUIProvider } from "@nextui-org/react";

Expand Down
6 changes: 6 additions & 0 deletions client/pages/components/ScoreBoard/ScoreBoard.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.title {
font-size: 1.5rem;
font-weight: bold;
margin-bottom: 1rem;
text-align: center;
}
11 changes: 11 additions & 0 deletions client/pages/components/ScoreBoard/ScoreBoard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import style from "./ScoreBoard.module.css";

function ScoreBoard() {
return (
<div>
<h1 className={style.title}>ScoreBoard</h1>
</div>
);
}

export default ScoreBoard;
1 change: 1 addition & 0 deletions client/pages/components/ScoreBoard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as default } from "./ScoreBoard";
Empty file.
8 changes: 8 additions & 0 deletions client/pages/components/ScoreCard/ScoreCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import styles from "./ScoreCard.module.css";

function ScoreCard() {
return <div>ScoreCard</div>;
}

export default ScoreCard;
1 change: 1 addition & 0 deletions client/pages/components/ScoreCard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as default } from "./ScoreCard";
21 changes: 6 additions & 15 deletions client/pages/components/SignInButton/SignInButton.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
"use client";

import { Avatar, Button } from "@nextui-org/react";
import { Button } from "@nextui-org/react";
import { signIn, signOut, useSession } from "next-auth/react";
import React, { useState } from "react";
import UserCard from "../UserCard/UserCard";

// prop to redirect to the dashboard

function SignInButton() {
const { data: session } = useSession();
const [loading, setLoading] = useState(false);

// if the user does exist:
if (session && session.user) {
return (
<>
<UserCard user={session.user} />

<Button color="primary" onClick={() => signOut()}>
Sign out
</Button>
</>
);
}

// if the user does not exist:
return (
<>
Expand All @@ -32,7 +21,9 @@ function SignInButton() {
color="primary"
onClick={async () => {
setLoading(true);
await signIn("google");
await signIn("google", {
callbackUrl: "/dashboard",
});
}}
>
{loading ? "Signin In..." : "Sign in with Google"}
Expand Down
11 changes: 6 additions & 5 deletions client/pages/components/UserCard/UserCard.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"use client";

import {
Avatar,
Card,
CardBody,
CardFooter,
CardHeader,
Avatar,
Card,
CardBody,
CardFooter,
CardHeader,
Button,
} from "@nextui-org/react";
import { Session } from "next-auth";
import React from "react";
Expand Down
33 changes: 33 additions & 0 deletions client/pages/dashboard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useSession } from "next-auth/react";
import UserCard from "./components/UserCard";
import style from "./styles/Dashboard.module.css";
import Layout from "./Layout";
import ScoreBoard from "./components/ScoreBoard";
import ScoreCard from "./components/ScoreCard";

export default function Dashboard() {
const { data: session } = useSession();

return (
<>
<Layout>
<div className={style.container}>
<h1 className={style.title}>Dashboard</h1>

<div>
<UserCard user={session?.user} />
</div>

{/* leaderboard table here */}
<div>
<ScoreBoard />
</div>

<div>
<ScoreCard />
</div>
</div>
</Layout>
</>
);
}
3 changes: 1 addition & 2 deletions client/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styles from "./index.module.css";
import { Button } from "@nextui-org/button";
import styles from "./styles/index.module.css";
import SignInButton from "./components/SignInButton/SignInButton";
import RootLayout from "./Layout";

Expand Down
14 changes: 14 additions & 0 deletions client/pages/styles/Dashboard.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.container {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1em;
}

.title {
font-size: 2em;
font-weight: bold;
}
5 changes: 5 additions & 0 deletions client/pages/styles/Layout.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.main {
display: flex;
height: 100%;
width: 100%;
}
24 changes: 24 additions & 0 deletions client/pages/styles/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@font-face {
font-family: "Clash fonts";
src: url("/fonts/Clash-Regular.ttf") format("truetype");
/* add additional font formats here if needed */
}

html,
body,
#__next {
height: 100%;
background-color: black;
font-family: "Clash fonts", sans-serif; /* use the custom font */
}

body {
user-select: none;
}
* {
-webkit-tap-highlight-color: transparent;
}
File renamed without changes.
Binary file added client/public/fonts/Clash-Regular.ttf
Binary file not shown.

0 comments on commit d539ada

Please sign in to comment.