convert_to_actix #2

Merged
Yehowshua merged 20 commits from convert_to_actix into main 2025-01-06 06:25:19 +00:00
9 changed files with 32 additions and 34 deletions
Showing only changes of commit 83d8196261 - Show all commits

View file

@ -1,4 +1,4 @@
module Body exposing (Msg(..), Model(..), init, update, view, handleRoute) module Body exposing (Msg(..), Model(..), init, update, view, handleRoute, subscriptions)
import Element import Element
@ -28,6 +28,16 @@ type Model
init : () -> Model init : () -> Model
init flags = ModelLanding (Page.Landing.init flags) init flags = ModelLanding (Page.Landing.init flags)
subscriptions : Model -> Sub Msg
subscriptions model =
case model of
ModelLanding m -> Page.Landing.subscriptions m |> Sub.map MsgLanding
ModelProducts m -> Page.Products.subscriptions m |> Sub.map MsgProducts
ModelResources m -> Page.Resources.subscriptions m |> Sub.map MsgResources
ModelAbout m -> Page.About.subscriptions m |> Sub.map MsgAbout
ModelContact m -> Page.Contact.subscriptions m |> Sub.map MsgContact
ModelNotFound m -> Page.NotFound.subscriptions m |> Sub.map MsgNotFound
handleRoute : String -> Model handleRoute : String -> Model
handleRoute path = handleRoute path =
let let

View file

@ -1,4 +1,11 @@
module Header exposing (Model, Msg, view, init, update) module Header exposing
( Model
, Msg
, view
, init
, subscriptions
, update
)
import Element exposing (Element) import Element exposing (Element)
import Element.Events import Element.Events
import Element.Border import Element.Border
@ -9,6 +16,9 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none
update : Msg -> Model -> (Model, Cmd Msg) update : Msg -> Model -> (Model, Cmd Msg)
update msg model = (model, Cmd.none) update msg model = (model, Cmd.none)

View file

@ -60,8 +60,10 @@ update msg model =
_ -> (model, Cmd.none) _ -> (model, Cmd.none)
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = subscriptions model = Sub.batch
Sub.none [ model.header |> Header.subscriptions |> Sub.map Header
, model.page |> Body.subscriptions |> Sub.map Body
]
view : Model -> Browser.Document Msg view : Model -> Browser.Document Msg

View file

@ -5,7 +5,6 @@ module Page.About exposing
, init , init
, update , update
, subscriptions , subscriptions
, cleanupSubcriptions
) )
import Element exposing (Element) import Element exposing (Element)
@ -15,9 +14,6 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
cleanupSubcriptions : Model -> Cmd Msg
cleanupSubcriptions _ = Cmd.none
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none subscriptions _ = Sub.none

View file

@ -5,7 +5,6 @@ module Page.Contact exposing
, init , init
, update , update
, subscriptions , subscriptions
, cleanupSubcriptions
) )
import Element exposing (Element) import Element exposing (Element)
@ -15,9 +14,6 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
cleanupSubcriptions : Model -> Cmd Msg
cleanupSubcriptions _ = Cmd.none
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none subscriptions _ = Sub.none

View file

@ -5,7 +5,6 @@ module Page.Landing exposing
, init , init
, update , update
, subscriptions , subscriptions
, cleanupSubcriptions
) )
import Element exposing (Element) import Element exposing (Element)
@ -15,9 +14,6 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
cleanupSubcriptions : Model -> Cmd Msg
cleanupSubcriptions _ = Cmd.none
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none subscriptions _ = Sub.none

View file

@ -5,7 +5,6 @@ module Page.NotFound exposing
, init , init
, update , update
, subscriptions , subscriptions
, cleanupSubcriptions
) )
import Element exposing (Element) import Element exposing (Element)
@ -15,9 +14,6 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
cleanupSubcriptions : Model -> Cmd Msg
cleanupSubcriptions _ = Cmd.none
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none subscriptions _ = Sub.none

View file

@ -5,7 +5,6 @@ module Page.Products exposing
, init , init
, update , update
, subscriptions , subscriptions
, cleanupSubcriptions
) )
import Element exposing (Element) import Element exposing (Element)
@ -15,9 +14,6 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
cleanupSubcriptions : Model -> Cmd Msg
cleanupSubcriptions _ = Cmd.none
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none subscriptions _ = Sub.none

View file

@ -5,7 +5,6 @@ module Page.Resources exposing
, init , init
, update , update
, subscriptions , subscriptions
, cleanupSubcriptions
) )
import Element exposing (Element) import Element exposing (Element)
@ -15,9 +14,6 @@ type alias Msg = {}
init : () -> Model init : () -> Model
init flags = {} init flags = {}
cleanupSubcriptions : Model -> Cmd Msg
cleanupSubcriptions _ = Cmd.none
subscriptions : Model -> Sub Msg subscriptions : Model -> Sub Msg
subscriptions _ = Sub.none subscriptions _ = Sub.none