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

- 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:
2025-09-18 21:45:18 +08:00
parent e5896d05b1
commit 2fa462ae60
32 changed files with 253 additions and 953 deletions

View File

@ -0,0 +1,22 @@
import { User } from "@/models/user";
export function getFallbackAvatarFromUsername(username: string): string {
if (!username) {
return "N";
}
const firstChar = username.charAt(0);
if (/[a-zA-Z]/.test(firstChar)) {
return firstChar.toUpperCase();
}
return firstChar;
}
export function getFirstCharFromUser(user: User): string {
if (user.nickname) {
return getFallbackAvatarFromUsername(user.nickname);
}
if (user.username) {
return getFallbackAvatarFromUsername(user.username);
}
return "N";
}