From 5945353dedf1bc552e101db09def84bf5bba43b7 Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Fri, 19 Feb 2021 13:42:15 -0500 Subject: [PATCH] landscape: /messages respects calmengine --- .../views/landscape/components/Sidebar/SidebarItem.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx b/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx index 6557edd75..1d52a9fca 100644 --- a/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx +++ b/pkg/interface/src/views/landscape/components/Sidebar/SidebarItem.tsx @@ -8,6 +8,7 @@ import { HoverBoxLink } from '~/views/components/HoverBox'; import { Sigil } from '~/logic/lib/sigil'; import { getModuleIcon, getItemTitle, uxToHex } from '~/logic/lib/util'; import { useTutorialModal } from '~/views/components/useTutorialModal'; +import useLocalState from '~/logic/state/local'; import { TUTORIAL_HOST, TUTORIAL_GROUP } from '~/logic/lib/tutorialModal'; import { SidebarAppConfigs, SidebarItemStatus } from './types'; import { Workspace } from '~/types/workspace'; @@ -55,6 +56,9 @@ export function SidebarItem(props: { return null; } const DM = (isUnmanaged && props.workspace?.type === 'messages'); + const { hideAvatars, hideNicknames } = useLocalState(({ hideAvatars, hideNicknames }) => ({ + hideAvatars, hideNicknames + })); const itemStatus = app.getStatus(path); const hasUnread = itemStatus === 'unread' || itemStatus === 'mention'; @@ -81,12 +85,12 @@ export function SidebarItem(props: { let img = null; if (urbitOb.isValidPatp(title)) { - if (props.contacts?.[title] && props.contacts[title].avatar) { + if (props.contacts?.[title]?.avatar && !hideAvatars) { img = ; } else { img = ; } - if (props.contacts?.[title] && props.contacts[title].nickname) { + if (props.contacts?.[title]?.nickname && !hideNicknames) { title = props.contacts[title].nickname; } } else {