Removes some Backbone views

This commit is contained in:
Josh Perez 2021-06-17 17:15:09 -04:00 committed by GitHub
parent 93bc094342
commit 94d116c621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 160 additions and 656 deletions

View file

@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import classNames from 'classnames';
import { AppViewType } from '../state/ducks/app';
@ -10,12 +10,16 @@ import { ThemeType } from '../types/Util';
export type PropsType = {
appView: AppViewType;
hasInitialLoadCompleted: boolean;
renderCallManager: () => JSX.Element;
renderGlobalModalContainer: () => JSX.Element;
theme: ThemeType;
};
export const App = ({
appView,
hasInitialLoadCompleted,
renderCallManager,
renderGlobalModalContainer,
theme,
}: PropsType): JSX.Element => {
let contents;
@ -28,6 +32,20 @@ export const App = ({
contents = <Inbox hasInitialLoadCompleted={hasInitialLoadCompleted} />;
}
// This is here so that themes are properly applied to anything that is
// created in a portal and exists outside of the <App /> container.
useEffect(() => {
document.body.classList.remove('light-theme');
document.body.classList.remove('dark-theme');
if (theme === ThemeType.dark) {
document.body.classList.add('dark-theme');
}
if (theme === ThemeType.light) {
document.body.classList.add('light-theme');
}
}, [theme]);
return (
<div
className={classNames({
@ -36,6 +54,8 @@ export const App = ({
'dark-theme': theme === ThemeType.dark,
})}
>
{renderGlobalModalContainer()}
{renderCallManager()}
{contents}
</div>
);