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

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

@ -37,6 +37,15 @@ class ActionsPanelPrivate extends React.Component<Props> {
void removeItemById('hasSeenLightModeDialog'); 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 = ({ public Section = ({
isSelected, isSelected,
onSelect, onSelect,

Loading…
Cancel
Save