Skip to content

Commit

Permalink
feat(partners): add dashboard page
Browse files Browse the repository at this point in the history
  • Loading branch information
joshxfi committed Aug 17, 2024
1 parent 0d18e2a commit 49268ae
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 1 deletion.
20 changes: 20 additions & 0 deletions apps/partners/src/app/dashboard/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Link from "next/link";
import { Badge } from "@umamin/ui/components/badge";
import { SignOutButton } from "./sign-out-btn";

export async function Navbar() {
return (
<nav className="fixed left-0 right-0 top-0 z-50 w-full bg-background bg-opacity-40 bg-clip-padding py-5 backdrop-blur-xl backdrop-filter lg:z-40 container max-w-screen-xl flex justify-between items-center">
<div className="space-x-2 flex items-center">
<Link href="/" aria-label="logo">
<span className="font-semibold text-foreground">umamin</span>
<span className="text-muted-foreground font-medium">.link</span>
</Link>

<Badge variant="outline">partners</Badge>
</div>

<SignOutButton />
</nav>
);
}
21 changes: 21 additions & 0 deletions apps/partners/src/app/dashboard/components/sign-out-btn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use client";

import { Loader2 } from "lucide-react";
import { useFormStatus } from "react-dom";
import { Button } from "@umamin/ui/components/button";

export function SignOutButton() {
const { pending } = useFormStatus();

return (
<Button
data-testid="logout-btn"
type="submit"
disabled={pending}
variant="outline"
>
{pending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
Sign Out
</Button>
);
}
14 changes: 14 additions & 0 deletions apps/partners/src/app/dashboard/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Navbar } from "./components/navbar";

export default function Layout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<main>
<Navbar />
{children}
</main>
);
}
10 changes: 10 additions & 0 deletions apps/partners/src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { getSession } from "@/lib/auth";

export default async function Dashboard() {
const { user } = await getSession();
return (
<div className="max-w-screen-xl mx-auto mt-32 container">
<h1 className="text-4xl">Hello, {user?.displayName || user?.username}</h1>
</div>
);
}
2 changes: 1 addition & 1 deletion apps/partners/src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default async function Login() {
const { user } = await getSession();

if (user) {
redirect("/inbox");
redirect("/dashboard");
}

return (
Expand Down

0 comments on commit 49268ae

Please sign in to comment.