diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
index 3d4e5630d..95ff5d782 100644
--- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
+++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
@@ -354,7 +354,11 @@ export function LayoutDataProvider({
onChatDelete={handleChatDelete}
onViewAllSharedChats={handleViewAllSharedChats}
onViewAllPrivateChats={handleViewAllPrivateChats}
- user={{ email: user?.email || "", name: user?.email?.split("@")[0] }}
+ user={{
+ email: user?.email || "",
+ name: user?.display_name || user?.email?.split("@")[0],
+ avatarUrl: user?.avatar_url || undefined,
+ }}
onSettings={handleSettings}
onManageMembers={handleManageMembers}
onUserSettings={handleUserSettings}
diff --git a/surfsense_web/components/layout/types/layout.types.ts b/surfsense_web/components/layout/types/layout.types.ts
index 73ac98fa5..3eac64e60 100644
--- a/surfsense_web/components/layout/types/layout.types.ts
+++ b/surfsense_web/components/layout/types/layout.types.ts
@@ -12,6 +12,7 @@ export interface SearchSpace {
export interface User {
email: string;
name?: string;
+ avatarUrl?: string;
}
export interface NavItem {
diff --git a/surfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsx b/surfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsx
index d3e97c8eb..30a4d14dc 100644
--- a/surfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/SidebarUserProfile.tsx
@@ -61,6 +61,34 @@ function getInitials(email: string): string {
return name.slice(0, 2).toUpperCase();
}
+/**
+ * User avatar component - shows image if available, otherwise falls back to initials
+ */
+function UserAvatar({
+ avatarUrl,
+ initials,
+ bgColor,
+}: {
+ avatarUrl?: string;
+ initials: string;
+ bgColor: string;
+}) {
+ if (avatarUrl) {
+ return (
+
+ );
+ }
+
+ return (
+
{displayName}
{user.email}
@@ -149,13 +167,7 @@ export function SidebarUserProfile({ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring" )} > - {/* Avatar */} -{displayName}
{user.email}
diff --git a/surfsense_web/contracts/types/user.types.ts b/surfsense_web/contracts/types/user.types.ts index f2d1f0ffc..0cd8314da 100644 --- a/surfsense_web/contracts/types/user.types.ts +++ b/surfsense_web/contracts/types/user.types.ts @@ -8,6 +8,8 @@ export const user = z.object({ is_verified: z.boolean(), pages_limit: z.number(), pages_used: z.number(), + display_name: z.string().nullable().optional(), + avatar_url: z.string().nullable().optional(), }); /**