diff options
author | muhamedsalih-tw <104364298+muhamedsalih-tw@users.noreply.github.com> | 2022-10-25 12:51:28 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 07:21:28 +0000 |
commit | f79727a8632490f11c1423773fdd6adfb6337a7b (patch) | |
tree | a80943f4e4e571359c8104341a3957f6e763dce4 /src/components/auth | |
parent | add balajiv113 as a contributor for code (#701) [skip ci] (diff) | |
download | ferdium-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 @@ | |||
1 | import { cloneElement, Component } from 'react'; | 1 | import { |
2 | import PropTypes from 'prop-types'; | 2 | cloneElement, |
3 | Component, | ||
4 | MouseEventHandler, | ||
5 | ReactElement, | ||
6 | } from 'react'; | ||
3 | import { observer } from 'mobx-react'; | 7 | import { observer } from 'mobx-react'; |
4 | import { TitleBar } from 'electron-react-titlebar/renderer'; | 8 | import { TitleBar } from 'electron-react-titlebar/renderer'; |
5 | 9 | import { injectIntl, WrappedComponentProps } from 'react-intl'; | |
6 | import { injectIntl } from 'react-intl'; | ||
7 | import { mdiFlash } from '@mdi/js'; | 10 | import { mdiFlash } from '@mdi/js'; |
11 | import { GlobalError } from '../../@types/ferdium-components.types'; | ||
8 | import Link from '../ui/Link'; | 12 | import Link from '../ui/Link'; |
9 | import InfoBar from '../ui/InfoBar'; | 13 | import InfoBar from '../ui/InfoBar'; |
10 | |||
11 | import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; | 14 | import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; |
12 | |||
13 | import { | ||
14 | oneOrManyChildElements, | ||
15 | globalError as globalErrorPropType, | ||
16 | } from '../../prop-types'; | ||
17 | import { updateVersionParse } from '../../helpers/update-helpers'; | 15 | import { updateVersionParse } from '../../helpers/update-helpers'; |
18 | import globalMessages from '../../i18n/globalMessages'; | 16 | import globalMessages from '../../i18n/globalMessages'; |
19 | |||
20 | import { isWindows } from '../../environment'; | 17 | import { isWindows } from '../../environment'; |
21 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; | 18 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; |
22 | import { GITHUB_FERDIUM_URL } from '../../config'; | 19 | import { GITHUB_FERDIUM_URL } from '../../config'; |
23 | import Icon from '../ui/icon'; | 20 | import Icon from '../ui/icon'; |
24 | |||
25 | import { serverName } from '../../api/apiBase'; | 21 | import { serverName } from '../../api/apiBase'; |
26 | 22 | ||
27 | class AuthLayout extends Component { | 23 | export 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 | |
36 | interface IState { | ||
37 | shouldShowAppUpdateInfoBar: boolean; | ||
38 | } | ||
40 | 39 | ||
41 | constructor() { | 40 | @observer |
42 | super(); | 41 | class 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 | ||
127 | export default injectIntl(observer(AuthLayout)); | 128 | export default injectIntl(AuthLayout); |