diff --git a/app/src/renderer/apps/Courier/components/PinnedMessage.tsx b/app/src/renderer/apps/Courier/components/PinnedMessage.tsx index 4f56bfde7e..5f19c46176 100644 --- a/app/src/renderer/apps/Courier/components/PinnedMessage.tsx +++ b/app/src/renderer/apps/Courier/components/PinnedMessage.tsx @@ -45,7 +45,7 @@ export const PinnedContainer = ({ message, onClick }: PinnedContainerProps) => { const { getOptions, setOptions } = useContextMenu(); const [authorColor, setAuthorColor] = useState(); - const pinnedRowId = useMemo(() => `pinned-${message?.id}`, [message?.id]); + const pinnedRowId = useMemo(() => `pinned-${message.id}`, [message.id]); const contextMenuOptions = useMemo(() => { const menu: MenuItemProps[] = []; if (!selectedChat || !loggedInAccount) return menu; @@ -69,7 +69,7 @@ export const PinnedContainer = ({ message, onClick }: PinnedContainerProps) => { disabled: false, onClick: (evt: React.MouseEvent) => { evt.stopPropagation(); - selectedChat.clearPinnedMessage(message?.id); + selectedChat.clearPinnedMessage(message.id); }, }); } @@ -83,7 +83,7 @@ export const PinnedContainer = ({ message, onClick }: PinnedContainerProps) => { }, [contextMenuOptions, getOptions, setOptions, pinnedRowId]); useEffect(() => { - const contact = friends.getContactAvatarMetadata(message?.sender); + const contact = friends.getContactAvatarMetadata(message.sender); // NOTE: #000 is the default color, so we want to default to undefined // and use the accent color instead const authorColorDisplay = @@ -91,7 +91,7 @@ export const PinnedContainer = ({ message, onClick }: PinnedContainerProps) => { 'rgba(var(--rlm-text-rgba))'; setAuthorColor(authorColorDisplay); - }, [message?.sender]); + }, [message.sender]); if (!message) return null; return ( diff --git a/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx b/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx index 63ad2b4be7..8f872ffd25 100644 --- a/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx +++ b/app/src/renderer/apps/Courier/views/ChatLog/ChatLog.tsx @@ -14,7 +14,6 @@ import { useTrayApps } from 'renderer/apps/store'; import { trackEvent } from 'renderer/lib/track'; import { useStorage } from 'renderer/lib/useStorage'; import { useAppState } from 'renderer/stores/app.store'; -import { ChatMessageType } from 'renderer/stores/models/chat.model'; import { useShipStore } from 'renderer/stores/ship.store'; import { ChatLogBody } from './ChatLogBody'; @@ -173,7 +172,7 @@ export const ChatLogPresenter = ({ isStandaloneChat = false }: Props) => { storage={storage} isMuted={selectedChat.muted} showPin={showPin} - pinnedChatMessage={selectedChat.pinnedChatMessage as ChatMessageType} + pinnedChatMessage={selectedChat.pinnedChatMessage} ourColor={ourColor} themeMode={theme.mode as 'light' | 'dark'} listRef={listRef} diff --git a/app/src/renderer/apps/Courier/views/ChatLog/ChatLogBody.tsx b/app/src/renderer/apps/Courier/views/ChatLog/ChatLogBody.tsx index b7c047d4d4..7da4878606 100644 --- a/app/src/renderer/apps/Courier/views/ChatLog/ChatLogBody.tsx +++ b/app/src/renderer/apps/Courier/views/ChatLog/ChatLogBody.tsx @@ -22,7 +22,7 @@ import { ChatLogList } from './ChatLogList'; type Props = { path: string; showPin: boolean; - pinnedChatMessage: ChatMessageType; + pinnedChatMessage: ChatMessageType | null | undefined; storage: any; isMuted: boolean; ourColor: string; @@ -106,7 +106,7 @@ const ChatLogBodyPresenter = ({ return ( - {showPin && ( + {showPin && pinnedChatMessage && (