diff options
-rw-r--r-- | src/app.tsx (renamed from src/app.jsx) | 1 | ||||
-rw-r--r-- | src/components/settings/releaseNotes/ReleaseNotesLayout.tsx | 20 | ||||
-rw-r--r-- | src/containers/layout/AppLayoutContainer.tsx | 4 | ||||
-rw-r--r-- | src/containers/settings/ReleaseNotesWindow.tsx | 15 | ||||
-rw-r--r-- | src/index.html | 5 | ||||
-rw-r--r-- | src/routes.tsx | 19 |
6 files changed, 47 insertions, 17 deletions
diff --git a/src/app.jsx b/src/app.tsx index 87297c664..4782bb778 100644 --- a/src/app.jsx +++ b/src/app.tsx | |||
@@ -24,6 +24,7 @@ window.addEventListener('load', () => { | |||
24 | const api = apiFactory(serverApi, new LocalApi()); | 24 | const api = apiFactory(serverApi, new LocalApi()); |
25 | const history = createHashHistory(); | 25 | const history = createHashHistory(); |
26 | const router = new RouterStore(history); | 26 | const router = new RouterStore(history); |
27 | // @ts-ignore - Need to provide proper typings for actions | ||
27 | const stores = storeFactory(api, actions, router); | 28 | const stores = storeFactory(api, actions, router); |
28 | const menu = new MenuFactory(stores, actions); | 29 | const menu = new MenuFactory(stores, actions); |
29 | const touchBar = new TouchBarFactory(stores, actions); | 30 | const touchBar = new TouchBarFactory(stores, actions); |
diff --git a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx index ee0ba75a8..00c618913 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx | |||
@@ -1,14 +1,15 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import { inject, observer } from 'mobx-react'; | 2 | import { inject, observer } from 'mobx-react'; |
3 | import { defineMessages, injectIntl } from 'react-intl'; | 3 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; |
4 | 4 | ||
5 | import { mdiClose } from '@mdi/js'; | 5 | import { mdiClose } from '@mdi/js'; |
6 | import { Outlet } from 'react-router-dom'; | 6 | import { Outlet } from 'react-router-dom'; |
7 | import { StoresProps } from '../../../@types/ferdium-components.types'; | ||
8 | import ErrorBoundary from '../../util/ErrorBoundary'; | 7 | import ErrorBoundary from '../../util/ErrorBoundary'; |
9 | import Appear from '../../ui/effects/Appear'; | 8 | import Appear from '../../ui/effects/Appear'; |
10 | import Icon from '../../ui/icon'; | 9 | import Icon from '../../ui/icon'; |
11 | import { isEscKeyPress } from '../../../jsUtils'; | 10 | import { isEscKeyPress } from '../../../jsUtils'; |
11 | import { Actions } from '../../../actions/lib/actions'; | ||
12 | import { RealStores } from '../../../stores'; | ||
12 | 13 | ||
13 | const messages = defineMessages({ | 14 | const messages = defineMessages({ |
14 | closeSettings: { | 15 | closeSettings: { |
@@ -17,10 +18,13 @@ const messages = defineMessages({ | |||
17 | }, | 18 | }, |
18 | }); | 19 | }); |
19 | 20 | ||
20 | interface IProps extends StoresProps { | 21 | interface IProps extends WrappedComponentProps { |
21 | intl: any; | 22 | actions?: Actions; |
23 | stores?: RealStores; | ||
22 | } | 24 | } |
23 | 25 | ||
26 | @inject('stores', 'actions') | ||
27 | @observer | ||
24 | class ReleaseNotesLayout extends Component<IProps> { | 28 | class ReleaseNotesLayout extends Component<IProps> { |
25 | componentDidMount() { | 29 | componentDidMount() { |
26 | document.addEventListener('keydown', this.handleKeyDown.bind(this), false); | 30 | document.addEventListener('keydown', this.handleKeyDown.bind(this), false); |
@@ -37,12 +41,12 @@ class ReleaseNotesLayout extends Component<IProps> { | |||
37 | 41 | ||
38 | handleKeyDown(e) { | 42 | handleKeyDown(e) { |
39 | if (isEscKeyPress(e.keyCode)) { | 43 | if (isEscKeyPress(e.keyCode)) { |
40 | this.props.actions.ui.closeSettings(); | 44 | this.props.actions!.ui.closeSettings(); |
41 | } | 45 | } |
42 | } | 46 | } |
43 | 47 | ||
44 | render() { | 48 | render() { |
45 | const { closeSettings } = this.props.actions.ui; | 49 | const { closeSettings } = this.props.actions!.ui; |
46 | 50 | ||
47 | const { intl } = this.props; | 51 | const { intl } = this.props; |
48 | 52 | ||
@@ -74,6 +78,4 @@ class ReleaseNotesLayout extends Component<IProps> { | |||
74 | } | 78 | } |
75 | } | 79 | } |
76 | 80 | ||
77 | export default injectIntl<'intl', IProps>( | 81 | export default injectIntl<'intl', IProps>(ReleaseNotesLayout); |
78 | inject('stores', 'actions')(observer(ReleaseNotesLayout)), | ||
79 | ); | ||
diff --git a/src/containers/layout/AppLayoutContainer.tsx b/src/containers/layout/AppLayoutContainer.tsx index a5fea52cd..0864fa027 100644 --- a/src/containers/layout/AppLayoutContainer.tsx +++ b/src/containers/layout/AppLayoutContainer.tsx | |||
@@ -13,6 +13,8 @@ import { workspaceStore } from '../../features/workspaces'; | |||
13 | 13 | ||
14 | interface AppLayoutContainerProps extends StoresProps {} | 14 | interface AppLayoutContainerProps extends StoresProps {} |
15 | 15 | ||
16 | @inject('stores', 'actions') | ||
17 | @observer | ||
16 | class AppLayoutContainer extends Component<AppLayoutContainerProps> { | 18 | class AppLayoutContainer extends Component<AppLayoutContainerProps> { |
17 | render(): ReactElement { | 19 | render(): ReactElement { |
18 | const { app, features, services, ui, settings, requests, user, router } = | 20 | const { app, features, services, ui, settings, requests, user, router } = |
@@ -155,4 +157,4 @@ class AppLayoutContainer extends Component<AppLayoutContainerProps> { | |||
155 | } | 157 | } |
156 | } | 158 | } |
157 | 159 | ||
158 | export default inject('stores', 'actions')(observer(AppLayoutContainer)); | 160 | export default AppLayoutContainer; |
diff --git a/src/containers/settings/ReleaseNotesWindow.tsx b/src/containers/settings/ReleaseNotesWindow.tsx index 3e43727d0..ea7b952d2 100644 --- a/src/containers/settings/ReleaseNotesWindow.tsx +++ b/src/containers/settings/ReleaseNotesWindow.tsx | |||
@@ -6,8 +6,17 @@ import { Outlet } from 'react-router-dom'; | |||
6 | import { StoresProps } from '../../@types/ferdium-components.types'; | 6 | import { StoresProps } from '../../@types/ferdium-components.types'; |
7 | import Layout from '../../components/settings/releaseNotes/ReleaseNotesLayout'; | 7 | import Layout from '../../components/settings/releaseNotes/ReleaseNotesLayout'; |
8 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | 8 | import ErrorBoundary from '../../components/util/ErrorBoundary'; |
9 | import { Actions } from '../../actions/lib/actions'; | ||
10 | import { RealStores } from '../../stores'; | ||
9 | 11 | ||
10 | class SettingsContainer extends Component<StoresProps> { | 12 | interface IProps { |
13 | actions?: Actions; | ||
14 | stores?: RealStores; | ||
15 | } | ||
16 | |||
17 | @inject('stores', 'actions') | ||
18 | @observer | ||
19 | class SettingsContainer extends Component<IProps> { | ||
11 | portalRoot: any; | 20 | portalRoot: any; |
12 | 21 | ||
13 | el: HTMLDivElement; | 22 | el: HTMLDivElement; |
@@ -30,7 +39,7 @@ class SettingsContainer extends Component<StoresProps> { | |||
30 | render(): ReactPortal { | 39 | render(): ReactPortal { |
31 | return ReactDOM.createPortal( | 40 | return ReactDOM.createPortal( |
32 | <ErrorBoundary> | 41 | <ErrorBoundary> |
33 | <Layout {...this.props}> | 42 | <Layout> |
34 | <Outlet /> | 43 | <Outlet /> |
35 | </Layout> | 44 | </Layout> |
36 | </ErrorBoundary>, | 45 | </ErrorBoundary>, |
@@ -39,4 +48,4 @@ class SettingsContainer extends Component<StoresProps> { | |||
39 | } | 48 | } |
40 | } | 49 | } |
41 | 50 | ||
42 | export default inject('stores', 'actions')(observer(SettingsContainer)); | 51 | export default SettingsContainer; |
diff --git a/src/index.html b/src/index.html index e50ec8777..72b131f04 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -11,7 +11,10 @@ | |||
11 | href="./styles/animations.css" | 11 | href="./styles/animations.css" |
12 | media="(prefers-reduced-motion: no-preference)" | 12 | media="(prefers-reduced-motion: no-preference)" |
13 | /> | 13 | /> |
14 | <script type="text/javascript" src="./app.js"></script> | 14 | <script> |
15 | require("./app.js") | ||
16 | </script> | ||
17 | |||
15 | </head> | 18 | </head> |
16 | <body> | 19 | <body> |
17 | <div class="dev-warning">DEV MODE</div> | 20 | <div class="dev-warning">DEV MODE</div> |
diff --git a/src/routes.tsx b/src/routes.tsx index e757de72b..27ed6259c 100644 --- a/src/routes.tsx +++ b/src/routes.tsx | |||
@@ -34,9 +34,14 @@ import WorkspacesScreen from './features/workspaces/containers/WorkspacesScreen' | |||
34 | import EditWorkspaceScreen from './features/workspaces/containers/EditWorkspaceScreen'; | 34 | import EditWorkspaceScreen from './features/workspaces/containers/EditWorkspaceScreen'; |
35 | import { WORKSPACES_ROUTES } from './features/workspaces/constants'; | 35 | import { WORKSPACES_ROUTES } from './features/workspaces/constants'; |
36 | import { StoresProps } from './@types/ferdium-components.types'; | 36 | import { StoresProps } from './@types/ferdium-components.types'; |
37 | import { Actions } from './actions/lib/actions'; | ||
38 | import { RealStores } from './stores'; | ||
37 | 39 | ||
38 | interface IProps extends StoresProps { | 40 | interface IProps { |
39 | history: HashHistory; | 41 | history: HashHistory; |
42 | |||
43 | actions?: Actions; | ||
44 | stores?: RealStores; | ||
40 | } | 45 | } |
41 | 46 | ||
42 | @inject('stores', 'actions') | 47 | @inject('stores', 'actions') |
@@ -44,8 +49,8 @@ interface IProps extends StoresProps { | |||
44 | class FerdiumRoutes extends Component<IProps> { | 49 | class FerdiumRoutes extends Component<IProps> { |
45 | render(): ReactElement { | 50 | render(): ReactElement { |
46 | const { history, stores, actions } = this.props; | 51 | const { history, stores, actions } = this.props; |
47 | const routeProps: StoresProps = { stores, actions }; | 52 | const routeProps: StoresProps = { stores: stores!, actions: actions! }; |
48 | const errorProps = { error: this.props.stores.globalError.error || {} }; | 53 | const errorProps = { error: routeProps.stores.globalError.error || {} }; |
49 | 54 | ||
50 | return ( | 55 | return ( |
51 | <HistoryRouter history={history}> | 56 | <HistoryRouter history={history}> |
@@ -129,6 +134,7 @@ class FerdiumRoutes extends Component<IProps> { | |||
129 | /> | 134 | /> |
130 | <Route | 135 | <Route |
131 | path="/settings/services" | 136 | path="/settings/services" |
137 | /* @ts-ignore */ | ||
132 | element={<ServicesScreen {...this.props} />} | 138 | element={<ServicesScreen {...this.props} />} |
133 | /> | 139 | /> |
134 | <Route | 140 | <Route |
@@ -137,30 +143,37 @@ class FerdiumRoutes extends Component<IProps> { | |||
137 | /> | 143 | /> |
138 | <Route | 144 | <Route |
139 | path={WORKSPACES_ROUTES.ROOT} | 145 | path={WORKSPACES_ROUTES.ROOT} |
146 | /* @ts-ignore */ | ||
140 | element={<WorkspacesScreen {...this.props} />} | 147 | element={<WorkspacesScreen {...this.props} />} |
141 | /> | 148 | /> |
142 | <Route | 149 | <Route |
143 | path={WORKSPACES_ROUTES.EDIT} | 150 | path={WORKSPACES_ROUTES.EDIT} |
151 | /* @ts-ignore */ | ||
144 | element={<EditWorkspaceScreen {...this.props} />} | 152 | element={<EditWorkspaceScreen {...this.props} />} |
145 | /> | 153 | /> |
146 | <Route | 154 | <Route |
147 | path="/settings/user" | 155 | path="/settings/user" |
156 | /* @ts-ignore */ | ||
148 | element={<AccountScreen {...this.props} />} | 157 | element={<AccountScreen {...this.props} />} |
149 | /> | 158 | /> |
150 | <Route | 159 | <Route |
151 | path="/settings/user/edit" | 160 | path="/settings/user/edit" |
161 | /* @ts-ignore */ | ||
152 | element={<EditUserScreen {...this.props} />} | 162 | element={<EditUserScreen {...this.props} />} |
153 | /> | 163 | /> |
154 | <Route | 164 | <Route |
155 | path="/settings/team" | 165 | path="/settings/team" |
166 | /* @ts-ignore */ | ||
156 | element={<TeamScreen {...this.props} />} | 167 | element={<TeamScreen {...this.props} />} |
157 | /> | 168 | /> |
158 | <Route | 169 | <Route |
159 | path="/settings/app" | 170 | path="/settings/app" |
171 | /* @ts-ignore */ | ||
160 | element={<EditSettingsScreen {...this.props} />} | 172 | element={<EditSettingsScreen {...this.props} />} |
161 | /> | 173 | /> |
162 | <Route | 174 | <Route |
163 | path="/settings/invite" | 175 | path="/settings/invite" |
176 | /* @ts-ignore */ | ||
164 | element={<InviteSettingsScreen {...this.props} />} | 177 | element={<InviteSettingsScreen {...this.props} />} |
165 | /> | 178 | /> |
166 | <Route | 179 | <Route |