fix inventory local storage
This commit is contained in:
@@ -80,6 +80,11 @@ function DualEditorMain({ worldId, levelId, level, worldSize }: { worldId: strin
|
|||||||
...level?.definitions
|
...level?.definitions
|
||||||
].filter((tile) => tile.new).map((tile) => tile.name)
|
].filter((tile) => tile.new).map((tile) => tile.name)
|
||||||
|
|
||||||
|
// Add the proven statement to the local storage as well.
|
||||||
|
if (level?.statementName != null) {
|
||||||
|
newTiles.push(level?.statementName)
|
||||||
|
}
|
||||||
|
|
||||||
let inv: string[] = selectInventory(gameId)(store.getState())
|
let inv: string[] = selectInventory(gameId)(store.getState())
|
||||||
|
|
||||||
// add new items and remove duplicates
|
// add new items and remove duplicates
|
||||||
@@ -130,7 +135,7 @@ function DualEditorMain({ worldId, levelId, level, worldSize }: { worldId: strin
|
|||||||
function ExerciseStatement({ data }) {
|
function ExerciseStatement({ data }) {
|
||||||
if (!data?.descrText) { return <></> }
|
if (!data?.descrText) { return <></> }
|
||||||
return <div className="exercise-statement"><Markdown>
|
return <div className="exercise-statement"><Markdown>
|
||||||
{(data?.statementName ? `**Theorem** \`${data?.statementName}\`: ` : data?.descrText && "**Exercise**: ") + `${data?.descrText}`}
|
{(data?.displayName ? `**Theorem** \`${data?.displayName}\`: ` : data?.descrText && "**Exercise**: ") + `${data?.descrText}`}
|
||||||
</Markdown></div>
|
</Markdown></div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export interface LevelInfo {
|
|||||||
descrFormat: null|string,
|
descrFormat: null|string,
|
||||||
lemmaTab: null|string,
|
lemmaTab: null|string,
|
||||||
statementName: null|string,
|
statementName: null|string,
|
||||||
|
displayName: null|string,
|
||||||
template: null|string
|
template: null|string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ structure LevelInfo where
|
|||||||
descrText : Option String := none
|
descrText : Option String := none
|
||||||
descrFormat : String := ""
|
descrFormat : String := ""
|
||||||
lemmaTab : Option String
|
lemmaTab : Option String
|
||||||
|
displayName : Option String
|
||||||
statementName : Option String
|
statementName : Option String
|
||||||
template : Option String
|
template : Option String
|
||||||
deriving ToJson, FromJson
|
deriving ToJson, FromJson
|
||||||
@@ -165,7 +166,8 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
|
|||||||
match lvl.lemmas.tiles.find? (·.new) with
|
match lvl.lemmas.tiles.find? (·.new) with
|
||||||
| some tile => tile.category
|
| some tile => tile.category
|
||||||
| none => none
|
| none => none
|
||||||
statementName := match lvl.statementName with
|
statementName := lvl.statementName.toString
|
||||||
|
displayName := match lvl.statementName with
|
||||||
| .anonymous => none
|
| .anonymous => none
|
||||||
| name => match (inventoryExt.getState env).find?
|
| name => match (inventoryExt.getState env).find?
|
||||||
(fun x => x.name == name && x.type == .Lemma) with
|
(fun x => x.name == name && x.type == .Lemma) with
|
||||||
@@ -194,7 +196,6 @@ partial def handleServerEvent (ev : ServerEvent) : GameServerM Bool := do
|
|||||||
-- return true
|
-- return true
|
||||||
| Message.request id "loadDoc" params =>
|
| Message.request id "loadDoc" params =>
|
||||||
let p ← parseParams LoadDocParams (toJson params)
|
let p ← parseParams LoadDocParams (toJson params)
|
||||||
let s ← get
|
|
||||||
let c ← read
|
let c ← read
|
||||||
let some doc ← getInventoryItem? p.name p.type
|
let some doc ← getInventoryItem? p.name p.type
|
||||||
| do
|
| do
|
||||||
|
|||||||
Reference in New Issue
Block a user