selecting hints and proof steps

This commit is contained in:
Jon Eugster
2023-07-14 18:14:21 +02:00
parent d0316b734a
commit d40fd1d6cb
5 changed files with 72 additions and 15 deletions
+11 -7
View File
@@ -2,21 +2,25 @@ import { GameHint } from "./infoview/rpc_api";
import * as React from 'react';
import Markdown from './markdown';
export function Hint({hint} : {hint: GameHint}) {
return <div className="message information"><Markdown>{hint.text}</Markdown></div>
export function Hint({hint, selected, toggleSelection} : {hint: GameHint, selected: boolean, toggleSelection: any}) {
return <div className={"message information" + (selected ? ' selected' : '')} onClick={toggleSelection}>
<Markdown>{hint.text}</Markdown>
</div>
}
export function AdditionalHint({hint} : {hint: GameHint}) {
return <div className="message warning"><Markdown>{hint.text}</Markdown></div>
export function AdditionalHint({hint, selected, toggleSelection} : {hint: GameHint, selected: boolean, toggleSelection: any}) {
return <div className={"message warning" + (selected ? ' selected' : '')} onClick={toggleSelection}>
<Markdown>{hint.text}</Markdown>
</div>
}
export function Hints({hints, showHidden} : {hints: GameHint[], showHidden: boolean}) {
export function Hints({hints, showHidden, selected, toggleSelection} : {hints: GameHint[], showHidden: boolean, selected: boolean, toggleSelection: any}) {
const openHints = hints.filter(hint => !hint.hidden)
const hiddenHints = hints.filter(hint => hint.hidden)
return <>
{openHints.map(hint => <Hint hint={hint} />)}
{showHidden && hiddenHints.map(hint => <AdditionalHint hint={hint}/>)}
{openHints.map(hint => <Hint hint={hint} selected={selected} toggleSelection={toggleSelection}/>)}
{showHidden && hiddenHints.map(hint => <AdditionalHint hint={hint} selected={selected} toggleSelection={toggleSelection}/>)}
</>
}