print roles

This commit is contained in:
2025-12-07 17:51:44 -07:00
parent 8301a5e738
commit 26c70be1e7
2 changed files with 8 additions and 36 deletions

View File

@@ -78,7 +78,14 @@ export default function CopilotKitPage() {
className="w-8 h-8 rounded-full"
/>
)}
<span className="text-sm text-gray-700">{user.name}</span>
<div className="flex flex-col items-end">
<span className="text-sm text-gray-700">{user.name}</span>
{(user as any).roles && (user as any).roles.length > 0 && (
<span className="text-xs text-gray-500">
{(user as any).roles.join(', ')}
</span>
)}
</div>
<LogoutButton />
</div>
</div>

View File

@@ -1,35 +0,0 @@
"use client";
import { useUser } from "@auth0/nextjs-auth0/client";
export default function Profile() {
const { user, isLoading } = useUser();
if (isLoading) {
return (
<div className="loading-state">
<div className="loading-text">Loading user profile...</div>
</div>
);
}
if (!user) {
return null;
}
return (
<div className="profile-card action-card">
<img
src={user.picture || `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='50' fill='%2363b3ed'/%3E%3Cpath d='M50 45c7.5 0 13.64-6.14 13.64-13.64S57.5 17.72 50 17.72s-13.64 6.14-13.64 13.64S42.5 45 50 45zm0 6.82c-9.09 0-27.28 4.56-27.28 13.64v3.41c0 1.88 1.53 3.41 3.41 3.41h47.74c1.88 0 3.41-1.53 3.41-3.41v-3.41c0-9.08-18.19-13.64-27.28-13.64z' fill='%23fff'/%3E%3C/svg%3E`}
alt={user.name || 'User profile'}
className="profile-picture"
onError={(e) => {
const target = e.target as HTMLImageElement;
target.src = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='50' fill='%2363b3ed'/%3E%3Cpath d='M50 45c7.5 0 13.64-6.14 13.64-13.64S57.5 17.72 50 17.72s-13.64 6.14-13.64 13.64S42.5 45 50 45zm0 6.82c-9.09 0-27.28 4.56-27.28 13.64v3.41c0 1.88 1.53 3.41 3.41 3.41h47.74c1.88 0 3.41-1.53 3.41-3.41v-3.41c0-9.08-18.19-13.64-27.28-13.64z' fill='%23fff'/%3E%3C/svg%3E`;
}}
/>
<h2 className="profile-name">{user.name}</h2>
<p className="profile-email">{user.email}</p>
</div>
);
}