aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-12-14 17:00:49 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-12-21 18:34:11 +0100
commit789e122f2108e1f27a9664864cf6e829c2ceb92e (patch)
treef6be35c83ce8f225d093303020db549798d828d0
parentrefactor(store): compare VersionedMap instances (diff)
downloadrefinery-789e122f2108e1f27a9664864cf6e829c2ceb92e.tar.gz
refinery-789e122f2108e1f27a9664864cf6e829c2ceb92e.tar.zst
refinery-789e122f2108e1f27a9664864cf6e829c2ceb92e.zip
feat(frontend): add links to top bar
-rw-r--r--subprojects/frontend/src/TopBar.tsx53
-rw-r--r--subprojects/frontend/src/index.tsx64
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 @@
1import GitHubIcon from '@mui/icons-material/GitHub';
1import AppBar from '@mui/material/AppBar'; 2import AppBar from '@mui/material/AppBar';
3import Button from '@mui/material/Button';
4import IconButton from '@mui/material/IconButton';
5import Stack from '@mui/material/Stack';
2import Toolbar from '@mui/material/Toolbar'; 6import Toolbar from '@mui/material/Toolbar';
3import Typography from '@mui/material/Typography'; 7import Typography from '@mui/material/Typography';
4import { styled, useTheme } from '@mui/material/styles'; 8import { 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';
4import App from './App'; 4import App from './App';
5import RootStore from './RootStore'; 5import RootStore from './RootStore';
6 6
7const initialValue = `class Family { 7const initialValue = `// Metamodel
8 contains Person[] members
9}
10
11class Person { 8class 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
18enum TaxStatus { 12class 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
23pred invalidTaxStatus(Person p) <-> 18error 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; 24error replyToCycle(Post x) <-> replyTo+(x,x).
30 taxStatus(p, RETIRED), 25
31 parent(p, q), 26// Instance model
32 !taxStatus(q, RETIRED). 27Person(a).
33 28Person(b).
34indiv family. 29friend(a, b).
35Family(family). 30friend(b, a).
36members(family, anne). 31Post(p1).
37members(family, bob). 32author(p1, a).
38members(family, ciri). 33Post(p2).
39children(anne, ciri). 34author(p2, b).
40?children(bob, ciri). 35replyTo(p2, p1).
41default children(ciri, *): false. 36
42taxStatus(anne, ADULT). 37!author(Post::new, a). // Automatically inferred: author(Post::new, b).
43age(bob): 21..35. 38
44age(ciri): 10. 39// Scope
45 40scope Post = 10..15, Person += 0.
46scope Family = 1, Person += 5..10.
47`; 41`;
48 42
49configure({ 43configure({