Skip to content

Commit

Permalink
yauheni/74383/ converting app.jsx in account to functional component (b…
Browse files Browse the repository at this point in the history
…inary-com#6282)

* yauheni/74383/ converting app in account to functional component

* converted to tsx with rootstore

* added todo for future types implementation

Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”>
Co-authored-by: Matin shafiei <matin@deriv.com>
Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
  • Loading branch information
4 people committed Sep 27, 2022
1 parent 82076cb commit e1fc3e8
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 40 deletions.
2 changes: 1 addition & 1 deletion packages/account/build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function (env) {
context: path.resolve(__dirname, '../src'),
devtool: IS_RELEASE ? undefined : 'eval-cheap-module-source-map',
entry: {
account: path.resolve(__dirname, '../src', 'index.js'),
account: path.resolve(__dirname, '../src', 'index.tsx'),
'accept-risk-config': 'Configs/accept-risk-config',
'account-limits': 'Components/account-limits',
'address-details': 'Components/address-details',
Expand Down
28 changes: 0 additions & 28 deletions packages/account/src/App.jsx

This file was deleted.

28 changes: 28 additions & 0 deletions packages/account/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import Routes from 'Containers/routes.jsx';
import ResetTradingPassword from 'Containers/reset-trading-password.jsx';
import { MobxContentProvider } from 'Stores/connect';
import initStore from 'Stores/init-store';
import { TCoreStore } from 'Stores/index';

// TODO: add correct types for stores and WS after implementing them
type TAppProps = {
passthrough: {
root_store: TCoreStore;
WS: Record<string, any>;
};
};

const App = ({ passthrough }: TAppProps) => {
const { root_store, WS } = passthrough;
initStore(root_store, WS);

return (
<MobxContentProvider store={root_store}>
<Routes />
<ResetTradingPassword />
</MobxContentProvider>
);
};

export default App;
10 changes: 0 additions & 10 deletions packages/account/src/Stores/index.js

This file was deleted.

26 changes: 26 additions & 0 deletions packages/account/src/Stores/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export type TCoreStore = {
client: Record<string, any>;
common: Record<string, any>;
ui: Record<string, any>;
gtm: Record<string, any>;
rudderstack: Record<string, any>;
pushwoosh: Record<string, any>;
};

export default class RootStore {
public client: Record<string, any>;
public common: Record<string, any>;
public ui: Record<string, any>;
public gtm: Record<string, any>;
public rudderstack: Record<string, any>;
public pushwoosh: Record<string, any>;

constructor(core_store: TCoreStore) {
this.client = core_store.client;
this.common = core_store.common;
this.ui = core_store.ui;
this.gtm = core_store.gtm;
this.rudderstack = core_store.rudderstack;
this.pushwoosh = core_store.pushwoosh;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeLazyLoader, moduleLoader } from '@deriv/shared';
import { Loading } from '@deriv/components';

const App = makeLazyLoader(
() => moduleLoader(() => import(/* webpackChunkName: "account-app", webpackPreload: true */ './App.jsx')),
() => moduleLoader(() => import(/* webpackChunkName: "account-app", webpackPreload: true */ './App')),
() => <Loading />
)();

Expand Down

0 comments on commit e1fc3e8

Please sign in to comment.