From 88cd58e7ff995da2a4a8478eff383f2c04055f77 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Tue, 1 Dec 2020 11:15:51 +1100 Subject: [PATCH] trigger theme switch with user theme on app start --- ts/components/ConversationListItem.tsx | 23 +++++----- ts/components/conversation/Message.tsx | 60 +++++++++++++------------- ts/components/session/ActionsPanel.tsx | 9 ++++ 3 files changed, 52 insertions(+), 40 deletions(-) diff --git a/ts/components/ConversationListItem.tsx b/ts/components/ConversationListItem.tsx index a30f7d9cc..371b32a8b 100644 --- a/ts/components/ConversationListItem.tsx +++ b/ts/components/ConversationListItem.tsx @@ -72,8 +72,11 @@ type PropsHousekeeping = { type Props = PropsData & PropsHousekeeping; const Portal = ({ children }: { children: any }) => { - return createPortal(children, document.querySelector('.inbox.index') as Element); -} + return createPortal( + children, + document.querySelector('.inbox.index') as Element + ); +}; class ConversationListItem extends React.PureComponent { public constructor(props: Props) { @@ -188,14 +191,14 @@ class ConversationListItem extends React.PureComponent { {isTyping ? ( ) : ( - - )} + + )} {lastMessage && lastMessage.status ? (
{ {window.i18n('sendFailed')} ) : ( - - )} + + )} {this.renderMetadataBadges()} {expirationLength && expirationTimestamp ? ( {
) : ( -
-
{ - if (this.props?.onDownload) { - e.stopPropagation(); - this.props.onDownload(firstAttachment); - } - }} - > - {extension ? ( -
- {extension} -
- ) : null} -
- {isDangerous ? ( -
-
+
+
{ + if (this.props?.onDownload) { + e.stopPropagation(); + this.props.onDownload(firstAttachment); + } + }} + > + {extension ? ( +
+ {extension}
) : null}
- )} + {isDangerous ? ( +
+
+
+ ) : null} +
+ )}
{ void removeItemById('hasSeenLightModeDialog'); } + // fetch the user saved theme from the db, and apply it on mount. + public componentDidMount() { + const theme = window.Events.getThemeSetting(); + window.setTheme(theme); + + const newThemeObject = theme === 'dark' ? darkTheme : lightTheme; + this.props.applyTheme(newThemeObject); + } + public Section = ({ isSelected, onSelect,