aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers
diff options
context:
space:
mode:
authorLibravatar Balaji Vijayakumar <kuttibalaji.v6@gmail.com>2022-10-25 10:27:51 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-10-25 12:12:56 +0530
commit4906216e21c05f603647ff9a883e012a8aec60ca (patch)
tree386cba77e78febde26f4173d4f5d324046048af8 /src/containers
parent6.2.1-nightly.28 [skip ci] (diff)
downloadferdium-app-4906216e21c05f603647ff9a883e012a8aec60ca.tar.gz
ferdium-app-4906216e21c05f603647ff9a883e012a8aec60ca.tar.zst
ferdium-app-4906216e21c05f603647ff9a883e012a8aec60ca.zip
refactor: convert AppLayout to typescript
Diffstat (limited to 'src/containers')
-rw-r--r--src/containers/auth/LockedScreen.tsx23
-rw-r--r--src/containers/layout/AppLayoutContainer.tsx15
2 files changed, 18 insertions, 20 deletions
diff --git a/src/containers/auth/LockedScreen.tsx b/src/containers/auth/LockedScreen.tsx
index 1b703207f..611a0757c 100644
--- a/src/containers/auth/LockedScreen.tsx
+++ b/src/containers/auth/LockedScreen.tsx
@@ -4,8 +4,17 @@ import { StoresProps } from '../../@types/ferdium-components.types';
4import Locked from '../../components/auth/Locked'; 4import Locked from '../../components/auth/Locked';
5 5
6import { hash } from '../../helpers/password-helpers'; 6import { hash } from '../../helpers/password-helpers';
7import { Actions } from '../../actions/lib/actions';
8import { RealStores } from '../../stores';
7 9
8class LockedScreen extends Component<StoresProps> { 10interface IProps {
11 actions?: Actions;
12 stores?: RealStores;
13}
14
15@inject('stores', 'actions')
16@observer
17class LockedScreen extends Component<IProps> {
9 state = { 18 state = {
10 error: false, 19 error: false,
11 }; 20 };
@@ -20,13 +29,13 @@ class LockedScreen extends Component<StoresProps> {
20 onSubmit(values: any): void { 29 onSubmit(values: any): void {
21 const { password } = values; 30 const { password } = values;
22 31
23 let correctPassword = this.props.stores.settings.all.app.lockedPassword; 32 let correctPassword = this.props.stores!.settings.all.app.lockedPassword;
24 if (!correctPassword) { 33 if (!correctPassword) {
25 correctPassword = ''; 34 correctPassword = '';
26 } 35 }
27 36
28 if (hash(String(password)) === String(correctPassword)) { 37 if (hash(String(password)) === String(correctPassword)) {
29 this.props.actions.settings.update({ 38 this.props.actions!.settings.update({
30 type: 'app', 39 type: 'app',
31 data: { 40 data: {
32 locked: false, 41 locked: false,
@@ -42,7 +51,7 @@ class LockedScreen extends Component<StoresProps> {
42 } 51 }
43 52
44 unlock(): void { 53 unlock(): void {
45 this.props.actions.settings.update({ 54 this.props.actions!.settings.update({
46 type: 'app', 55 type: 'app',
47 data: { 56 data: {
48 locked: false, 57 locked: false,
@@ -52,7 +61,7 @@ class LockedScreen extends Component<StoresProps> {
52 61
53 render(): ReactElement { 62 render(): ReactElement {
54 const { stores } = this.props; 63 const { stores } = this.props;
55 const { useTouchIdToUnlock } = this.props.stores.settings.all.app; 64 const { useTouchIdToUnlock } = this.props.stores!.settings.all.app;
56 65
57 return ( 66 return (
58 <div className="auth"> 67 <div className="auth">
@@ -61,7 +70,7 @@ class LockedScreen extends Component<StoresProps> {
61 onSubmit={this.onSubmit} 70 onSubmit={this.onSubmit}
62 unlock={this.unlock} 71 unlock={this.unlock}
63 useTouchIdToUnlock={useTouchIdToUnlock} 72 useTouchIdToUnlock={useTouchIdToUnlock}
64 isSubmitting={stores.user.loginRequest.isExecuting} 73 isSubmitting={stores!.user.loginRequest.isExecuting}
65 error={this.state.error || {}} 74 error={this.state.error || {}}
66 /> 75 />
67 </div> 76 </div>
@@ -70,4 +79,4 @@ class LockedScreen extends Component<StoresProps> {
70 } 79 }
71} 80}
72 81
73export default inject('stores', 'actions')(observer(LockedScreen)); 82export default LockedScreen;
diff --git a/src/containers/layout/AppLayoutContainer.tsx b/src/containers/layout/AppLayoutContainer.tsx
index 9c03b0ba4..a5fea52cd 100644
--- a/src/containers/layout/AppLayoutContainer.tsx
+++ b/src/containers/layout/AppLayoutContainer.tsx
@@ -15,17 +15,8 @@ interface AppLayoutContainerProps extends StoresProps {}
15 15
16class AppLayoutContainer extends Component<AppLayoutContainerProps> { 16class AppLayoutContainer extends Component<AppLayoutContainerProps> {
17 render(): ReactElement { 17 render(): ReactElement {
18 const { 18 const { app, features, services, ui, settings, requests, user, router } =
19 app, 19 this.props.stores;
20 features,
21 services,
22 ui,
23 settings,
24 globalError,
25 requests,
26 user,
27 router,
28 } = this.props.stores;
29 20
30 /* HOTFIX for: 21 /* HOTFIX for:
31 [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[bound ]' TypeError: Cannot read properties of null (reading 'push') 22 [mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: 'Reaction[bound ]' TypeError: Cannot read properties of null (reading 'push')
@@ -142,7 +133,6 @@ class AppLayoutContainer extends Component<AppLayoutContainerProps> {
142 <AppLayout 133 <AppLayout
143 settings={settings} 134 settings={settings}
144 isFullScreen={app.isFullScreen} 135 isFullScreen={app.isFullScreen}
145 isOnline={app.isOnline}
146 showServicesUpdatedInfoBar={ui.showServicesUpdatedInfoBar} 136 showServicesUpdatedInfoBar={ui.showServicesUpdatedInfoBar}
147 appUpdateIsDownloaded={ 137 appUpdateIsDownloaded={
148 app.updateStatus === app.updateStatusTypes.DOWNLOADED 138 app.updateStatus === app.updateStatusTypes.DOWNLOADED
@@ -152,7 +142,6 @@ class AppLayoutContainer extends Component<AppLayoutContainerProps> {
152 workspacesDrawer={workspacesDrawer} 142 workspacesDrawer={workspacesDrawer}
153 services={servicesContainer} 143 services={servicesContainer}
154 installAppUpdate={installUpdate} 144 installAppUpdate={installUpdate}
155 globalError={globalError.error}
156 showRequiredRequestsError={requests.showRequiredRequestsError} 145 showRequiredRequestsError={requests.showRequiredRequestsError}
157 areRequiredRequestsSuccessful={requests.areRequiredRequestsSuccessful} 146 areRequiredRequestsSuccessful={requests.areRequiredRequestsSuccessful}
158 retryRequiredRequests={retryRequiredRequests} 147 retryRequiredRequests={retryRequiredRequests}