diff options
Diffstat (limited to 'subprojects')
-rw-r--r-- | subprojects/frontend/src/TopBar.tsx | 53 | ||||
-rw-r--r-- | subprojects/frontend/src/index.tsx | 64 |
2 files changed, 77 insertions, 40 deletions
diff --git a/subprojects/frontend/src/TopBar.tsx b/subprojects/frontend/src/TopBar.tsx index 81e11ac8..5a825512 100644 --- a/subprojects/frontend/src/TopBar.tsx +++ b/subprojects/frontend/src/TopBar.tsx | |||
@@ -1,4 +1,8 @@ | |||
1 | import GitHubIcon from '@mui/icons-material/GitHub'; | ||
1 | import AppBar from '@mui/material/AppBar'; | 2 | import AppBar from '@mui/material/AppBar'; |
3 | import Button from '@mui/material/Button'; | ||
4 | import IconButton from '@mui/material/IconButton'; | ||
5 | import Stack from '@mui/material/Stack'; | ||
2 | import Toolbar from '@mui/material/Toolbar'; | 6 | import Toolbar from '@mui/material/Toolbar'; |
3 | import Typography from '@mui/material/Typography'; | 7 | import Typography from '@mui/material/Typography'; |
4 | import { styled, useTheme } from '@mui/material/styles'; | 8 | import { styled, useTheme } from '@mui/material/styles'; |
@@ -59,6 +63,7 @@ export default observer(function TopBar(): JSX.Element { | |||
59 | const overlayVisible = useWindowControlsOverlayVisible(); | 63 | const overlayVisible = useWindowControlsOverlayVisible(); |
60 | const { breakpoints } = useTheme(); | 64 | const { breakpoints } = useTheme(); |
61 | const small = useMediaQuery(breakpoints.down('sm')); | 65 | const small = useMediaQuery(breakpoints.down('sm')); |
66 | const large = useMediaQuery(breakpoints.up('md')); | ||
62 | 67 | ||
63 | return ( | 68 | return ( |
64 | <AppBar | 69 | <AppBar |
@@ -92,11 +97,49 @@ export default observer(function TopBar(): JSX.Element { | |||
92 | <Typography variant="h6" component="h1" flexGrow={1}> | 97 | <Typography variant="h6" component="h1" flexGrow={1}> |
93 | Refinery {import.meta.env.DEV && <DevModeBadge>Dev</DevModeBadge>} | 98 | Refinery {import.meta.env.DEV && <DevModeBadge>Dev</DevModeBadge>} |
94 | </Typography> | 99 | </Typography> |
95 | <GenerateButton | 100 | <Stack direction="row" marginRight={1}> |
96 | editorStore={editorStore} | 101 | <GenerateButton editorStore={editorStore} hideWarnings={small} /> |
97 | hideWarnings={small} | 102 | {large && ( |
98 | sx={{ marginRight: 1 }} | 103 | <> |
99 | /> | 104 | <Button |
105 | arial-label="Budapest University of Technology and Economics, Critical Systems Research Group" | ||
106 | className="rounded" | ||
107 | color="inherit" | ||
108 | href="https://ftsrg.mit.bme.hu" | ||
109 | target="_blank" | ||
110 | sx={{ marginLeft: 1 }} | ||
111 | > | ||
112 | BME FTSRG | ||
113 | </Button> | ||
114 | <Button | ||
115 | aria-label="McGill University, Department of Electrical and Computer Engineering" | ||
116 | className="rounded" | ||
117 | color="inherit" | ||
118 | href="https://www.mcgill.ca/ece/daniel-varro" | ||
119 | target="_blank" | ||
120 | > | ||
121 | McGill ECE | ||
122 | </Button> | ||
123 | <Button | ||
124 | aria-label="2022 Amazon Research Awards recipent" | ||
125 | className="rounded" | ||
126 | color="inherit" | ||
127 | href="https://www.amazon.science/research-awards/recipients/daniel-varro-fall-2021" | ||
128 | target="_blank" | ||
129 | > | ||
130 | Amazon Science | ||
131 | </Button> | ||
132 | <IconButton | ||
133 | aria-label="GitHub" | ||
134 | href="https://github.com/graphs4value/refinery" | ||
135 | target="_blank" | ||
136 | color="inherit" | ||
137 | > | ||
138 | <GitHubIcon /> | ||
139 | </IconButton> | ||
140 | </> | ||
141 | )} | ||
142 | </Stack> | ||
100 | <ToggleDarkModeButton /> | 143 | <ToggleDarkModeButton /> |
101 | </Toolbar> | 144 | </Toolbar> |
102 | </AppBar> | 145 | </AppBar> |
diff --git a/subprojects/frontend/src/index.tsx b/subprojects/frontend/src/index.tsx index 3e56d941..29b2b196 100644 --- a/subprojects/frontend/src/index.tsx +++ b/subprojects/frontend/src/index.tsx | |||
@@ -4,46 +4,40 @@ import { type Root, createRoot } from 'react-dom/client'; | |||
4 | import App from './App'; | 4 | import App from './App'; |
5 | import RootStore from './RootStore'; | 5 | import RootStore from './RootStore'; |
6 | 6 | ||
7 | const initialValue = `class Family { | 7 | const initialValue = `// Metamodel |
8 | contains Person[] members | ||
9 | } | ||
10 | |||
11 | class Person { | 8 | class Person { |
12 | Person[] children opposite parent | 9 | Person[] friend opposite friend |
13 | Person[0..1] parent opposite children | ||
14 | int age | ||
15 | TaxStatus taxStatus | ||
16 | } | 10 | } |
17 | 11 | ||
18 | enum TaxStatus { | 12 | class Post { |
19 | CHILD, STUDENT, ADULT, RETIRED | 13 | Person author |
14 | Post[0..1] replyTo | ||
20 | } | 15 | } |
21 | 16 | ||
22 | % A child cannot have any dependents. | 17 | // Constraints |
23 | pred invalidTaxStatus(Person p) <-> | 18 | error replyToNotFriend(Post x, Post y) <-> |
24 | taxStatus(p, CHILD), | 19 | replyTo(x, y), |
25 | children(p, _q) | 20 | author(x, xAuthor), |
26 | ; | 21 | author(y, yAuthor), |
27 | parent(p, q), | 22 | !friend(xAuthor, yAuthor). |
28 | age(q) < age(p) | 23 | |
29 | ; | 24 | error replyToCycle(Post x) <-> replyTo+(x,x). |
30 | taxStatus(p, RETIRED), | 25 | |
31 | parent(p, q), | 26 | // Instance model |
32 | !taxStatus(q, RETIRED). | 27 | Person(a). |
33 | 28 | Person(b). | |
34 | indiv family. | 29 | friend(a, b). |
35 | Family(family). | 30 | friend(b, a). |
36 | members(family, anne). | 31 | Post(p1). |
37 | members(family, bob). | 32 | author(p1, a). |
38 | members(family, ciri). | 33 | Post(p2). |
39 | children(anne, ciri). | 34 | author(p2, b). |
40 | ?children(bob, ciri). | 35 | replyTo(p2, p1). |
41 | default children(ciri, *): false. | 36 | |
42 | taxStatus(anne, ADULT). | 37 | !author(Post::new, a). // Automatically inferred: author(Post::new, b). |
43 | age(bob): 21..35. | 38 | |
44 | age(ciri): 10. | 39 | // Scope |
45 | 40 | scope Post = 10..15, Person += 0. | |
46 | scope Family = 1, Person += 5..10. | ||
47 | `; | 41 | `; |
48 | 42 | ||
49 | configure({ | 43 | configure({ |