module Shared exposing (Data, Model, Msg(..), SharedMsg(..), template) import BackendTask exposing (BackendTask) import Effect exposing (Effect) import Element exposing (..) import Element.Background as Background import FatalError exposing (FatalError) import Html exposing (Html) import Html.Attributes as Attributes import Pages.Flags import Pages.PageUrl exposing (PageUrl) import Route exposing (Route) import SharedTemplate exposing (SharedTemplate) import UrlPath exposing (UrlPath) import View exposing (View) template : SharedTemplate Msg Model Data msg template = { init = init , update = update , view = view , data = data , subscriptions = subscriptions , onPageChange = Nothing } type Msg = SharedMsg SharedMsg | MenuClicked type alias Data = () type SharedMsg = NoOp type alias Model = { showMenu : Bool } init : Pages.Flags.Flags -> Maybe { path : { path : UrlPath , query : Maybe String , fragment : Maybe String } , metadata : route , pageUrl : Maybe PageUrl } -> ( Model, Effect Msg ) init flags maybePagePath = ( { showMenu = False } , Effect.none ) update : Msg -> Model -> ( Model, Effect Msg ) update msg model = case msg of SharedMsg globalMsg -> ( model, Effect.none ) MenuClicked -> ( { model | showMenu = not model.showMenu }, Effect.none ) subscriptions : UrlPath -> Model -> Sub Msg subscriptions _ _ = Sub.none data : BackendTask FatalError Data data = BackendTask.succeed () view : Data -> { path : UrlPath , route : Maybe Route } -> Model -> (Msg -> msg) -> View msg -> { body : List (Html msg), title : String } view sharedData page model toMsg pageView = { body = [ Html.div [] [ Html.img [ Attributes.src "https://mc.yandex.ru/watch/99382050" , Attributes.style "position" "absolute" , Attributes.style "left" "-9999px;" , Attributes.alt "" ] [] ] , layout [ Background.color (rgb255 243 243 243) ] pageView.body ] , title = pageView.title }