diff --git a/src/components/solvers/Graph/ProblemList.tsx b/src/components/solvers/Graph/ProblemList.tsx index f70f6d4..3eab3b5 100644 --- a/src/components/solvers/Graph/ProblemList.tsx +++ b/src/components/solvers/Graph/ProblemList.tsx @@ -13,6 +13,7 @@ import { VStack, } from "@chakra-ui/react"; import { Dispatch, SetStateAction, useState } from "react"; +import { BiPlay } from "react-icons/bi"; import { FaQuestion, FaQuestionCircle } from "react-icons/fa"; import { GrInProgress } from "react-icons/gr"; import { ImCheckmark } from "react-icons/im"; @@ -28,28 +29,6 @@ import { ProblemDetails } from "./ProblemDetails"; import { useGraphUpdates } from "./ProblemGraphView"; import { useSolvers } from "./SolverProvider"; -function getStatusIcon(problemDto: ProblemDto): JSX.Element { - switch (problemDto.state) { - case ProblemState.NEEDS_CONFIGURATION: - return ; - case ProblemState.READY_TO_SOLVE: - return ; - case ProblemState.SOLVING: - return ; - case ProblemState.SOLVED: - switch (problemDto.solution.status) { - case SolutionStatus.INVALID: - return ; - case SolutionStatus.COMPUTING: - return ; - case SolutionStatus.SOLVED: - return ; - case SolutionStatus.ERROR: - return ; - } - } -} - export const ProblemList = (props: { problemDtos: ProblemDto[]; selectedProblemIds: string[]; @@ -67,6 +46,41 @@ export const ProblemList = (props: { const typeId = props.problemDtos[0].typeId; const solverId = props.problemDtos[0].solverId; + function getStatusIcon(problemDto: ProblemDto): JSX.Element { + switch (problemDto.state) { + case ProblemState.NEEDS_CONFIGURATION: + return ; + case ProblemState.READY_TO_SOLVE: + return ( + { + patchProblem(problemDto.typeId, problemDto.id, { + state: ProblemState.SOLVING, + }).then((dto) => { + updateProblem(dto.id); + }); + }} + /> + ); + case ProblemState.SOLVING: + return ( + + ); + case ProblemState.SOLVED: + switch (problemDto.solution.status) { + case SolutionStatus.INVALID: + return ; + case SolutionStatus.COMPUTING: + return ; + case SolutionStatus.SOLVED: + return ; + case SolutionStatus.ERROR: + return ; + } + } + } + function handleClick( e: React.MouseEvent, clickedSubProblem: ProblemDto