- added settings page and function

- add Role Ring for avatar and display role for user nav
This commit is contained in:
2026-01-06 21:37:53 +07:00
parent 8146565d2c
commit a4e96fe045
64 changed files with 2828 additions and 726 deletions

View File

@@ -0,0 +1,44 @@
import { useSession } from '@/lib/auth-client';
import { cn } from '@/lib/utils';
import { Avatar, AvatarFallback, AvatarImage } from '../ui/avatar';
import RoleRing from './RoleRing';
interface AvatarUserProps {
className?: string;
textSize?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
}
const AvatarUser = ({ className, textSize = 'md' }: AvatarUserProps) => {
const { data: session } = useSession();
const imagePath = session?.user?.image
? `./data/avatar/${session?.user?.image}`
: undefined;
const shortName = session?.user?.name
?.split(' ')
.slice(0, 2)
.map((name) => name[0])
.join('');
return (
<RoleRing type={session?.user?.role}>
<Avatar className={className}>
<AvatarImage src={imagePath} />
<AvatarFallback
className={cn(
'bg-orange-400 text-white',
textSize === 'sm' && 'text-xs',
textSize === 'md' && 'text-sm',
textSize === 'lg' && 'text-xl',
textSize === 'xl' && 'text-2xl',
textSize === '2xl' && 'text-3xl',
textSize === '3xl' && 'text-4xl',
)}
>
{shortName}
</AvatarFallback>
</Avatar>
</RoleRing>
);
};
export default AvatarUser;