From 2484cb9ea070d431d7ca38238ba3cb4b7f624247 Mon Sep 17 00:00:00 2001
From: aqquq <jannik.wurche@student.uni-halle.de>
Date: Tue, 2 Jul 2024 18:47:18 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9C=20add=20comments?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/Pages/HomeView.elm | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/Pages/HomeView.elm b/src/Pages/HomeView.elm
index d0d378d..8735f23 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
-- 
GitLab