aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/index.tsx
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-13 02:07:04 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2021-12-14 02:14:23 +0100
commita96c52b21e7e590bbdd70b80896780a446fa2e8b (patch)
tree663619baa254577bb2f5342192e80bca692ad91d /subprojects/frontend/src/index.tsx
parentbuild: move modules into subproject directory (diff)
downloadrefinery-a96c52b21e7e590bbdd70b80896780a446fa2e8b.tar.gz
refinery-a96c52b21e7e590bbdd70b80896780a446fa2e8b.tar.zst
refinery-a96c52b21e7e590bbdd70b80896780a446fa2e8b.zip
build: separate module for frontend
This allows us to simplify the webpack configuration and the gradle build scripts.
Diffstat (limited to 'subprojects/frontend/src/index.tsx')
-rw-r--r--subprojects/frontend/src/index.tsx69
1 files changed, 69 insertions, 0 deletions
diff --git a/subprojects/frontend/src/index.tsx b/subprojects/frontend/src/index.tsx
new file mode 100644
index 00000000..15b26adb
--- /dev/null
+++ b/subprojects/frontend/src/index.tsx
@@ -0,0 +1,69 @@
1import React from 'react';
2import { render } from 'react-dom';
3import CssBaseline from '@mui/material/CssBaseline';
4
5import { App } from './App';
6import { RootStore, RootStoreProvider } from './RootStore';
7import { ThemeProvider } from './theme/ThemeProvider';
8
9import './index.scss';
10
11const initialValue = `class Family {
12 contains Person[] members
13}
14
15class Person {
16 Person[] children opposite parent
17 Person[0..1] parent opposite children
18 int age
19 TaxStatus taxStatus
20}
21
22enum TaxStatus {
23 child, student, adult, retired
24}
25
26% A child cannot have any dependents.
27pred invalidTaxStatus(Person p) <->
28 taxStatus(p, child),
29 children(p, _q)
30 ; taxStatus(p, retired),
31 parent(p, q),
32 !taxStatus(q, retired).
33
34direct rule createChild(p):
35 children(p, newPerson) = unknown,
36 equals(newPerson, newPerson) = unknown
37 ~> new q,
38 children(p, q) = true,
39 taxStatus(q, child) = true.
40
41indiv family.
42Family(family).
43members(family, anne).
44members(family, bob).
45members(family, ciri).
46children(anne, ciri).
47?children(bob, ciri).
48default children(ciri, *): false.
49taxStatus(anne, adult).
50age(anne, 35).
51bobAge: 27.
52age(bob, bobAge).
53!age(ciri, bobAge).
54
55scope Family = 1, Person += 5..10.
56`;
57
58const rootStore = new RootStore(initialValue);
59
60const app = (
61 <RootStoreProvider rootStore={rootStore}>
62 <ThemeProvider>
63 <CssBaseline />
64 <App />
65 </ThemeProvider>
66 </RootStoreProvider>
67);
68
69render(app, document.getElementById('app'));