2017-07-17 09:25:57 +00:00
|
|
|
module Views exposing (..)
|
|
|
|
|
|
|
|
-- Local modules
|
|
|
|
|
|
|
|
import Models exposing (..)
|
|
|
|
import Messages exposing (Msg(..))
|
2017-07-17 10:53:38 +00:00
|
|
|
import Views.DayPicker exposing (dayPicker)
|
|
|
|
import Views.DayView exposing (dayView)
|
2017-07-17 14:05:38 +00:00
|
|
|
import Views.EventDetail exposing (eventDetailView)
|
2017-07-17 10:53:38 +00:00
|
|
|
import Views.ScheduleOverview exposing (scheduleOverviewView)
|
2017-07-17 09:25:57 +00:00
|
|
|
|
|
|
|
|
2017-07-19 14:12:12 +00:00
|
|
|
-- Core modules
|
|
|
|
|
|
|
|
import Date exposing (Month(..))
|
|
|
|
|
|
|
|
|
2017-07-17 09:25:57 +00:00
|
|
|
-- External modules
|
|
|
|
|
2017-07-17 10:53:38 +00:00
|
|
|
import Html exposing (Html, Attribute, div, input, text, li, ul, a, h4, label, i, span, hr, small, p)
|
2017-07-19 14:12:12 +00:00
|
|
|
import Date.Extra
|
2017-07-17 09:25:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
view : Model -> Html Msg
|
|
|
|
view model =
|
|
|
|
div []
|
2017-07-17 10:53:38 +00:00
|
|
|
[ dayPicker model
|
2017-07-17 09:25:57 +00:00
|
|
|
, hr [] []
|
|
|
|
, case model.route of
|
|
|
|
OverviewRoute ->
|
|
|
|
scheduleOverviewView model
|
|
|
|
|
2017-07-23 00:51:39 +00:00
|
|
|
OverviewFilteredRoute _ ->
|
|
|
|
scheduleOverviewView model
|
|
|
|
|
2017-07-17 09:25:57 +00:00
|
|
|
DayRoute dayIso ->
|
2017-07-19 14:12:12 +00:00
|
|
|
let
|
|
|
|
day =
|
|
|
|
case (List.head (List.filter (\x -> (Date.Extra.toFormattedString "y-MM-dd" x.date) == dayIso) model.days)) of
|
|
|
|
Just day ->
|
|
|
|
day
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
Day "" (Date.Extra.fromParts 1970 Jan 1 0 0 0 0) ""
|
|
|
|
in
|
|
|
|
dayView day model
|
2017-07-17 09:25:57 +00:00
|
|
|
|
2017-07-17 14:05:38 +00:00
|
|
|
EventRoute eventSlug ->
|
|
|
|
eventDetailView eventSlug model
|
2017-07-17 09:25:57 +00:00
|
|
|
|
|
|
|
NotFoundRoute ->
|
|
|
|
div [] [ text "Not found!" ]
|
|
|
|
]
|