From a7a9cd8e5d5a5e6d0ddb0fc2c3ce443c815a0652 Mon Sep 17 00:00:00 2001 From: Johannes Mey <johannes.mey@tu-dresden.de> Date: Wed, 5 Oct 2022 18:14:04 +0200 Subject: [PATCH] dashboard with context --- dashboard/src/App.css | 66 ++++++++++++++++++++++++------------------- dashboard/src/App.js | 24 ++++++++++------ 2 files changed, 53 insertions(+), 37 deletions(-) diff --git a/dashboard/src/App.css b/dashboard/src/App.css index 44d23ae..2772633 100644 --- a/dashboard/src/App.css +++ b/dashboard/src/App.css @@ -1,55 +1,63 @@ .App { - background-color: #282c34; - text-align: left; + background-color: #282c34; + text-align: left; } .App-logo { - height: 40vmin; - pointer-events: none; + height: 40vmin; + pointer-events: none; } @media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } + .App-logo { + animation: App-logo-spin infinite 20s linear; + } } .App-header { - background-color: #282c34; - min-height: 40px; /*100vmin*/ - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; + background-color: #282c34; + min-height: 40px; /*100vmin*/ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.CurrentContext { + height: 50vh; + width: 100vw; + object-fit: contain; + /*object-fit: scale-down;*/ + object-position: right; } .CurrentAst { - height: 50vh; - width: 100vw; - object-fit: cover; - object-position: right; + height: 50vh; + width: 100vw; + object-fit: cover; + object-position: right; } .AstInTimeline { - max-width: 100%; - + max-width: 100%; + } .App-link { - color: #61dafb; + color: #61dafb; } .MG-Timeline { - max-width: 4000px !important; + max-width: 4000px !important; } @keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } } diff --git a/dashboard/src/App.js b/dashboard/src/App.js index 3e87ab0..170d8c5 100644 --- a/dashboard/src/App.js +++ b/dashboard/src/App.js @@ -70,20 +70,20 @@ function App() { /> </header> <main> - <CurrentState + <CurrentContextState diagram={context ? context.diagram : ''} label='' /> - <CurrentState - diagram={ast ? ast.diagram : ''} - label={ast ? ast.parseRule : ''} - /> + <CurrentASTState + diagram={ast ? ast.diagram : ''} + label={ast ? ast.parseRule : ''} + /> </main> </div> ); } -function CurrentState(props) { +function CurrentASTState(props) { return ( <div className="curent-state"> <img className="CurrentAst" src={`data:image/svg+xml;utf8,${encodeURIComponent(props.diagram)}`} alt={props.label} /> @@ -91,11 +91,19 @@ function CurrentState(props) { ) } +function CurrentContextState(props) { + return ( + <div className="curent-state"> + <img className="CurrentContext" src={`data:image/svg+xml;utf8,${encodeURIComponent(props.diagram)}`} alt={props.label} /> + </div> + ) +} + function ControlPanel(props) { return ( <div className='ControlPanel'> - <button onClick={() => { props.ws.current.send("parse") }}>start parsing</button> - <button onClick={() => { props.ws.current.send("reset") }}>reset selections</button> + <button onClick={() => { props.ws.current.send("cell1 parse") }}>start parsing in cell 1</button> + <button onClick={() => { props.ws.current.send("cell1 reset") }}>reset selections</button> </div> ) } -- GitLab