aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/auth
diff options
context:
space:
mode:
authorLibravatar muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com>2022-10-25 12:51:28 +0530
committerLibravatar GitHub <noreply@github.com>2022-10-25 07:21:28 +0000
commitf79727a8632490f11c1423773fdd6adfb6337a7b (patch)
treea80943f4e4e571359c8104341a3957f6e763dce4 /src/components/auth
parentadd balajiv113 as a contributor for code (#701) [skip ci] (diff)
downloadferdium-app-f79727a8632490f11c1423773fdd6adfb6337a7b.tar.gz
ferdium-app-f79727a8632490f11c1423773fdd6adfb6337a7b.tar.zst
ferdium-app-f79727a8632490f11c1423773fdd6adfb6337a7b.zip
Transform 'AuthLayoutContainer' component hierarchy to tsx (#699)
Co-authored-by: Muhamed <> Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/components/auth')
-rw-r--r--src/components/auth/AuthLayout.tsx (renamed from src/components/auth/AuthLayout.jsx)61
1 files changed, 31 insertions, 30 deletions
diff --git a/src/components/auth/AuthLayout.jsx b/src/components/auth/AuthLayout.tsx
index 5c87c3080..527c2bb74 100644
--- a/src/components/auth/AuthLayout.jsx
+++ b/src/components/auth/AuthLayout.tsx
@@ -1,52 +1,53 @@
1import { cloneElement, Component } from 'react'; 1import {
2import PropTypes from 'prop-types'; 2 cloneElement,
3 Component,
4 MouseEventHandler,
5 ReactElement,
6} from 'react';
3import { observer } from 'mobx-react'; 7import { observer } from 'mobx-react';
4import { TitleBar } from 'electron-react-titlebar/renderer'; 8import { TitleBar } from 'electron-react-titlebar/renderer';
5 9import { injectIntl, WrappedComponentProps } from 'react-intl';
6import { injectIntl } from 'react-intl';
7import { mdiFlash } from '@mdi/js'; 10import { mdiFlash } from '@mdi/js';
11import { GlobalError } from '../../@types/ferdium-components.types';
8import Link from '../ui/Link'; 12import Link from '../ui/Link';
9import InfoBar from '../ui/InfoBar'; 13import InfoBar from '../ui/InfoBar';
10
11import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; 14import { Component as PublishDebugInfo } from '../../features/publishDebugInfo';
12
13import {
14 oneOrManyChildElements,
15 globalError as globalErrorPropType,
16} from '../../prop-types';
17import { updateVersionParse } from '../../helpers/update-helpers'; 15import { updateVersionParse } from '../../helpers/update-helpers';
18import globalMessages from '../../i18n/globalMessages'; 16import globalMessages from '../../i18n/globalMessages';
19
20import { isWindows } from '../../environment'; 17import { isWindows } from '../../environment';
21import AppUpdateInfoBar from '../AppUpdateInfoBar'; 18import AppUpdateInfoBar from '../AppUpdateInfoBar';
22import { GITHUB_FERDIUM_URL } from '../../config'; 19import { GITHUB_FERDIUM_URL } from '../../config';
23import Icon from '../ui/icon'; 20import Icon from '../ui/icon';
24
25import { serverName } from '../../api/apiBase'; 21import { serverName } from '../../api/apiBase';
26 22
27class AuthLayout extends Component { 23export interface IProps extends WrappedComponentProps {
28 static propTypes = { 24 children: ReactElement;
29 children: oneOrManyChildElements.isRequired, 25 error: GlobalError;
30 error: globalErrorPropType.isRequired, 26 isOnline: boolean;
31 isOnline: PropTypes.bool.isRequired, 27 isAPIHealthy: boolean;
32 isAPIHealthy: PropTypes.bool.isRequired, 28 retryHealthCheck: MouseEventHandler<HTMLButtonElement>;
33 retryHealthCheck: PropTypes.func.isRequired, 29 isHealthCheckLoading: boolean;
34 isHealthCheckLoading: PropTypes.bool.isRequired, 30 isFullScreen: boolean;
35 isFullScreen: PropTypes.bool.isRequired, 31 installAppUpdate: MouseEventHandler<HTMLButtonElement>;
36 installAppUpdate: PropTypes.func.isRequired, 32 appUpdateIsDownloaded: boolean;
37 appUpdateIsDownloaded: PropTypes.bool.isRequired, 33 updateVersion: string;
38 updateVersion: PropTypes.string.isRequired, 34}
39 }; 35
36interface IState {
37 shouldShowAppUpdateInfoBar: boolean;
38}
40 39
41 constructor() { 40@observer
42 super(); 41class AuthLayout extends Component<IProps, IState> {
42 constructor(props: IProps) {
43 super(props);
43 44
44 this.state = { 45 this.state = {
45 shouldShowAppUpdateInfoBar: true, 46 shouldShowAppUpdateInfoBar: true,
46 }; 47 };
47 } 48 }
48 49
49 render() { 50 render(): ReactElement {
50 const { 51 const {
51 children, 52 children,
52 error, 53 error,
@@ -58,9 +59,9 @@ class AuthLayout extends Component {
58 installAppUpdate, 59 installAppUpdate,
59 appUpdateIsDownloaded, 60 appUpdateIsDownloaded,
60 updateVersion, 61 updateVersion,
62 intl,
61 } = this.props; 63 } = this.props;
62 64
63 const { intl } = this.props;
64 let serverNameParse = serverName(); 65 let serverNameParse = serverName();
65 serverNameParse = 66 serverNameParse =
66 serverNameParse === 'Custom' ? 'your Custom Server' : serverNameParse; 67 serverNameParse === 'Custom' ? 'your Custom Server' : serverNameParse;
@@ -124,4 +125,4 @@ class AuthLayout extends Component {
124 } 125 }
125} 126}
126 127
127export default injectIntl(observer(AuthLayout)); 128export default injectIntl(AuthLayout);