diff options
author | Balaji Vijayakumar <kuttibalaji.v6@gmail.com> | 2022-10-31 16:14:30 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-31 10:44:30 +0000 |
commit | 87bc593ac72af503171f759fc6e4b1e9e0813039 (patch) | |
tree | 7128adb5cc48ae36104c4d3e6de219b9de1ac446 /src/app.jsx | |
parent | Convert web controls & screen to typescript (#722) (diff) | |
download | ferdium-app-87bc593ac72af503171f759fc6e4b1e9e0813039.tar.gz ferdium-app-87bc593ac72af503171f759fc6e4b1e9e0813039.tar.zst ferdium-app-87bc593ac72af503171f759fc6e4b1e9e0813039.zip |
refactor: convert global app to typescript (#723)
Diffstat (limited to 'src/app.jsx')
-rw-r--r-- | src/app.jsx | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/app.jsx b/src/app.jsx deleted file mode 100644 index 87297c664..000000000 --- a/src/app.jsx +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | import { webFrame } from 'electron'; | ||
2 | |||
3 | import { render } from 'react-dom'; | ||
4 | import { Provider } from 'mobx-react'; | ||
5 | import { RouterStore } from '@superwf/mobx-react-router'; | ||
6 | import { createHashHistory } from 'history'; | ||
7 | |||
8 | import ServerApi from './api/server/ServerApi'; | ||
9 | import LocalApi from './api/server/LocalApi'; | ||
10 | import storeFactory from './stores'; | ||
11 | import apiFactory from './api'; | ||
12 | import actions from './actions'; | ||
13 | import MenuFactory from './lib/Menu'; | ||
14 | import TouchBarFactory from './lib/TouchBar'; | ||
15 | |||
16 | import I18N from './I18n'; | ||
17 | import FerdiumRoutes from './routes'; | ||
18 | |||
19 | // Basic electron Setup | ||
20 | webFrame.setVisualZoomLevelLimits(1, 1); | ||
21 | |||
22 | window.addEventListener('load', () => { | ||
23 | const serverApi = new ServerApi(); | ||
24 | const api = apiFactory(serverApi, new LocalApi()); | ||
25 | const history = createHashHistory(); | ||
26 | const router = new RouterStore(history); | ||
27 | const stores = storeFactory(api, actions, router); | ||
28 | const menu = new MenuFactory(stores, actions); | ||
29 | const touchBar = new TouchBarFactory(stores, actions); | ||
30 | |||
31 | window['ferdium'] = { | ||
32 | stores, | ||
33 | actions, | ||
34 | api, | ||
35 | menu, | ||
36 | touchBar, | ||
37 | features: {}, | ||
38 | render() { | ||
39 | const preparedApp = ( | ||
40 | <Provider stores={stores} actions={actions}> | ||
41 | <I18N stores={{ app: stores.app, user: stores.user }}> | ||
42 | <FerdiumRoutes history={history} /> | ||
43 | </I18N> | ||
44 | </Provider> | ||
45 | ); | ||
46 | render(preparedApp, document.querySelector('#root')); | ||
47 | }, | ||
48 | }; | ||
49 | window['ferdium'].render(); | ||
50 | }); | ||
51 | |||
52 | // Prevent back and forward mouse events for the app itself (not inside the recipe) | ||
53 | // TODO: send this request to the recipe.js | ||
54 | window.addEventListener('mouseup', e => { | ||
55 | if (e.button === 3 || e.button === 4) { | ||
56 | e.preventDefault(); | ||
57 | e.stopPropagation(); | ||
58 | } | ||
59 | }); | ||
60 | |||
61 | // Prevent drag and drop into window from redirecting | ||
62 | window.addEventListener('dragover', event => event.preventDefault()); | ||
63 | window.addEventListener('drop', event => event.preventDefault()); | ||
64 | window.addEventListener('dragover', event => event.stopPropagation()); | ||
65 | window.addEventListener('drop', event => event.stopPropagation()); | ||