diff --git a/frontend/editor/src/core/components/shared/FileSidebar.css b/frontend/editor/src/core/components/shared/FileSidebar.css index 875fcd9e7..fce21b32c 100644 --- a/frontend/editor/src/core/components/shared/FileSidebar.css +++ b/frontend/editor/src/core/components/shared/FileSidebar.css @@ -396,6 +396,14 @@ justify-content: center; flex-shrink: 0; user-select: none; + overflow: hidden; +} + +.file-sidebar-bottom-avatar-img { + width: 100%; + height: 100%; + border-radius: 50%; + object-fit: cover; } .file-sidebar-bottom-name { diff --git a/frontend/editor/src/core/components/shared/FileSidebar.tsx b/frontend/editor/src/core/components/shared/FileSidebar.tsx index c11ff76e8..2d6dc79d2 100644 --- a/frontend/editor/src/core/components/shared/FileSidebar.tsx +++ b/frontend/editor/src/core/components/shared/FileSidebar.tsx @@ -20,6 +20,7 @@ import { import { useViewer } from "@app/contexts/ViewerContext"; import { useFileHandler } from "@app/hooks/useFileHandler"; import { useAuth } from "@app/auth/UseSession"; +import { useProfilePictureUrl } from "@app/hooks/useProfilePictureUrl"; import { useIndexedDB, useIndexedDBRevision, @@ -184,6 +185,11 @@ const FileSidebar = forwardRef( const displayName = authDisplayName ?? accountUsername ?? t("auth.displayName.user", "User"); + const profilePictureUrl = useProfilePictureUrl(); + const [pictureFailed, setPictureFailed] = useState(false); + useEffect(() => setPictureFailed(false), [profilePictureUrl]); + const showProfilePicture = !!profilePictureUrl && !pictureFailed; + useEffect(() => { if (!config?.enableLogin) { setAccountUsername(null); @@ -941,7 +947,16 @@ const FileSidebar = forwardRef( className="file-sidebar-bottom-avatar" aria-label={displayName} > - {displayName.charAt(0).toUpperCase()} + {showProfilePicture ? ( + setPictureFailed(true)} + /> + ) : ( + displayName.charAt(0).toUpperCase() + )} {!collapsed && ( diff --git a/frontend/editor/src/core/hooks/useProfilePictureUrl.ts b/frontend/editor/src/core/hooks/useProfilePictureUrl.ts new file mode 100644 index 000000000..b43e673c9 --- /dev/null +++ b/frontend/editor/src/core/hooks/useProfilePictureUrl.ts @@ -0,0 +1,6 @@ +/** + * Core stub — no profile picture source; auth-aware layers override this. + */ +export function useProfilePictureUrl(): string | null { + return null; +} diff --git a/frontend/editor/src/saas/hooks/useProfilePictureUrl.ts b/frontend/editor/src/saas/hooks/useProfilePictureUrl.ts new file mode 100644 index 000000000..3d2b4c635 --- /dev/null +++ b/frontend/editor/src/saas/hooks/useProfilePictureUrl.ts @@ -0,0 +1,5 @@ +import { useAuth } from "@app/auth/UseSession"; + +export function useProfilePictureUrl(): string | null { + return useAuth().profilePictureUrl; +}