diff --git a/src/Pages/HomeView.elm b/src/Pages/HomeView.elm index d0d378d44704f15946183eb89dd0852d1437ea23..8735f236b886e2fd859d7f6d0723682aa1c696a3 100644 --- a/src/Pages/HomeView.elm +++ b/src/Pages/HomeView.elm @@ -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