From 42bc769d5d8f80d5a9f9a64c71d9792b1f025653 Mon Sep 17 00:00:00 2001 From: RoccoSmit Date: Wed, 11 Sep 2024 01:02:48 +1000 Subject: [PATCH] fix: load server name and icon from settings (#3908) --- web/src/components/UserBanner.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserBanner.tsx index 0962a0863a2d8..a02af9695a088 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserBanner.tsx @@ -5,6 +5,9 @@ import { authServiceClient } from "@/grpcweb"; import useCurrentUser from "@/hooks/useCurrentUser"; import useNavigateTo from "@/hooks/useNavigateTo"; import { Routes } from "@/router"; +import { useWorkspaceSettingStore } from "@/store/v1"; +import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_service"; +import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import UserAvatar from "./UserAvatar"; @@ -17,8 +20,11 @@ const UserBanner = (props: Props) => { const t = useTranslate(); const navigateTo = useNavigateTo(); const user = useCurrentUser(); - const title = user ? user.nickname || user.username : "Memos"; - const avatarUrl = user ? user.avatarUrl : "/full-logo.webp"; + const workspaceSettingStore = useWorkspaceSettingStore(); + const workspaceGeneralSetting = + workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL).generalSetting || WorkspaceGeneralSetting.fromPartial({}); + const title = user ? user.nickname || user.username : workspaceGeneralSetting.customProfile?.title; + const avatarUrl = user ? user.avatarUrl : workspaceGeneralSetting.customProfile?.logoUrl; const handleSignOut = async () => { await authServiceClient.signOut({});