import * as React from 'react';
import '@fontsource/roboto/300.css';
import '@fontsource/roboto/400.css';
import '@fontsource/roboto/500.css';
import '@fontsource/roboto/700.css';
import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import { Paper, Box, Typography, Alert, FormControlLabel, FormGroup, Switch, Collapse, CircularProgress } from '@mui/material';
import { Accordion, AccordionSummary, AccordionDetails, Divider } from '@mui/material';
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faArrowPointer } from '@fortawesome/free-solid-svg-icons'
import Markdown from './Markdown';
// TODO: Dead variables (x✝) are not displayed correctly.
function Goal({ goal }) {
const [showHints, setShowHints] = React.useState(false);
const handleHintsChange = () => {
setShowHints((prev) => !prev);
};
const hasObject = typeof goal.objects === "object" && goal.objects.length > 0
const hasAssumption = typeof goal.assumptions === "object" && goal.assumptions.length > 0
const openMessages = typeof goal.messages === "object" ? goal.messages.filter((msg) => ! msg.spoiler) : []
const hints = typeof goal.messages === "object" ? goal.messages.filter((msg) => msg.spoiler) : []
const hasHints = hints.length > 0
return (
{hasObject && Objects
{goal.objects.map((item) =>
{item.userName} :
{item.type}
)}
}
{hasAssumption && Assumptions
{goal.assumptions.map((item) => {item.userName} :
{item.type})}
}
Prove:
{goal.goal}
{openMessages.map((message) => {message.message})}
{hasHints &&
}
label="More Help?"
/>}
{hints.map((hint) => {hint.message})}
)
}
/* Function to display a goal that is not the main goal. */
function OtherGoal({ goal }) {
const hasObject = typeof goal.objects === "object" && goal.objects.length > 0
const hasAssumption = typeof goal.assumptions === "object" && goal.assumptions.length > 0
return (
}>
⊢ {goal.goal}
{hasObject &&
Objects
{goal.objects.map((item) =>
{item.userName} :
{item.type}
)}
}
{hasAssumption &&
Assumptions
{goal.assumptions.map((item) =>
{item.userName} :
{item.type}
)}
}
Prove:
{goal.goal}
)
}
function TacticState({ goals, diagnostics, completed, globalDiagnostics }) {
const isLoading = goals === null
const hasGoal = goals !== null && goals.length > 0
const hasManyGoal = hasGoal && goals.length > 1
if (!(hasGoal || completed) && globalDiagnostics) {
diagnostics = [{"severity" : 4, "message": "Showing global messages:"}, ...globalDiagnostics]
}
const hasError = typeof diagnostics === "object" && diagnostics.length > 0
return (
{completed && Level completed ! 🎉}
{hasGoal &&
Main Goal
(at )
}
{isLoading && }
{!(hasGoal || completed || isLoading) &&
No goals
(at )
}
{hasError &&
Lean says
{diagnostics.map(({severity, message}) =>
{message}
// TODO: When does Lean give severity=4? Had colour `gray` before. Make custom theme for that
)}
}
{hasManyGoal &&
Further Goals
{goals.slice(1).map((goal, index) => )}
}
)
}
export default TacticState