From a96c52b21e7e590bbdd70b80896780a446fa2e8b Mon Sep 17 00:00:00 2001
From: Kristóf Marussy <kristof@marussy.com>
Date: Mon, 13 Dec 2021 02:07:04 +0100
Subject: build: separate module for frontend

This allows us to simplify the webpack configuration and the gradle
build scripts.
---
 subprojects/frontend/src/index.tsx | 69 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 subprojects/frontend/src/index.tsx

(limited to 'subprojects/frontend/src/index.tsx')

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 @@
+import React from 'react';
+import { render } from 'react-dom';
+import CssBaseline from '@mui/material/CssBaseline';
+
+import { App } from './App';
+import { RootStore, RootStoreProvider } from './RootStore';
+import { ThemeProvider } from './theme/ThemeProvider';
+
+import './index.scss';
+
+const initialValue = `class Family {
+    contains Person[] members
+}
+
+class Person {
+    Person[] children opposite parent
+    Person[0..1] parent opposite children
+    int age
+    TaxStatus taxStatus
+}
+
+enum TaxStatus {
+    child, student, adult, retired
+}
+
+% A child cannot have any dependents.
+pred invalidTaxStatus(Person p) <->
+    taxStatus(p, child),
+    children(p, _q)
+  ; taxStatus(p, retired),
+    parent(p, q),
+    !taxStatus(q, retired).
+
+direct rule createChild(p):
+    children(p, newPerson) = unknown,
+    equals(newPerson, newPerson) = unknown
+ ~> new q,
+    children(p, q) = true,
+    taxStatus(q, child) = true.
+
+indiv family.
+Family(family).
+members(family, anne).
+members(family, bob).
+members(family, ciri).
+children(anne, ciri).
+?children(bob, ciri).
+default children(ciri, *): false.
+taxStatus(anne, adult).
+age(anne, 35).
+bobAge: 27.
+age(bob, bobAge).
+!age(ciri, bobAge).
+
+scope Family = 1, Person += 5..10.
+`;
+
+const rootStore = new RootStore(initialValue);
+
+const app = (
+  <RootStoreProvider rootStore={rootStore}>
+    <ThemeProvider>
+      <CssBaseline />
+      <App />
+    </ThemeProvider>
+  </RootStoreProvider>
+);
+
+render(app, document.getElementById('app'));
-- 
cgit v1.2.3-54-g00ecf

