Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions client/src/components/infoview/goals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ export function loadGoals(
uri: string,
worldId: string,
levelId: number,
setProof: React.Dispatch<React.SetStateAction<ProofState>>,
setCrashed: React.Dispatch<React.SetStateAction<Boolean>>) {
setProof: React.Dispatch<React.SetStateAction<ProofState | undefined>>,
setCrashed: React.Dispatch<React.SetStateAction<boolean>>) {
console.info('sending rpc request to load the proof state')

rpcSess.call('Game.getProofState',
Expand All @@ -372,11 +372,11 @@ rpcSess.call('Game.getProofState',
worldId, levelId
}
).then(
(proof : ProofState) => {
(proof) => {
if (typeof proof !== 'undefined') {
console.info(`received a proof state!`)
console.log(proof)
setProof(proof)
setProof(proof as ProofState)
setCrashed(false)
} else {
console.warn('received undefined proof state!')
Expand Down
16 changes: 8 additions & 8 deletions client/src/components/infoview/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export function Main() {
return (ev: any) => {
console.debug('toggled selection')
if (selectedStep == line) {
setSelectedStep(null)
setSelectedStep(undefined)
} else {
setSelectedStep(line)
}
Expand Down Expand Up @@ -255,7 +255,7 @@ export function Main() {
const hintLine = (() => {
const isEditorMode = !(typewriterMode)
const curLine = Number.isFinite(curPos?.line)
? curPos.line
? curPos?.line
: (Number.isFinite((curPos as any)?._line) ? (curPos as any)._line : undefined)
const curChar = Number.isFinite(curPos?.character)
? curPos.character
Expand Down Expand Up @@ -482,7 +482,7 @@ export function TypewriterInterface() {
* Note that the first line (i.e. deleting everything) is `1`!
*/
function deleteProof(line: number) {
return (ev) => {
return (ev: any) => {
let deletedChat: Array<GameHint> = []
proof?.steps.slice(line).map((step, i) => {
let filteredHints = filterHints(step.goals[0]?.hints, proof?.steps[i-1]?.goals[0]?.hints)
Expand All @@ -503,19 +503,19 @@ export function TypewriterInterface() {
text: '',
forceMoveMarkers: false
}])
setSelectedStep(null)
setTypewriter(proof?.steps[line].command)
setSelectedStep(undefined)
setTypewriter(proof?.steps[line].command ?? "")
// Reload proof on deleting
loadGoals(rpcSess, uri, worldId!, levelId!, setProof, setCrashed)
ev.stopPropagation()
}
}

function toggleSelectStep(line: number) {
return (ev) => {
return (ev: any) => {
if (mobile) {return}
if (selectedStep == line) {
setSelectedStep(null)
setSelectedStep(undefined)
console.debug(`unselected step`)
} else {
setSelectedStep(line)
Expand All @@ -526,7 +526,7 @@ export function TypewriterInterface() {

// Scroll to the end of the proof if it is updated.
React.useEffect(() => {
if (proof?.steps.length > 1) {
if (proof?.steps?.length && proof?.steps?.length > 1) {
proofPanelRef.current?.lastElementChild?.scrollIntoView() //scrollTo(0,0)
} else {
proofPanelRef.current?.scrollTo(0,0)
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/infoview/rpc_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ export interface ProofState {
* be the "unsolved goals" message, I believe.
*/
diagnostics : InteractiveDiagnostic[];
completed : Boolean;
completedWithWarnings : Boolean;
completed : boolean;
completedWithWarnings : boolean;
}
4 changes: 2 additions & 2 deletions client/src/store/editor-atoms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const typewriterModeAtom = atom(
export const proofAtom = atom<ProofState>()

/** TODO: Workaround to capture a crash of the gameserver. */
export const interimDiagsAtom = atom<Array<Diagnostic>>()
export const interimDiagsAtom = atom<Array<Diagnostic>>([])

/** TODO: Workaround to capture a crash of the gameserver. */
export const crashedAtom = atom<boolean>()
export const crashedAtom = atom<boolean>(false)
Loading
Loading