diff --git a/client/src/components/hints.tsx b/client/src/components/hints.tsx index bec14b4..10aa46f 100644 --- a/client/src/components/hints.tsx +++ b/client/src/components/hints.tsx @@ -8,7 +8,7 @@ export function Hint({hint, step, selected, toggleSelection} : {hint: GameHint, } -export function AdditionalHint({hint, step, selected, toggleSelection} : {hint: GameHint, step: number, selected: number, toggleSelection: any}) { +export function HiddenHint({hint, step, selected, toggleSelection} : {hint: GameHint, step: number, selected: number, toggleSelection: any}) { return
{hint.text}
@@ -19,8 +19,9 @@ export function Hints({hints, showHidden, step, selected, toggleSelection} : {hi const openHints = hints.filter(hint => !hint.hidden) const hiddenHints = hints.filter(hint => hint.hidden) + // TODO: Should not use index as key. return <> - {openHints.map(hint => )} - {showHidden && hiddenHints.map(hint => )} + {openHints.map((hint, j) => )} + {showHidden && hiddenHints.map((hint, j) => )} } diff --git a/client/src/components/infoview/main.tsx b/client/src/components/infoview/main.tsx index 3c3f21e..55fabf9 100644 --- a/client/src/components/infoview/main.tsx +++ b/client/src/components/infoview/main.tsx @@ -255,7 +255,8 @@ function GoalsTab({proofStep} : {proofStep: ProofStep}) { return
{proofStep.goals.map((goal, i) => ( -
{ setSelectedGoal(i); ev.stopPropagation() }}> + // TODO: Should not use index as key. +
{ setSelectedGoal(i); ev.stopPropagation() }}> {i ? `Goal ${i+1}` : "Active Goal"}
))} @@ -382,16 +383,15 @@ export function CommandLineInterface(props: {world: string, level: number, data: if (i == proof.length - 1 && hasInteractiveErrors(step.errors)) { // if the last command contains an error, we only display the errors but not the // entered command as it is still present in the command line. - return
+ // TODO: Should not use index as key. + return
} else { - return <> -
- - - -
+ return
+ + + {/* Show a message that there are no goals left */} {!step.goals.length && (
@@ -404,7 +404,7 @@ export function CommandLineInterface(props: {world: string, level: number, data: }
)} - +
} }) : }
diff --git a/client/src/components/infoview/messages.tsx b/client/src/components/infoview/messages.tsx index f010fd1..fa88f33 100644 --- a/client/src/components/infoview/messages.tsx +++ b/client/src/components/infoview/messages.tsx @@ -48,10 +48,11 @@ function Error({error, commandLineMode} : {error : InteractiveDiagnostic, comman
} +// TODO: Should not use index as key. /** A list of messages (info/warning/error) that are produced after this command */ export function Errors ({errors, commandLineMode} : {errors : InteractiveDiagnostic[], commandLineMode : boolean}) { return
- {errors.map((err) => ())} + {errors.map((err, i) => ())}
} diff --git a/client/src/components/inventory.tsx b/client/src/components/inventory.tsx index e51e07a..1c815bd 100644 --- a/client/src/components/inventory.tsx +++ b/client/src/components/inventory.tsx @@ -60,20 +60,21 @@ function InventoryList({items, docType, openDoc, defaultTab=null, level=undefine {categories.length > 1 &&
{categories.map((cat) => -
{ setTab(cat) }}>{cat}
)} +
{ setTab(cat) }}>{cat}
)}
}
- { [...items].sort( - // For lemas, sort entries `available > disabled > locked` - // otherwise alphabetically - (x, y) => +(docType == "Lemma") * (+x.locked - +y.locked || +x.disabled - +y.disabled) - ).map(item => { - if ((tab ?? categories[0]) == item.category) { - return {openDoc(item.name, docType)}} + {[...items].sort( + // For lemas, sort entries `available > disabled > locked` + // otherwise alphabetically + (x, y) => +(docType == "Lemma") * (+x.locked - +y.locked || +x.disabled - +y.disabled) + ).filter(item => ((tab ?? categories[0]) == item.category)).map((item, i) => { + return {openDoc(item.name, docType)}} name={item.name} displayName={item.displayName} locked={item.locked} disabled={item.disabled} newly={item.new}/> - } - }) } + }) + }
} diff --git a/client/src/components/level.tsx b/client/src/components/level.tsx index 2b5c604..aace273 100644 --- a/client/src/components/level.tsx +++ b/client/src/components/level.tsx @@ -230,8 +230,10 @@ function PlayableLevel({worldId, levelId}) { // It the last step has errors, it will have the same hints // as the second-to-last step. Therefore we should not display them. if (!(i == proof.length - 1 && hasInteractiveErrors(step.errors))) { - return + // TODO: Should not use index as key. + return } })} {completed &&