mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-27 11:36:22 +00:00
Refactor console layout and sidebar components; implement user authentication and loading states
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 31s
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 31s
- Updated `RootLayout` to include user authentication logic and loading states. - Removed redundant user authentication logic from `Page` component. - Enhanced `AppSidebar` to fetch and display logged-in user information. - Replaced `GravatarAvatar` with new `Avatar` component for user profile images. - Added new pages for comment, file, post, and user management. - Introduced utility functions for generating Gravatar URLs and fallback avatars based on usernames. - Cleaned up unused imports and components across various files.
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
"use client"
|
||||
import { User } from "@/models/user";
|
||||
import GravatarAvatar from "@/components/common/gravatar";
|
||||
import { Mail, User as UserIcon, Shield } from 'lucide-react';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "../ui/avatar";
|
||||
import { getGravatarUrl } from "@/utils/common/gravatar";
|
||||
import { getFirstCharFromUser } from "@/utils/common/username";
|
||||
|
||||
export function UserHeader({ user }: { user: User }) {
|
||||
return (
|
||||
@ -10,7 +12,10 @@ export function UserHeader({ user }: { user: User }) {
|
||||
<div className="md:basis-[20%] flex justify-center items-center p-4">
|
||||
{/* wrapper 控制显示大小,父组件给具体 w/h */}
|
||||
<div className="w-40 h-40 md:w-48 md:h-48 relative">
|
||||
<GravatarAvatar className="rounded-full w-full h-full" url={user.avatarUrl} email={user.email} size={200} />
|
||||
<Avatar className="h-full w-full rounded-full">
|
||||
<AvatarImage src={getGravatarUrl({ email: user.email, size: 120 })} alt={user.nickname} />
|
||||
<AvatarFallback className="rounded-full">{getFirstCharFromUser(user)}</AvatarFallback>
|
||||
</Avatar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user