mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-07-13 11:05:48 +00:00
feat: implement user profile page and integrate profile fetching logic in AccountPopover and ApplicationLayout components ✨
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
"use client";
|
||||
import { Loader2, User as UserIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Popover,
|
||||
PopoverContent,
|
||||
PopoverTrigger,
|
||||
} from "@/components/ui/popover";
|
||||
import { Loader2, User as UserIcon } from "lucide-react";
|
||||
import { signOut, useSession } from "next-auth/react";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AccountPopover() {
|
||||
const session = useSession();
|
||||
@ -36,16 +37,24 @@ export function AccountPopover() {
|
||||
<p>{session.data?.user?.mobile}</p>
|
||||
</div>
|
||||
</div>
|
||||
<Button
|
||||
disabled={loading}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await signOut();
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{loading ? <Loader2 className="animate-spin" /> : "Logout"}
|
||||
</Button>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Button
|
||||
disabled={loading}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await signOut();
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{loading ? <Loader2 className="animate-spin" /> : "Logout"}
|
||||
</Button>
|
||||
<Link href="/profile" className="text-muted-foreground">
|
||||
<Button variant={"secondary"} className="w-full">
|
||||
View Profile
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
|
Reference in New Issue
Block a user