2017-07-17 10:53:38 +00:00
|
|
|
module Views.ScheduleOverview exposing (scheduleOverviewView)
|
|
|
|
|
|
|
|
-- Local modules
|
|
|
|
|
|
|
|
import Messages exposing (Msg(..))
|
2017-08-02 20:20:38 +00:00
|
|
|
import Models exposing (Model, Day, EventInstance, Filter, Route(EventRoute))
|
2017-07-23 00:51:39 +00:00
|
|
|
import Views.FilterView exposing (filterSidebar, applyFilters, parseFilterFromQuery)
|
2017-08-02 20:20:38 +00:00
|
|
|
import Routing exposing (routeToString)
|
2017-07-17 10:53:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- External modules
|
|
|
|
|
|
|
|
import Html exposing (Html, text, div, ul, li, span, i, h4, p, small, a)
|
2017-07-17 15:59:38 +00:00
|
|
|
import Html.Lazy exposing (lazy, lazy2)
|
2017-07-17 10:53:38 +00:00
|
|
|
import Html.Attributes exposing (class, classList, href, style)
|
2017-07-19 14:12:12 +00:00
|
|
|
import Date.Extra
|
2017-07-17 10:53:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
scheduleOverviewView : Model -> Html Msg
|
|
|
|
scheduleOverviewView model =
|
|
|
|
div [ class "row" ]
|
|
|
|
[ filterSidebar model
|
|
|
|
, div
|
|
|
|
[ classList
|
|
|
|
[ ( "col-sm-9", True )
|
|
|
|
, ( "col-sm-pull-3", True )
|
|
|
|
]
|
|
|
|
]
|
2017-07-17 15:59:38 +00:00
|
|
|
(List.map (\day -> lazy2 dayRowView day model) model.days)
|
2017-07-17 10:53:38 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
dayRowView : Day -> Model -> Html Msg
|
|
|
|
dayRowView day model =
|
|
|
|
let
|
|
|
|
filteredEventInstances =
|
2017-07-19 14:12:12 +00:00
|
|
|
applyFilters day model
|
2017-07-17 10:53:38 +00:00
|
|
|
in
|
|
|
|
div []
|
|
|
|
[ h4 []
|
|
|
|
[ text day.repr ]
|
|
|
|
, div [ class "schedule-day-row" ]
|
2017-07-17 15:59:38 +00:00
|
|
|
(List.map (lazy dayEventInstanceView) filteredEventInstances)
|
2017-07-17 10:53:38 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
dayEventInstanceView : EventInstance -> Html Msg
|
|
|
|
dayEventInstanceView eventInstance =
|
|
|
|
a
|
2017-07-19 14:12:12 +00:00
|
|
|
[ classList
|
|
|
|
[ ( "event", True )
|
|
|
|
, ( "event-in-overview", True )
|
|
|
|
]
|
2017-08-02 20:20:38 +00:00
|
|
|
, href <| routeToString <| EventRoute eventInstance.eventSlug
|
2017-07-17 10:53:38 +00:00
|
|
|
, style
|
|
|
|
[ ( "background-color", eventInstance.backgroundColor )
|
|
|
|
, ( "color", eventInstance.forgroundColor )
|
|
|
|
]
|
|
|
|
]
|
2017-07-18 11:35:17 +00:00
|
|
|
([ small []
|
2017-07-17 19:48:56 +00:00
|
|
|
[ text
|
2017-07-19 14:12:12 +00:00
|
|
|
((Date.Extra.toFormattedString "HH:mm" eventInstance.from)
|
2017-07-17 19:48:56 +00:00
|
|
|
++ " - "
|
2017-07-19 14:12:12 +00:00
|
|
|
++ (Date.Extra.toFormattedString "HH:mm" eventInstance.to)
|
2017-07-17 19:48:56 +00:00
|
|
|
)
|
|
|
|
]
|
2017-07-18 11:35:17 +00:00
|
|
|
]
|
|
|
|
++ (dayEventInstanceIcons eventInstance)
|
|
|
|
++ [ p
|
|
|
|
[]
|
|
|
|
[ text eventInstance.title ]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
dayEventInstanceIcons : EventInstance -> List (Html Msg)
|
|
|
|
dayEventInstanceIcons eventInstance =
|
|
|
|
let
|
|
|
|
videoIcon =
|
2017-08-03 20:58:12 +00:00
|
|
|
case eventInstance.videoState of
|
|
|
|
"has-recording" ->
|
|
|
|
[ i
|
2018-08-04 22:15:04 +00:00
|
|
|
[ classList [ ( "fa", True ), ( "fa-film", True ), ( "pull-right", True ), ( "fa-fw", True ) ] ]
|
2017-08-03 20:58:12 +00:00
|
|
|
[]
|
|
|
|
]
|
|
|
|
|
|
|
|
"to-be-recorded" ->
|
|
|
|
[ i
|
2018-08-05 10:42:18 +00:00
|
|
|
[ classList [ ( "fa", True ), ( "fa-video", True ), ( "pull-right", True ), ( "fa-fw", True ) ] ]
|
2017-08-03 20:58:12 +00:00
|
|
|
[]
|
|
|
|
]
|
|
|
|
|
2017-08-16 17:39:30 +00:00
|
|
|
"not-to-be-recorded" ->
|
|
|
|
[ i
|
2018-08-05 10:42:18 +00:00
|
|
|
[ classList [ ( "fa", True ), ( "fa-video-slash", True ), ( "pull-right", True ), ( "fa-fw", True ) ] ]
|
2017-08-16 17:39:30 +00:00
|
|
|
[]
|
|
|
|
]
|
|
|
|
|
2017-08-03 20:58:12 +00:00
|
|
|
_ ->
|
|
|
|
[]
|
2017-07-18 11:35:17 +00:00
|
|
|
in
|
2018-08-04 22:15:04 +00:00
|
|
|
[ i [ classList [ ( "fa", True ), ( "fa-" ++ eventInstance.locationIcon, True ), ( "pull-right", True ), ( "fa-fw", True ) ] ] []
|
2017-07-17 10:53:38 +00:00
|
|
|
]
|
2017-07-18 11:35:17 +00:00
|
|
|
++ videoIcon
|