From 789e122f2108e1f27a9664864cf6e829c2ceb92e Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Wed, 14 Dec 2022 17:00:49 +0100 Subject: feat(frontend): add links to top bar --- subprojects/frontend/src/TopBar.tsx | 53 +++++++++++++++++++++++++++--- subprojects/frontend/src/index.tsx | 64 +++++++++++++++++-------------------- 2 files changed, 77 insertions(+), 40 deletions(-) (limited to 'subprojects/frontend/src') 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 @@ +import GitHubIcon from '@mui/icons-material/GitHub'; import AppBar from '@mui/material/AppBar'; +import Button from '@mui/material/Button'; +import IconButton from '@mui/material/IconButton'; +import Stack from '@mui/material/Stack'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import { styled, useTheme } from '@mui/material/styles'; @@ -59,6 +63,7 @@ export default observer(function TopBar(): JSX.Element { const overlayVisible = useWindowControlsOverlayVisible(); const { breakpoints } = useTheme(); const small = useMediaQuery(breakpoints.down('sm')); + const large = useMediaQuery(breakpoints.up('md')); return ( Refinery {import.meta.env.DEV && Dev} - + + + {large && ( + <> + + + + + + + + )} + 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'; import App from './App'; import RootStore from './RootStore'; -const initialValue = `class Family { - contains Person[] members -} - +const initialValue = `// Metamodel class Person { - Person[] children opposite parent - Person[0..1] parent opposite children - int age - TaxStatus taxStatus + Person[] friend opposite friend } -enum TaxStatus { - CHILD, STUDENT, ADULT, RETIRED +class Post { + Person author + Post[0..1] replyTo } -% A child cannot have any dependents. -pred invalidTaxStatus(Person p) <-> - taxStatus(p, CHILD), - children(p, _q) -; - parent(p, q), - age(q) < age(p) -; - taxStatus(p, RETIRED), - parent(p, q), - !taxStatus(q, RETIRED). - -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(bob): 21..35. -age(ciri): 10. - -scope Family = 1, Person += 5..10. +// Constraints +error replyToNotFriend(Post x, Post y) <-> + replyTo(x, y), + author(x, xAuthor), + author(y, yAuthor), + !friend(xAuthor, yAuthor). + +error replyToCycle(Post x) <-> replyTo+(x,x). + +// Instance model +Person(a). +Person(b). +friend(a, b). +friend(b, a). +Post(p1). +author(p1, a). +Post(p2). +author(p2, b). +replyTo(p2, p1). + +!author(Post::new, a). // Automatically inferred: author(Post::new, b). + +// Scope +scope Post = 10..15, Person += 0. `; configure({ -- cgit v1.2.3-54-g00ecf