2022-09-27 07:10:28 +00:00
|
|
|
import { StyledEngineProvider, ThemeProvider } from '@mui/material/styles';
|
2021-04-29 09:24:39 +00:00
|
|
|
import * as React from 'react';
|
2022-08-01 07:04:23 +00:00
|
|
|
import { connect } from 'react-redux';
|
2021-04-29 09:24:39 +00:00
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../../app/types';
|
2022-09-05 11:24:13 +00:00
|
|
|
|
2022-08-01 07:04:23 +00:00
|
|
|
import BaseTheme from './BaseTheme.web';
|
2021-04-29 09:24:39 +00:00
|
|
|
|
2022-11-03 08:35:51 +00:00
|
|
|
interface IProps {
|
2021-04-29 09:24:39 +00:00
|
|
|
|
2021-11-15 08:37:54 +00:00
|
|
|
/**
|
|
|
|
* The default theme or theme set through advanced branding.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_theme: Object;
|
2021-11-15 08:37:54 +00:00
|
|
|
|
2022-08-01 07:04:23 +00:00
|
|
|
/**
|
2021-04-29 09:24:39 +00:00
|
|
|
* The children of the component.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
children: React.ReactNode;
|
2022-11-03 08:35:51 +00:00
|
|
|
}
|
2021-04-29 09:24:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The theme provider for the web app.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The props of the component.
|
|
|
|
* @returns {React.ReactNode}
|
|
|
|
*/
|
2022-11-03 08:35:51 +00:00
|
|
|
function JitsiThemeProvider(props: IProps) {
|
2022-09-13 07:36:00 +00:00
|
|
|
return (
|
|
|
|
<StyledEngineProvider injectFirst = { true }>
|
|
|
|
<ThemeProvider theme = { props._theme }>{ props.children }</ThemeProvider>
|
|
|
|
</StyledEngineProvider>
|
|
|
|
);
|
2021-04-29 09:24:39 +00:00
|
|
|
}
|
2021-11-15 08:37:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
2022-11-03 08:35:51 +00:00
|
|
|
* @returns {IProps}
|
2021-11-15 08:37:54 +00:00
|
|
|
*/
|
2022-10-20 09:11:27 +00:00
|
|
|
function _mapStateToProps(state: IReduxState) {
|
2021-11-15 08:37:54 +00:00
|
|
|
const { muiBrandedTheme } = state['features/dynamic-branding'];
|
|
|
|
|
|
|
|
return {
|
|
|
|
_theme: muiBrandedTheme || BaseTheme
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(JitsiThemeProvider);
|