Add `email` and `status` fields to user schema for better data handling. Update `UsersService` with new service dependencies (`RbacService`, `MediaService`, `S3Service`, `ConfigService`) for enhanced functionality. Mock dependencies in tests for improved coverage. Adjust user model with optional and extended fields for flexibility. Streamline and update import statements.
37 lines
994 B
TypeScript
37 lines
994 B
TypeScript
"use client";
|
|
|
|
import { LogIn } from "lucide-react";
|
|
import Link from "next/link";
|
|
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
|
import { Button } from "@/components/ui/button";
|
|
import { useAuth } from "@/providers/auth-provider";
|
|
|
|
export function UserNavMobile() {
|
|
const { user, isAuthenticated, isLoading } = useAuth();
|
|
|
|
if (isLoading) {
|
|
return <div className="h-8 w-8 rounded-full bg-zinc-200 animate-pulse" />;
|
|
}
|
|
|
|
if (!isAuthenticated || !user) {
|
|
return (
|
|
<Button variant="ghost" size="icon" asChild className="h-9 w-9">
|
|
<Link href="/login">
|
|
<LogIn className="h-5 w-5" />
|
|
</Link>
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Button variant="ghost" size="icon" asChild className="h-9 w-9 p-0">
|
|
<Link href="/profile">
|
|
<Avatar className="h-8 w-8 border">
|
|
<AvatarImage src={user.avatarUrl} alt={user.username} />
|
|
<AvatarFallback>{user.username.slice(0, 2).toUpperCase()}</AvatarFallback>
|
|
</Avatar>
|
|
</Link>
|
|
</Button>
|
|
);
|
|
}
|