website/frontend/src/Pages/Nutridex.elm

122 lines
2.5 KiB
Elm
Raw Normal View History

2024-12-01 02:56:13 -06:00
module Pages.Nutridex exposing (Model, Msg, page)
2024-12-09 19:53:09 -06:00
import Config.Data.Identity exposing (pageNames)
import Config.Format.Response
exposing
( pageListDesktop
, topLevelContainer
)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Products.Helpers exposing (..)
import Config.Pages.Products.NutriDex.NutriDex exposing (productNutriDex)
import Config.Style.Colour exposing (colourTheme)
2024-12-01 02:56:13 -06:00
import Effect exposing (Effect)
import Element as E exposing (..)
2024-12-09 19:53:09 -06:00
import Config.Pages.Headers.Helpers exposing (headerMaker)
import Config.Pages.Headers.Pages.Donate exposing (donateHeader)
import Config.Pages.Headers.Pages.NutriDex exposing (nutriDexHeader)
2024-12-01 02:56:13 -06:00
import Layouts
import Page exposing (Page)
import Route exposing (Route)
import Shared exposing (..)
import View exposing (View)
page : Shared.Model -> Route () -> Page Model Msg
page shared route =
Page.new
{ init = init
, update = update
, subscriptions = subscriptions
, view = view shared
2024-12-01 02:56:13 -06:00
}
|> Page.withLayout toLayout
toLayout : Model -> Layouts.Layout Msg
toLayout model =
2024-12-07 15:43:26 -06:00
Layouts.Navbar {}
2024-12-01 02:56:13 -06:00
-- INIT
type alias Model =
{}
init : () -> ( Model, Effect Msg )
init () =
( {}
2024-12-03 04:59:27 -06:00
, Effect.map
(\_ -> NoOp)
(Effect.sendCmd resetViewport)
2024-12-01 02:56:13 -06:00
)
2024-12-01 02:56:13 -06:00
-- UPDATE
type Msg
= NoOp
update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
case msg of
NoOp ->
( model
, Effect.none
)
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- VIEW
view : Shared.Model -> Model -> View Msg
view shared model =
2024-12-08 02:18:36 -06:00
{ title = pageNames.pageNutriDex ++ " ( )"
2024-12-01 02:56:13 -06:00
, attributes = []
, element = nutriDexContainer shared.device
2024-12-01 02:56:13 -06:00
}
nutriDexContainer : Device -> Element msg
nutriDexContainer device =
topLevelContainer (nutriDexList device)
nutriDexList : Device -> Element msg
nutriDexList device =
column
(case ( device.class, device.orientation ) of
2024-12-07 15:43:26 -06:00
_ ->
pageListDesktop
)
<|
2024-12-01 02:56:13 -06:00
List.concat
[ (case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
List.map nutriDexMakerMobile
( Tablet, Portrait ) ->
List.map nutriDexMakerMobile
2024-12-07 15:43:26 -06:00
_ ->
List.map nutriDexMaker
)
2024-12-01 02:56:13 -06:00
[ productNutriDex ]
]