Skip to content

Commit

Permalink
fix: load server name and icon from settings (usememos#3908)
Browse files Browse the repository at this point in the history
  • Loading branch information
RoccoSmit authored Sep 10, 2024
1 parent 4790e84 commit 42bc769
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/src/components/UserBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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({});
Expand Down

0 comments on commit 42bc769

Please sign in to comment.