From 5adc93550cdd06546c9ff165b5be2b0c320aaddc Mon Sep 17 00:00:00 2001 From: Vegar Sechmann Molvig Date: Wed, 3 Jul 2024 01:43:13 +0200 Subject: [PATCH] fix assets, fmt --- dist/index.html | 61 +++++++++++++++++----------------------------- elm.json | 51 +++++++++++++++++++------------------- flake.nix | 1 - index.html | 2 +- src/Main.elm | 3 --- src/Page/Home.elm | 41 +++++++++++++++---------------- src/Views/Page.elm | 3 ++- 7 files changed, 71 insertions(+), 91 deletions(-) diff --git a/dist/index.html b/dist/index.html index a121cbd..860e65e 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,40 +1,25 @@ - - - - - Go og Varm - - - + + + + + + + + Go' og varm + + + + + + - - -

-
-
-
-
-
+  
+    
+  
 
diff --git a/elm.json b/elm.json
index 426f179..37e5be0 100644
--- a/elm.json
+++ b/elm.json
@@ -1,30 +1,29 @@
 {
-    "type": "application",
-    "source-directories": [
-        "src"
-    ],
-    "elm-version": "0.19.1",
-    "dependencies": {
-        "direct": {
-            "NoRedInk/elm-json-decode-pipeline": "1.0.1",
-            "elm/browser": "1.0.0",
-            "elm/core": "1.0.0",
-            "elm/html": "1.0.0",
-            "elm/json": "1.1.2",
-            "elm/url": "1.0.0",
-            "mdgriffith/elm-ui": "1.1.8"
-        },
-        "indirect": {
-            "elm/time": "1.0.0",
-            "elm/virtual-dom": "1.0.2"
-        }
+  "type": "application",
+  "source-directories": ["src"],
+  "elm-version": "0.19.1",
+  "dependencies": {
+    "direct": {
+      "NoRedInk/elm-json-decode-pipeline": "1.0.1",
+      "elm/browser": "1.0.2",
+      "elm/core": "1.0.5",
+      "elm/html": "1.0.0",
+      "elm/json": "1.1.3",
+      "elm/url": "1.0.0",
+      "hmsk/elm-vite-plugin-helper": "1.0.1",
+      "mdgriffith/elm-ui": "1.1.8"
     },
-    "test-dependencies": {
-        "direct": {
-            "elm-explorations/test": "1.2.2"
-        },
-        "indirect": {
-            "elm/random": "1.0.0"
-        }
+    "indirect": {
+      "elm/time": "1.0.0",
+      "elm/virtual-dom": "1.0.3"
     }
+  },
+  "test-dependencies": {
+    "direct": {
+      "elm-explorations/test": "1.2.2"
+    },
+    "indirect": {
+      "elm/random": "1.0.0"
+    }
+  }
 }
diff --git a/flake.nix b/flake.nix
index e17bd7e..06dc140 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,7 +12,6 @@
 
   outputs = inputs @ {
     flake-parts,
-    dream2nix,
     ...
   }:
     flake-parts.lib.mkFlake {inherit inputs;} {
diff --git a/index.html b/index.html
index 5760851..6ef1051 100644
--- a/index.html
+++ b/index.html
@@ -1,4 +1,4 @@
-
+
 
   
     
diff --git a/src/Main.elm b/src/Main.elm
index 0aa42e8..e0a5d20 100644
--- a/src/Main.elm
+++ b/src/Main.elm
@@ -42,9 +42,6 @@ type Msg
 changeRouteTo : Maybe Route -> Model -> ( Model, Cmd Msg )
 changeRouteTo maybeRoute model =
     let
-        _ =
-            Debug.log "hei" maybeRoute
-
         session =
             toSession model
 
diff --git a/src/Page/Home.elm b/src/Page/Home.elm
index b36823d..5f6e29b 100644
--- a/src/Page/Home.elm
+++ b/src/Page/Home.elm
@@ -1,10 +1,11 @@
 module Page.Home exposing (Model, Msg, init, update, view)
 
-import Element exposing (Element, centerX, el, fill, image, link, padding, paragraph, row, spacing, text, textColumn, width)
+import Element exposing (Element, centerX, column, el, fill, image, padding, paragraph, row, spacing, text, textColumn, width)
 import Element.Border exposing (shadow)
 import Element.Font as Font
 import Session exposing (Session)
 import Stylesheet exposing (Color(..), color)
+import VitePluginHelper
 
 
 type Msg
@@ -13,7 +14,7 @@ type Msg
 
 type alias Model =
     { images : List { src : String, caption : String }
-    , post : String
+    , post : Element.Element Msg
     , session : Session
     }
 
@@ -21,16 +22,18 @@ type alias Model =
 init : Session -> ( Model, Cmd Msg )
 init session =
     ( { images =
-            [ { src = "front1.jpg", caption = "" }
-            , { src = "front2.jpg", caption = "" }
-            , { src = "front3.jpg", caption = "" }
-            , { src = "front4.jpg", caption = "" }
+            [ { src = VitePluginHelper.asset "/assets/thumb.front1.jpg", caption = "" }
+            , { src = VitePluginHelper.asset "/assets/thumb.front2.jpg", caption = "" }
+            , { src = VitePluginHelper.asset "/assets/thumb.front3.jpg", caption = "" }
+            , { src = VitePluginHelper.asset "/assets/thumb.front4.jpg", caption = "" }
             ]
-      , post = """Velkommen til gårdsbutikken Go’ og varm på Søndre Holm.
-
-Her selges norske saueskinn og skinnfeller, ull og silke til toving, filting og spinning, alpakkagarn fra Du Store Alpakka, ullgarn fra bl.a. Leine Merino, Askeladden og Hillesvåg, mønster, knapper, ulltøy, ullsåler og mye annet rart!
-
-På hjemmesiden vises bare et lite utvalg. Skinnfeller sys på bestilling. Åpent tirsdag og torsdag kl. 10.00-20.00."""
+      , post =
+            column [ spacing 20 ]
+                [ paragraph [ Font.bold ] [ text "Velkommen til gårdsbutikken Go’ og varm på Søndre Holm." ]
+                , paragraph [] [ text "Her selges norske saueskinn og skinnfeller, ull og silke til toving, filting og spinning, alpakkagarn fra Du Store Alpakka, ullgarn fra bl.a. Leine Merino, Askeladden og Hillesvåg, mønster, knapper, ulltøy, ullsåler og mye annet rart!" ]
+                , paragraph [] [ text "På hjemmesiden vises bare et lite utvalg. Skinnfeller sys på bestilling." ]
+                , paragraph [] [ text "Åpent tirsdag og torsdag kl. 10.00-20.00." ]
+                ]
       , session = session
       }
     , Cmd.none
@@ -46,18 +49,14 @@ update msg model =
 
 img : { src : String, caption : String } -> Element msg
 img i =
-    link [ centerX, shadow { offset = ( 2.0, 2.0 ), size = 1, blur = 15.0, color = color Gray } ]
-        { url = "/assets/" ++ i.src
-        , label =
-            image
-                []
-                { src = "/assets/thumb." ++ i.src
-                , description = i.caption
-                }
+    image
+        [ centerX, shadow { offset = ( 2.0, 2.0 ), size = 1, blur = 15.0, color = color Gray } ]
+        { src = i.src
+        , description = i.caption
         }
 
 
-view : Model -> { title : String, content : List (Element msg) }
+view : Model -> { title : String, content : List (Element Msg) }
 view model =
     { title = "Hjem"
     , content =
@@ -66,7 +65,7 @@ view model =
             [ textColumn [ centerX, Font.size 16, Font.center ]
                 [ paragraph []
                     [ el [ padding 5 ]
-                        (text model.post)
+                        model.post
                     ]
                 ]
             ]
diff --git a/src/Views/Page.elm b/src/Views/Page.elm
index d214e46..093982c 100644
--- a/src/Views/Page.elm
+++ b/src/Views/Page.elm
@@ -9,6 +9,7 @@ import Element.Region as Region
 import Stylesheet exposing (Color(..), color)
 import Viewer exposing (Viewer)
 import Views.Navigation exposing (navigation)
+import VitePluginHelper
 
 
 view : Maybe Viewer -> { title : String, content : List (Element msg) } -> Document msg
@@ -32,7 +33,7 @@ view _ { title, content } =
                     , link [ alignRight ] { url = "https://goo.gl/maps/g26t1xp4ph33bN4G7", label = text "Ulvedalsveien 150, 2020 Skedsmokorset" }
                     ]
                 , row [ width fill, padding 30 ]
-                    [ image [ centerX ] { src = "assets/logo.svg", description = "Go og varm" }
+                    [ image [ centerX ] { src = VitePluginHelper.asset "/assets/logo.svg", description = "Go og varm" }
                     ]
                 ]