module Pages.Nutridex exposing (Model, Msg, page) import Config.Data.Identity exposing (pageNames) import Config.Format.Response exposing ( pageList , 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) import Effect exposing (Effect) import Element as E exposing (..) import Config.Pages.Headers.Helpers exposing (headerMaker) import Config.Pages.Headers.Pages.Donate exposing (donateHeader) import Config.Pages.Headers.Pages.NutriDex exposing (nutriDexHeader) 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 } |> Page.withLayout toLayout toLayout : Model -> Layouts.Layout Msg toLayout model = Layouts.Navbar {} -- INIT type alias Model = {} init : () -> ( Model, Effect Msg ) init () = ( {} , Effect.map (\_ -> NoOp) (Effect.sendCmd resetViewport) ) -- 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 = { title = pageNames.pageNutriDex ++ " ( )" , attributes = [] , element = nutriDexContainer shared.device } nutriDexContainer : Device -> Element msg nutriDexContainer device = topLevelContainer (nutriDexList device) nutriDexList : Device -> Element msg nutriDexList device = column (case ( device.class, device.orientation ) of _ -> pageList ) <| List.concat [ (case ( device.class, device.orientation ) of ( Phone, Portrait ) -> List.map nutriDexMakerMobile ( Tablet, Portrait ) -> List.map nutriDexMakerMobile _ -> List.map nutriDexMaker ) [ productNutriDex ] ]