aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.jsx
diff options
context:
space:
mode:
authorLibravatar Balaji Vijayakumar <kuttibalaji.v6@gmail.com>2022-10-31 16:14:30 +0530
committerLibravatar GitHub <noreply@github.com>2022-10-31 10:44:30 +0000
commit87bc593ac72af503171f759fc6e4b1e9e0813039 (patch)
tree7128adb5cc48ae36104c4d3e6de219b9de1ac446 /src/app.jsx
parentConvert web controls & screen to typescript (#722) (diff)
downloadferdium-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.jsx65
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 @@
1import { webFrame } from 'electron';
2
3import { render } from 'react-dom';
4import { Provider } from 'mobx-react';
5import { RouterStore } from '@superwf/mobx-react-router';
6import { createHashHistory } from 'history';
7
8import ServerApi from './api/server/ServerApi';
9import LocalApi from './api/server/LocalApi';
10import storeFactory from './stores';
11import apiFactory from './api';
12import actions from './actions';
13import MenuFactory from './lib/Menu';
14import TouchBarFactory from './lib/TouchBar';
15
16import I18N from './I18n';
17import FerdiumRoutes from './routes';
18
19// Basic electron Setup
20webFrame.setVisualZoomLevelLimits(1, 1);
21
22window.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
54window.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
62window.addEventListener('dragover', event => event.preventDefault());
63window.addEventListener('drop', event => event.preventDefault());
64window.addEventListener('dragover', event => event.stopPropagation());
65window.addEventListener('drop', event => event.stopPropagation());