From aaa1031d933c6bff524b83b03b922f1fbc3bc2ef Mon Sep 17 00:00:00 2001
From: Damian Romano Haj-Houssin <damian.haj-houssin@student.uni-halle.de>
Date: Sun, 5 Jan 2025 11:43:40 +0100
Subject: [PATCH] Moved icon definitions to their respective views.

---
 src/Main.elm                     | 10 +++++-----
 src/Views/BarPlot.elm            |  5 ++++-
 src/Views/DataTableView.elm      |  6 +++++-
 src/Views/ForceDirectedGraph.elm |  3 +++
 src/Views/LinePlot.elm           |  6 +++++-
 src/Views/MapView.elm            |  6 +++++-
 6 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/src/Main.elm b/src/Main.elm
index 1c56d98..9b45a32 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -169,15 +169,15 @@ viewNav ( global, _ ) =
             [ text "Schengen Visa Statistics" ]
         , div [ Html.Attributes.class "navbar-view-icons" ]
             [ button [ activeClass MapView |> Html.Attributes.class, ViewChange MapView |> onClick ]
-                [ i [ Html.Attributes.class "fa-solid fa-map fa-xl" ] [] ]
+                [ MapView.icon ]
             , button [ activeClass ForceDirectedGraph |> Html.Attributes.class, ViewChange ForceDirectedGraph |> onClick ]
-                [ i [ Html.Attributes.class "fa-solid fa-hexagon-nodes fa-xl" ] [] ]
+                [ ForceDirectedGraphView.icon ]
             , button [ activeClass BarPlot |> Html.Attributes.class, ViewChange BarPlot |> onClick ]
-                [ i [ Html.Attributes.class "fa-solid fa-chart-simple fa-xl" ] [] ]
+                [ BarPlotView.icon ]
             , button [ activeClass LinePlot |> Html.Attributes.class, ViewChange LinePlot |> onClick ]
-                [ i [ Html.Attributes.class "fa-solid fa-chart-line fa-xl" ] [] ]
+                [ LinePlotView.icon ]
             , button [ activeClass DataTable |> Html.Attributes.class, ViewChange DataTable |> onClick ]
-                [ i [ Html.Attributes.class "fa-solid fa-table fa-xl" ] [] ]
+                [ DataTableView.icon ]
             ]
         ]
 
diff --git a/src/Views/BarPlot.elm b/src/Views/BarPlot.elm
index 4270989..37f0ac1 100644
--- a/src/Views/BarPlot.elm
+++ b/src/Views/BarPlot.elm
@@ -1,4 +1,4 @@
-module Views.BarPlot exposing (view, init, update)
+module Views.BarPlot exposing (view, init, update, icon)
 
 import Config.BarPlotConfig as Local exposing (Model)
 
@@ -20,6 +20,9 @@ import TypedSvg.Types exposing (AnchorAlignment(..), Transform(..))
 
 import Utils exposing (codeToName)
 
+icon : Html Msg
+icon =
+    Html.i [ Html.Attributes.class "fa-solid fa-chart-simple fa-xl" ] []
 
 -- Constants for width and height
 w : Float
diff --git a/src/Views/DataTableView.elm b/src/Views/DataTableView.elm
index 39e494d..44eb9bf 100644
--- a/src/Views/DataTableView.elm
+++ b/src/Views/DataTableView.elm
@@ -1,4 +1,4 @@
-module Views.DataTableView exposing (view, update, subscriptions, init)
+module Views.DataTableView exposing (view, update, subscriptions, init, icon)
 
 import Html exposing (Html, div, button, i, input, text, table, thead, tbody, tr, th, td)
 import Html.Attributes
@@ -9,6 +9,10 @@ import Data.DataLoader exposing (Entry)
 import Config.DataTableConfig as Local exposing (Model)
 import Utils exposing (codeToName)
 
+icon : Html Msg
+icon =
+    i [ Html.Attributes.class "fa-solid fa-table fa-xl" ] []
+
 propagate : Local.Msg -> Msg
 propagate msg =
     GotDataTable msg
diff --git a/src/Views/ForceDirectedGraph.elm b/src/Views/ForceDirectedGraph.elm
index 2c5842e..deb39b6 100644
--- a/src/Views/ForceDirectedGraph.elm
+++ b/src/Views/ForceDirectedGraph.elm
@@ -26,6 +26,9 @@ import TypedSvg.Core exposing (Attribute, Svg, text)
 import TypedSvg.Types exposing (AlignmentBaseline(..), AnchorAlignment(..), Paint(..), ShapeRendering(..), TextRendering(..), px)
 import Utils exposing (flag)
 
+icon : Html Msg
+icon =
+    Html.i [ Html.Attributes.class "fa-solid fa-hexagon-nodes fa-xl" ] []
 
 w : Float
 w =
diff --git a/src/Views/LinePlot.elm b/src/Views/LinePlot.elm
index 2c431e8..43c279c 100644
--- a/src/Views/LinePlot.elm
+++ b/src/Views/LinePlot.elm
@@ -1,4 +1,4 @@
-module Views.LinePlot exposing (view, init, update)
+module Views.LinePlot exposing (view, init, update, icon)
 import Model exposing (Global, View(..))
 import Msg exposing (Msg(..))
 import Data.DataLoader exposing (Entry)
@@ -18,6 +18,10 @@ import Axis
 import Config.LinePlotConfig as Local exposing (Model)
 import Utils exposing (codeToName)
 
+icon : Html Msg
+icon =
+    Html.i [ Html.Attributes.class "fa-solid fa-chart-line fa-xl" ] []
+
 init : Model
 init = { pointAnnotation = Nothing , vLineAnnotation = Nothing }
 
diff --git a/src/Views/MapView.elm b/src/Views/MapView.elm
index c5f823d..7237fbc 100644
--- a/src/Views/MapView.elm
+++ b/src/Views/MapView.elm
@@ -1,4 +1,4 @@
-module Views.MapView exposing (view, update, init, subscriptions, getMapData)
+module Views.MapView exposing (view, update, init, subscriptions, getMapData, icon)
 
 import Http
 import Html exposing (Html, div, text, select, option, span)
@@ -30,6 +30,10 @@ import Svg.Events exposing (onMouseOver, onMouseOut, onClick)
 import Zoom
 import Task
 
+icon : Html Msg
+icon =
+    Html.i [ Html.Attributes.class "fa-solid fa-map fa-xl" ] []
+
 w : Float
 w = 1200
 
-- 
GitLab