module Client.Features.Quizzes.ViewResult.View open Feliz open Domain.Contracts open Client.Shared /// Small enough that it doesn't need its own Types/State — it only ever /// dispatches the parent's "go back to the quiz list" message. let view (result: AttemptResult) (onBackToQuizList: unit -> unit) = Html.div [ prop.className "result-page" prop.children [ Html.h2 "Результат" match result.Passed with | Some true -> Html.div [ prop.className "grade-stamp passed"; prop.text "Тест пройден" ] | Some false -> Html.div [ prop.className "grade-stamp failed"; prop.text "Тест не пройден" ] | None -> Html.none Html.span [ prop.className "score-value" prop.text (sprintf "%s / %s" (Format.points result.Score) (Format.points result.MaxScore)) ] Html.button [ prop.onClick (fun _ -> onBackToQuizList ()); prop.text "К списку тестов" ] ] ]