From 57032dfb2130bf4b37578e77c2fb851583593c53 Mon Sep 17 00:00:00 2001
From: "Aamon P. Hoffmann" <aamon.hoffmann@student.uni-halle.de>
Date: Sun, 5 Jan 2025 02:03:10 +0100
Subject: [PATCH] added spinner to data loading

---
 src/Main.elm | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/Main.elm b/src/Main.elm
index b49e3b8..a57c28d 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -188,20 +188,32 @@ viewContent : Model -> Html Msg
 viewContent ( global, local ) =
     let
         message =
-            case global.progress of
-                Loading ->
-                    "Insert some loading icon here..."
-
-                Failure msg ->
-                    msg |> (++) "Error while loading data. "
-
-                Success ->
-                    "Data was loaded successfully!"
+            Html.div
+                [ Html.Attributes.style "justify-items" "center"
+                , Html.Attributes.style "align-content" "center"
+                , Html.Attributes.style "flex-grow" "1"
+                ]
+                (case global.progress of
+                    Loading ->
+                        [ Html.div [ Html.Attributes.class "loader" ] []
+                        , Html.div
+                            [ Html.Attributes.style "position" "relative"
+                            , Html.Attributes.style "bottom" "5rem"
+                            ]
+                            [ Html.text "Loading Data..." ]
+                        ]
+
+                    Failure msg ->
+                        [ Html.text (msg |> (++) "Error while loading data. ") ]
+
+                    Success ->
+                        [ Html.text "Data was loaded successfully!" ]
+                )
     in
     case global.view of
         Home ->
             div [ Html.Attributes.class "content" ]
-                [ text message ]
+                [ message ]
 
         Other ->
             div [ Html.Attributes.class "content" ]
-- 
GitLab