fix: make sure password window has primary color set

This commit is contained in:
William Grant 2022-10-12 16:50:06 +11:00
parent 5b44565b5f
commit 07f2fcabd4
4 changed files with 9 additions and 1 deletions

View File

@ -13,6 +13,7 @@ window.ReactDOM = require('react-dom');
// If the app is locked we can't access the database to check the theme.
window.theme = 'classic-dark';
window.primaryColor = 'green';
window.i18n = i18n.setupi18n(locale, localeMessages);
window.getEnvironment = () => config.environment;

View File

@ -153,6 +153,7 @@ textarea {
// To limit messages with things forcing them wider, like long attachment names
max-width: 100%;
align-items: center;
border-radius: var(--border-radius-message-box);
}
label {
user-select: none;

View File

@ -11,6 +11,7 @@ import { ToastUtils } from '../session/utils';
import { isString } from 'lodash';
import { SessionToastContainer } from './SessionToastContainer';
import { SessionWrapperModal } from './SessionWrapperModal';
import { switchPrimaryColorTo } from '../themes/switchPrimaryColor';
interface State {
errorCount: number;
@ -199,6 +200,9 @@ export const SessionPasswordPrompt = () => {
theme: (window as any).theme,
});
}
if ((window as any).primaryColor) {
void switchPrimaryColorTo((window as any).primaryColor);
}
}, []);
return (

View File

@ -9,7 +9,9 @@ export function findPrimaryColorId(hexCode: string): PrimaryColorStateType | und
}
export async function switchPrimaryColorTo(color: PrimaryColorStateType, dispatch?: Dispatch) {
await window.Events.setPrimaryColorSetting(color);
if (window.Events) {
await window.Events.setPrimaryColorSetting(color);
}
document.documentElement.style.setProperty(
'--primary-color',