Skip to content

Commit

Permalink
Fix workspace avatar in workspace switcher
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Apr 19, 2024
1 parent 13b99de commit 4852a4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/WorkspaceSwitcherButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) {

const pressableRef = useRef<HTMLDivElement | View | null>(null);

const {source, name, type} = useMemo(() => {
const {source, name, type, id} = useMemo(() => {
if (!policy) {
return {source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR};
}

const avatar = policy?.avatar ? policy.avatar : getDefaultWorkspaceAvatar(policy?.name);
return {
source: avatar,
name: policy?.id ?? '',
name: policy?.name ?? '',
type: CONST.ICON_TYPE_WORKSPACE,
id: policy?.id ?? '',
};
}, [policy]);

Expand All @@ -55,7 +56,7 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) {
>
{({hovered}) => (
<SubscriptAvatar
mainAvatar={{source, name, type}}
mainAvatar={{source, name, type, id}}
subscriptIcon={{
source: Expensicons.DownArrow,
width: CONST.WORKSPACE_SWITCHER.SUBSCRIPT_ICON_SIZE,
Expand Down
1 change: 1 addition & 0 deletions src/pages/WorkspaceSwitcherPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function WorkspaceSwitcherPage() {
fallbackIcon: Expensicons.FallbackWorkspaceAvatar,
name: policy?.name,
type: CONST.ICON_TYPE_WORKSPACE,
id: policy?.id,
},
],
isBold: hasUnreadData(policy?.id),
Expand Down

0 comments on commit 4852a4e

Please sign in to comment.