#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
fix: show profile picture in the FileSidebar bottom bar
Anthony Stirlingbe0db3fd8ac9
diff --git a/frontend/editor/src/core/components/shared/FileSidebar.css b/frontend/editor/src/core/components/shared/FileSidebar.cssindex 875fcd9e70..fce21b32c4 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.tsxindex c11ff76e87..2d6dc79d21 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<HTMLDivElement, FileSidebarProps>(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<HTMLDivElement, FileSidebarProps>(className="file-sidebar-bottom-avatar"aria-label={displayName}>- {displayName.charAt(0).toUpperCase()}+ {showProfilePicture ? (+ <img+ src={profilePictureUrl}+ alt=""+ className="file-sidebar-bottom-avatar-img"+ onError={() => setPictureFailed(true)}+ />+ ) : (+ displayName.charAt(0).toUpperCase()+ )}</div>{!collapsed && (<span className="file-sidebar-bottom-name sidebar-content-fade">diff --git a/frontend/editor/src/core/hooks/useProfilePictureUrl.ts b/frontend/editor/src/core/hooks/useProfilePictureUrl.tsnew file mode 100644index 0000000000..b43e673c9e--- /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.tsnew file mode 100644index 0000000000..3d2b4c635a--- /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;+}