-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #203 from mattzcarey/feat/user-info-page-fix-revert
Feat/user info page
- Loading branch information
Showing
13 changed files
with
2,596 additions
and
127 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,36 @@ | ||
import "../styles/globals.css"; | ||
import React, { ReactNode } from 'react'; | ||
import { NextAuthProvider } from './providers'; | ||
import { Footer } from '@/components/footer/footer'; | ||
import { Header } from '@/components/header/header'; | ||
import "../styles/custom.css"; | ||
import React, { ReactNode } from "react"; | ||
import { NextAuthProvider } from "./providers"; | ||
import { Footer } from "@/components/footer/footer"; | ||
import { Header } from "@/components/header/header"; | ||
import "@radix-ui/themes/styles.css"; | ||
import { Theme } from "@radix-ui/themes"; | ||
|
||
export const metadata = { | ||
title: 'Code Review GPT', | ||
} | ||
title: "Code Review GPT", | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: {children: ReactNode }) { | ||
export default function RootLayout({ children }: { children: ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<script type="module" src="https://md-block.verou.me/md-block.js"></script> | ||
</head> | ||
<body> | ||
<head> | ||
<script | ||
type="module" | ||
src="https://md-block.verou.me/md-block.js" | ||
></script> | ||
</head> | ||
<body className="flex flex-col min-h-screen"> | ||
<Theme> | ||
<NextAuthProvider> | ||
<Header /> | ||
{children} | ||
<main className="flex flex-col flex-grow mb-16"> | ||
{children} | ||
</main> | ||
<Footer /> | ||
</NextAuthProvider> | ||
</body> | ||
</Theme> | ||
</body> | ||
</html> | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
"use client"; | ||
import Loading from "@/components/loading/loading"; | ||
import { RepoTable } from "@/components/tables/repoTable"; | ||
import { useSession } from "next-auth/react"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
|
||
export default function Profile(): JSX.Element { | ||
const repos = [ | ||
"code-review-gpt", | ||
"cooking-website", | ||
"make-money-fast-crypto", | ||
]; | ||
|
||
const { data: session, status } = useSession(); | ||
|
||
if (status === "loading") { | ||
return <Loading />; | ||
} | ||
|
||
if (!session) { | ||
return ( | ||
<> | ||
<p className="text-xl flex justify-center mt-16 ml-10"> | ||
You are not logged in. | ||
</p> | ||
<Link | ||
className="text-xl underline flex justify-center mb-5 ml-10" | ||
href="/" | ||
> | ||
Click here to return to home page. | ||
</Link> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<> | ||
<h1 className="text-3xl flex justify-right mt-10 mb-5 ml-10"> | ||
My Profile | ||
</h1> | ||
<div className="flex flex-col p-5 mx-10"> | ||
<div className="flex items-center mb-10"> | ||
<div className="rounded-full overflow-hidden w-16 h-16"> | ||
<Image | ||
src="/icon.png" | ||
alt={"orion logo"} | ||
width={100} | ||
height={100} | ||
layout="responsive" | ||
/> | ||
</div> | ||
<h1 className="text-2xl ml-5">{session.user?.email}</h1> | ||
</div> | ||
<RepoTable repos={repos} /> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from "react"; | ||
import Link from "next/link"; | ||
|
||
interface HeaderButtonProps { | ||
text: string; | ||
route: string; | ||
} | ||
|
||
const HeaderButton: React.FC<HeaderButtonProps> = ({ text, route }) => { | ||
return ( | ||
<Link | ||
href={route} | ||
className="p-[5px] mx-3 text-l font-mono hover:underline" | ||
> | ||
{text} | ||
</Link> | ||
); | ||
}; | ||
|
||
export default HeaderButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,45 @@ | ||
"use client" | ||
"use client"; | ||
import Image from "next/image"; | ||
import { SignInButton } from '@/components/buttons/signIn'; | ||
import { useSession } from 'next-auth/react'; | ||
import { SignOutButton } from '../buttons/signOut'; | ||
import { SignInButton } from "@/components/buttons/signIn"; | ||
import { useSession } from "next-auth/react"; | ||
import { SignOutButton } from "../buttons/signOut"; | ||
import HeaderButton from "../buttons/headerBtn"; | ||
import Link from "next/link"; | ||
|
||
export const Header = (): JSX.Element => { | ||
const { data: session } = useSession(); | ||
|
||
return ( | ||
<header className="flex flex-row navbar justify-between items-center"> | ||
<Image src="/icon.png" alt={"orion logo"} width={100} height={100} /> | ||
<h1 className="text-4xl font-mono"> | ||
Code Review GPT | ||
</h1> | ||
{ session ? ( | ||
<div className="flex flex-col"> | ||
{session.user?.email} | ||
<SignOutButton /> | ||
<header className="flex flex-row navbar justify-between items-center m-5"> | ||
<div className="flex items-center"> | ||
<div className="rounded-full overflow-hidden w-16 h-16"> | ||
<Image | ||
src="/icon.png" | ||
alt={"orion logo"} | ||
width={100} | ||
height={100} | ||
layout="responsive" | ||
/> | ||
</div> | ||
) : ( | ||
<SignInButton /> | ||
)} | ||
<Link className="text-4xl font-mono ml-4" href="/"> | ||
Code Review GPT | ||
</Link> | ||
</div> | ||
<div className="flex items-center"> | ||
{session ? ( | ||
<div className="flex items-center"> | ||
<HeaderButton text="Profile" route="/profile" /> | ||
<div className="flex flex-col"> | ||
<SignOutButton /> | ||
</div> | ||
</div> | ||
) : ( | ||
<SignInButton /> | ||
)} | ||
</div> | ||
</header> | ||
); | ||
}; | ||
Header.displayName = 'Header'; | ||
export default Header; | ||
|
||
Header.displayName = "Header"; | ||
export default Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
|
||
const Loading = () => { | ||
return ( | ||
<div className="loading"> | ||
<div className="loader"></div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Loading; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Table } from "@radix-ui/themes"; | ||
|
||
interface RepoTableProps { | ||
repos: string[]; | ||
} | ||
|
||
export const RepoTable: React.FC<RepoTableProps> = ({ repos }) => { | ||
return ( | ||
<div className="mx-10"> | ||
<h1 className="text-xl font-bold mb-5">Linked Repositories</h1> | ||
<Table.Root> | ||
<Table.Header> | ||
<Table.Row> | ||
<Table.ColumnHeaderCell>Repository Name</Table.ColumnHeaderCell> | ||
</Table.Row> | ||
</Table.Header> | ||
|
||
<Table.Body> | ||
{repos.map((repo, index) => ( | ||
<Table.Row key={index}> | ||
<Table.RowHeaderCell>{repo}</Table.RowHeaderCell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</Table.Root> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
.loading { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 50vh; | ||
} | ||
|
||
.loader { | ||
border: 4px solid rgba(0, 0, 0, 0.1); | ||
border-top: 4px solid #000; | ||
border-radius: 50%; | ||
width: 40px; | ||
height: 40px; | ||
animation: spin 1s linear infinite; | ||
} | ||
|
||
@keyframes spin { | ||
0% { | ||
transform: rotate(0deg); | ||
} | ||
100% { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|