Skip to content

Commit b441daf

Browse files
show signed in user's email on nav (#274)
1 parent 6cbcc47 commit b441daf

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

frontend/app/components/NavBar/components/NavItems/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useSupabase } from "@/app/supabase-provider";
33
import { cn } from "@/lib/utils";
44
import Link from "next/link";
55
import { Dispatch, FC, HTMLAttributes, SetStateAction } from "react";
6-
import { MdSettings } from "react-icons/md";
6+
import { MdPerson, MdSettings } from "react-icons/md";
77
import Button from "../../../ui/Button";
88
import { AuthButtons } from "./components/AuthButtons";
99
import { DarkModeToggle } from "./components/DarkModeToggle";
@@ -54,13 +54,14 @@ export const NavItems: FC<NavItemsProps> = ({
5454
<div className="flex sm:flex-1 sm:justify-end flex-col items-center justify-center sm:flex-row gap-5 sm:gap-2">
5555
{isUserLoggedIn && (
5656
<>
57-
<Link href={"/logout"}>
58-
<Button variant={"secondary"}>Logout</Button>
57+
<Link aria-label="account" className="" href={"/user"}>
58+
<MdPerson />
5959
</Link>
6060
<Link href={"/config"}>
6161
<Button
6262
variant={"tertiary"}
6363
className="focus:outline-none text-2xl"
64+
aria-label="Settings"
6465
>
6566
<MdSettings />
6667
</Button>

frontend/app/config/page.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
anthropicModels,
66
models,
77
} from "@/lib/context/BrainConfigProvider/types";
8+
import Link from "next/link";
89
import Button from "../components/ui/Button";
910
import Field from "../components/ui/Field";
1011
import { useSupabase } from "../supabase-provider";
@@ -157,6 +158,22 @@ export default function ExplorePage() {
157158
Done
158159
</Button>
159160
</div>
161+
<div className="border-b border-gray-300 mt-8 mb-8">
162+
<p className="text-center text-gray-600 uppercase tracking-wide font-semibold">
163+
Your Account
164+
</p>
165+
</div>
166+
<div className="flex justify-between items-center w-full">
167+
<span>
168+
Signed In as: <b>{session.user.email}</b>
169+
</span>
170+
<Link className="mt-2" href={"/logout"}>
171+
<Button className="px-3 py-2" variant={"danger"}>
172+
Logout
173+
</Button>
174+
</Link>
175+
{/* TODO: add functionality to change password */}
176+
</div>
160177
</form>
161178
</section>
162179
</main>

frontend/app/user/components/UserStatistics.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"use client";
2+
import Button from "@/app/components/ui/Button";
23
import { cn } from "@/lib/utils";
4+
import Link from "next/link";
35
import prettyBytes from "pretty-bytes";
46
import { HTMLAttributes } from "react";
57
import { UserStats } from "../types";
@@ -14,11 +16,16 @@ export const UserStatistics = (userStats: UserStats): JSX.Element => {
1416
return (
1517
<>
1618
<div className="flex flex-col sm:flex-row sm:items-center py-10 gap-5">
17-
<div className="flex-1">
19+
<div className="flex-1 flex flex-col">
1820
<h1 className="text-4xl font-semibold">
1921
{email.split("@")[0] + "'"}s Brain Usage
2022
</h1>
2123
<p className="opacity-50">{email}</p>
24+
<Link className="mt-2" href={"/logout"}>
25+
<Button className="px-3 py-2" variant={"danger"}>
26+
Logout
27+
</Button>
28+
</Link>
2229
</div>
2330

2431
<BrainConsumption {...userStats} />

0 commit comments

Comments
 (0)