Chore: Evaluate WorkspaceView - TypeScript (#4077)

This commit is contained in:
Reinaldo Neto 2022-05-02 22:27:33 -03:00 committed by GitHub
parent 83fb5ce7fb
commit 82bca54575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 12 deletions

View File

@ -0,0 +1,4 @@
export interface IAssetsFavicon512 {
url?: string;
defaultUrl: string;
}

View File

@ -1,9 +1,10 @@
import { IActionSettings } from '../actions/settings'; import { IActionSettings } from '../actions/settings';
import { SETTINGS } from '../actions/actionsTypes'; import { SETTINGS } from '../actions/actionsTypes';
import { defaultSettings } from '../lib/constants'; import { defaultSettings } from '../lib/constants';
import { IAssetsFavicon512 } from '../definitions/IAssetsFavicon512';
export type TSupportedSettings = keyof typeof defaultSettings; export type TSupportedSettings = keyof typeof defaultSettings;
export type TSettingsValues = string | number | boolean | string[]; export type TSettingsValues = string | number | boolean | string[] | IAssetsFavicon512;
export type TSettingsState = { export type TSettingsState = {
[K in TSupportedSettings]?: TSettingsValues; [K in TSupportedSettings]?: TSettingsValues;

View File

@ -10,6 +10,8 @@ import Button from '../../containers/Button';
import { themes } from '../../lib/constants'; import { themes } from '../../lib/constants';
import { TSupportedThemes, withTheme } from '../../theme'; import { TSupportedThemes, withTheme } from '../../theme';
import FormContainer, { FormContainerInner } from '../../containers/FormContainer'; import FormContainer, { FormContainerInner } from '../../containers/FormContainer';
import { IApplicationState } from '../../definitions';
import { IAssetsFavicon512 } from '../../definitions/IAssetsFavicon512';
import { getShowLoginButton } from '../../selectors/login'; import { getShowLoginButton } from '../../selectors/login';
import ServerAvatar from './ServerAvatar'; import ServerAvatar from './ServerAvatar';
import styles from './styles'; import styles from './styles';
@ -23,10 +25,7 @@ interface IWorkSpaceProp {
Site_Name: string; Site_Name: string;
Site_Url: string; Site_Url: string;
server: string; server: string;
Assets_favicon_512: { Assets_favicon_512: IAssetsFavicon512;
url?: string;
defaultUrl: string;
};
registrationForm: string; registrationForm: string;
registrationText: string; registrationText: string;
showLoginButton: boolean; showLoginButton: boolean;
@ -102,14 +101,14 @@ class WorkspaceView extends React.Component<IWorkSpaceProp, any> {
} }
} }
const mapStateToProps = (state: any) => ({ const mapStateToProps = (state: IApplicationState) => ({
server: state.server.server, server: state.server.server,
Site_Name: state.settings.Site_Name, Site_Name: state.settings.Site_Name as string,
Site_Url: state.settings.Site_Url, Site_Url: state.settings.Site_Url as string,
Assets_favicon_512: state.settings.Assets_favicon_512, Assets_favicon_512: state.settings.Assets_favicon_512 as IAssetsFavicon512,
registrationForm: state.settings.Accounts_RegistrationForm, registrationForm: state.settings.Accounts_RegistrationForm as string,
registrationText: state.settings.Accounts_RegistrationForm_LinkReplacementText, registrationText: state.settings.Accounts_RegistrationForm_LinkReplacementText as string,
Accounts_iframe_enabled: state.settings.Accounts_iframe_enabled, Accounts_iframe_enabled: state.settings.Accounts_iframe_enabled as boolean,
showLoginButton: getShowLoginButton(state), showLoginButton: getShowLoginButton(state),
inviteLinkToken: state.inviteLinks.token inviteLinkToken: state.inviteLinks.token
}); });