Skip to content
Snippets Groups Projects
Commit 2484cb9e authored by Jannik Wurche's avatar Jannik Wurche
Browse files

:scroll: add comments

parent 7c095a84
Branches
No related tags found
No related merge requests found
......@@ -6,9 +6,11 @@ import Html.Attributes exposing (class, type_, placeholder, value)
import Html.Events exposing (onSubmit, onClick, onInput)
import String exposing (startsWith)
-- Function to render the home view, allowing the user to enter a Quiz ID and start a quiz.
homeView : Model -> Html Msg
homeView model =
let
-- Determine the loading message based on the current error state.
loadingMsg = if model.error == "404" then
p [ class "error" ] [ text "Diese Quiz ID gibt es nicht! Bitte gib eine andere ein."]
else if startsWith "Error" model.error then
......@@ -16,22 +18,30 @@ homeView model =
else
p [] [ text "zum testen: mwPpDw0HlJ1l65WObssa, 4tH5RYt62lho5q5TsabW" ]
in
-- Main container div with a background and centered content.
div [ class "home" ]
[ div [ class "background" ] []
, div [ class "center" ]
[ h1 [ class "title" ] [ text "Mathe Quizzes" ]
[ -- Title of the home page.
h1 [ class "title" ] [ text "Mathe Quizzes" ]
-- Form to submit the Quiz ID.
, form [ onSubmit SendQuizRequest ]
[ input
[ -- Input field for the Quiz ID.
input
[ type_ "text"
, placeholder "Quiz ID"
, value model.quizId
, onInput UpdateQuizId
, class "input-field" ]
[]
-- Submit button for the form.
, button
[ onClick SendQuizRequest
, type_ "submit"
, class "submit-button" ]
[ text "Öffnen" ]
]
, loadingMsg ] ]
\ No newline at end of file
-- Display the loading message or any error message.
, loadingMsg
]
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment