module Pages.Nutridex exposing (Model, Msg, page) import Config.Colour as T exposing (..) import Config.Format as O exposing (..) import Config.Identity as I exposing (..) import Config.Response exposing (..) import Config.Viewport exposing (..) import Donate.Types exposing (..) import Effect exposing (Effect) import Element as E exposing (..) import Element.Background as B exposing (..) import Element.Border as D exposing (..) import Element.Font as F import Headers.Helpers exposing (headerMaker) import Headers.Pages.Donate exposing (donateHeader) import Headers.Pages.NutriDex exposing (nutriDexHeader) import Html import Html.Attributes as H exposing (style) import Layout exposing (..) import Layouts import Page exposing (Page) import Products.Helpers exposing (..) import Products.NutriDex.NutriDex exposing (productNutriDex) 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 { currentRoute = nutriDexName } -- 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 = nutriDexName , 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 ( Phone, Portrait ) -> pageListDesktop ( Phone, Landscape ) -> pageListDesktop ( Tablet, Portrait ) -> pageListDesktop ( Tablet, Landscape ) -> pageListDesktop ( Desktop, Portrait ) -> pageListDesktop ( Desktop, Landscape ) -> pageListDesktop ( BigDesktop, Portrait ) -> pageListDesktop ( BigDesktop, Landscape ) -> pageListDesktop ) <| List.concat [ (case ( device.class, device.orientation ) of ( Phone, Portrait ) -> List.map nutriDexMakerMobile ( Phone, Landscape ) -> List.map nutriDexMakerMobile ( Tablet, Portrait ) -> List.map nutriDexMakerMobile ( Tablet, Landscape ) -> List.map nutriDexMakerMobile ( Desktop, Portrait ) -> List.map nutriDexMaker ( Desktop, Landscape ) -> List.map nutriDexMaker ( BigDesktop, Portrait ) -> List.map nutriDexMaker ( BigDesktop, Landscape ) -> List.map nutriDexMaker ) [ productNutriDex ] ]