You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
802 B
TypeScript

import { LogOutIcon } from "lucide-react";
import { getCurrentUser } from "@/data/auth";
import { logout } from "@/app/(auth)/actions";
import { Button } from "@/components/ui/button";
export async function SidebarUser() {
const user = await getCurrentUser();
return (
<div className="flex items-center gap-2 px-2 py-1">
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium">{user.name}</p>
{user.username && (
<p className="truncate text-xs text-muted-foreground">
@{user.username}
</p>
)}
</div>
<form action={logout}>
<Button type="submit" variant="ghost" size="sm">
<LogOutIcon data-icon="inline-start" />
Keluar
</Button>
</form>
</div>
);
}