From 1ef4b6111162e1d11e5b7dab52117aaffcd9307d Mon Sep 17 00:00:00 2001
From: Damian Romano Haj-Houssin <damian.haj-houssin@student.uni-halle.de>
Date: Sun, 5 Jan 2025 14:16:32 +0100
Subject: [PATCH] Added tooltips to navbar icons. Small code refactor.

---
 src/Main.elm | 39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/src/Main.elm b/src/Main.elm
index 24a644c..58402ae 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -157,6 +157,9 @@ update msg ( global, local ) =
 
 -- VIEW
 
+icon : Html Msg
+icon =
+    i [ Html.Attributes.class "fa-solid fa-house fa-xl" ] []
 
 viewNav : Model -> Html Msg
 viewNav ( global, _ ) =
@@ -170,21 +173,33 @@ viewNav ( global, _ ) =
                 "navbar-inactive"
     in
     nav [ Html.Attributes.class "navbar" ]
-        [ button [ activeClass Home |> Html.Attributes.class, ViewChange Home |> onClick ]
-            [ i [ Html.Attributes.class "fa-solid fa-house fa-xl" ] [] ]
+        [ button
+            [ Html.Attributes.title "Home"
+            , activeClass Home |> Html.Attributes.class, ViewChange Home |> onClick
+            ] [ icon ]
         , div [ Html.Attributes.class "navbar-title" ]
             [ text "Schengen Visa Statistics" ]
         , div [ Html.Attributes.class "navbar-view-icons" ]
-            [ button [ activeClass MapView |> Html.Attributes.class, ViewChange MapView |> onClick ]
-                [ MapView.icon ]
-            , button [ activeClass ForceDirectedGraph |> Html.Attributes.class, ViewChange ForceDirectedGraph |> onClick ]
-                [ ForceDirectedGraphView.icon ]
-            , button [ activeClass BarPlot |> Html.Attributes.class, ViewChange BarPlot |> onClick ]
-                [ BarPlotView.icon ]
-            , button [ activeClass LinePlot |> Html.Attributes.class, ViewChange LinePlot |> onClick ]
-                [ LinePlotView.icon ]
-            , button [ activeClass DataTable |> Html.Attributes.class, ViewChange DataTable |> onClick ]
-                [ DataTableView.icon ]
+            [ button
+                [ Html.Attributes.title "Map"
+                , activeClass MapView |> Html.Attributes.class, ViewChange MapView |> onClick
+                ] [ MapView.icon ]
+            , button
+                [ Html.Attributes.title "Force"
+                , activeClass ForceDirectedGraph |> Html.Attributes.class, ViewChange ForceDirectedGraph |> onClick
+                ] [ ForceDirectedGraphView.icon ]
+            , button
+                [ Html.Attributes.title "BarPlot"
+                , activeClass BarPlot |> Html.Attributes.class, ViewChange BarPlot |> onClick
+                ] [ BarPlotView.icon ]
+            , button
+                [ Html.Attributes.title "LinePlot"
+                , activeClass LinePlot |> Html.Attributes.class, ViewChange LinePlot |> onClick
+                ] [ LinePlotView.icon ]
+            , button
+                [ Html.Attributes.title "Table"
+                , activeClass DataTable |> Html.Attributes.class, ViewChange DataTable |> onClick
+                ] [ DataTableView.icon ]
             ]
         ]
 
-- 
GitLab