Skip to content
Snippets Groups Projects
Commit 5b54ebb0 authored by Loïc Correnson's avatar Loïc Correnson
Browse files

[ivette/wp] view labels & titles

parent a69df239
No related branches found
No related tags found
No related merge requests found
...@@ -47,17 +47,19 @@ type Goal = WP.goal | undefined; ...@@ -47,17 +47,19 @@ type Goal = WP.goal | undefined;
function WPGoals(): JSX.Element { function WPGoals(): JSX.Element {
const [scoped, flipScoped] = Dome.useFlipSettings('frama-c.wp.goals.scoped'); const [scoped, flipScoped] = Dome.useFlipSettings('frama-c.wp.goals.scoped');
const [failed, flipFailed] = Dome.useFlipSettings('frama-c.wp.goals.failed'); const [failed, flipFailed] = Dome.useFlipSettings('frama-c.wp.goals.failed');
const [displayTip, setTip] = React.useState(false); const [tip, setTip] = React.useState(false);
const [current, setCurrent] = React.useState<Goal>(undefined); const [current, setCurrent] = React.useState<Goal>(undefined);
Server.useShutdown(() => { setTip(false); setCurrent(undefined); }); Server.useShutdown(() => { setTip(false); setCurrent(undefined); });
const scope = States.useCurrentScope(); const scope = States.useCurrentScope();
const [goals, setGoals] = React.useState(0); const [goals, setGoals] = React.useState(0);
const [total, setTotal] = React.useState(0); const [total, setTotal] = React.useState(0);
const hasGoals = total > 0; const hasGoals = total > 0;
const hasSelection = current !== WP.goalDefault;
return ( return (
<> <>
<Ivette.TitleBar> <Ivette.TitleBar
label={tip ? 'WP — TIP' : 'WP — Goals'}
title={tip ? 'Interactive Proof Transformer' : 'Generated Goals'}
>
<Label display={goals < total}> <Label display={goals < total}>
{goals} / {total} {goals} / {total}
</Label> </Label>
...@@ -73,14 +75,14 @@ function WPGoals(): JSX.Element { ...@@ -73,14 +75,14 @@ function WPGoals(): JSX.Element {
selected={failed} selected={failed}
onClick={flipFailed} /> onClick={flipFailed} />
<IconButton <IconButton
icon={displayTip ? 'ITEMS.LIST' : 'MEDIA.PLAY'} icon={tip ? 'ITEMS.LIST' : 'MEDIA.PLAY'}
kind={displayTip ? 'warning' : 'positive'} kind={tip ? 'warning' : 'positive'}
title='Goal Resolution' title={tip ? 'Back to Goals' : 'Interactive Proof Transformer'}
enabled={hasSelection} enabled={!!current}
onClick={() => setTip(!displayTip)} /> onClick={() => setTip(!tip)} />
</Ivette.TitleBar> </Ivette.TitleBar>
<GoalTable <GoalTable
display={!displayTip} display={!tip}
scope={scope} scope={scope}
failed={failed} failed={failed}
current={current} current={current}
...@@ -90,7 +92,7 @@ function WPGoals(): JSX.Element { ...@@ -90,7 +92,7 @@ function WPGoals(): JSX.Element {
setTotal={setTotal} setTotal={setTotal}
/> />
<TIPView <TIPView
display={displayTip} display={tip}
goal={current} /> goal={current} />
</> </>
); );
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
import React from 'react'; import React from 'react';
import { Cell } from 'dome/controls/labels'; import { Cell } from 'dome/controls/labels';
import { Vfill, Hbox } from 'dome/layout/boxes'; import { ToolBar } from 'dome/frame/toolbars';
import { Vfill } from 'dome/layout/boxes';
import { MarkDecoration, Decorations, TextView } from 'dome/text/richtext'; import { MarkDecoration, Decorations, TextView } from 'dome/text/richtext';
import * as States from 'frama-c/states'; import * as States from 'frama-c/states';
import * as RichText from 'frama-c/richtext'; import * as RichText from 'frama-c/richtext';
...@@ -145,16 +146,16 @@ export function TIPView(props: TIPProps): JSX.Element { ...@@ -145,16 +146,16 @@ export function TIPView(props: TIPProps): JSX.Element {
const { current, index, pending } = useProofState(goal); const { current, index, pending } = useProofState(goal);
return ( return (
<Vfill display={display}> <Vfill display={display}>
<Hbox> <ToolBar>
<Cell <Cell
icon='HOME' icon='HOME'
label={infos.wpo} title='Goal identifier' /> label={infos.wpo} title='Goal identifier' />
<Cell <Cell
icon='CODE' icon='CODE'
display={0 <= index && index < pending} display={0 <= index && index < pending && 1 < pending}
label={`${index}/${pending}`} title='Pending proof nodes'/> label={`${index+1}/${pending}`} title='Pending proof nodes'/>
<Cell {...getStatus(infos)}/> <Cell {...getStatus(infos)}/>
</Hbox> </ToolBar>
<GoalView node={current} /> <GoalView node={current} />
</Vfill> </Vfill>
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment