trigger theme switch with user theme on app start

pull/1381/head
Audric Ackermann 4 years ago
parent d729e49840
commit 88cd58e7ff
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -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<Props> {
public constructor(props: Props) {
@ -188,14 +191,14 @@ class ConversationListItem extends React.PureComponent<Props> {
{isTyping ? (
<TypingAnimation i18n={i18n} />
) : (
<MessageBody
isGroup={true}
text={text}
disableJumbomoji={true}
disableLinks={true}
i18n={i18n}
/>
)}
<MessageBody
isGroup={true}
text={text}
disableJumbomoji={true}
disableLinks={true}
i18n={i18n}
/>
)}
</div>
{lastMessage && lastMessage.status ? (
<div

@ -291,15 +291,15 @@ export class Message extends React.PureComponent<Props, State> {
{window.i18n('sendFailed')}
</span>
) : (
<Timestamp
i18n={window.i18n}
timestamp={serverTimestamp || timestamp}
extended={true}
direction={direction}
withImageNoCaption={withImageNoCaption}
module="module-message__metadata__date"
/>
)}
<Timestamp
i18n={window.i18n}
timestamp={serverTimestamp || timestamp}
extended={true}
direction={direction}
withImageNoCaption={withImageNoCaption}
module="module-message__metadata__date"
/>
)}
{this.renderMetadataBadges()}
{expirationLength && expirationTimestamp ? (
<ExpireTimer
@ -473,30 +473,30 @@ export class Message extends React.PureComponent<Props, State> {
<Spinner size="small" direction={direction} />
</div>
) : (
<div className="module-message__generic-attachment__icon-container">
<div
role="button"
className="module-message__generic-attachment__icon"
onClick={(e: any) => {
if (this.props?.onDownload) {
e.stopPropagation();
this.props.onDownload(firstAttachment);
}
}}
>
{extension ? (
<div className="module-message__generic-attachment__icon__extension">
{extension}
</div>
) : null}
</div>
{isDangerous ? (
<div className="module-message__generic-attachment__icon-dangerous-container">
<div className="module-message__generic-attachment__icon-dangerous" />
<div className="module-message__generic-attachment__icon-container">
<div
role="button"
className="module-message__generic-attachment__icon"
onClick={(e: any) => {
if (this.props?.onDownload) {
e.stopPropagation();
this.props.onDownload(firstAttachment);
}
}}
>
{extension ? (
<div className="module-message__generic-attachment__icon__extension">
{extension}
</div>
) : null}
</div>
)}
{isDangerous ? (
<div className="module-message__generic-attachment__icon-dangerous-container">
<div className="module-message__generic-attachment__icon-dangerous" />
</div>
) : null}
</div>
)}
<div className="module-message__generic-attachment__text">
<div
className={classNames(

@ -37,6 +37,15 @@ class ActionsPanelPrivate extends React.Component<Props> {
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,

Loading…
Cancel
Save