2017-07-17 09:25:57 +00:00
|
|
|
module Models exposing (..)
|
|
|
|
|
2017-07-23 00:51:39 +00:00
|
|
|
-- Core modules
|
|
|
|
|
2017-07-17 19:48:56 +00:00
|
|
|
import Date exposing (Date, now)
|
|
|
|
|
2017-07-17 09:25:57 +00:00
|
|
|
|
2017-07-23 00:51:39 +00:00
|
|
|
-- External modules
|
|
|
|
|
|
|
|
import Navigation exposing (Location)
|
|
|
|
|
|
|
|
|
2017-08-02 20:20:38 +00:00
|
|
|
type alias EventSlug =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias EventInstanceSlug =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias SpeakerSlug =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias DaySlug =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias FilterQuery =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Route is defined here rather than in Routing.elm due to it being used in Model. If it were in Routing.elm we would have a circular dependency.
|
|
|
|
|
|
|
|
|
2017-07-17 09:25:57 +00:00
|
|
|
type Route
|
|
|
|
= OverviewRoute
|
2017-08-02 20:20:38 +00:00
|
|
|
| OverviewFilteredRoute FilterQuery
|
|
|
|
| DayRoute DaySlug
|
2017-07-17 14:05:38 +00:00
|
|
|
| EventRoute EventSlug
|
2017-08-02 20:20:38 +00:00
|
|
|
| SpeakerRoute SpeakerSlug
|
2017-07-17 09:25:57 +00:00
|
|
|
| NotFoundRoute
|
|
|
|
|
|
|
|
|
|
|
|
type alias Model =
|
|
|
|
{ days : List Day
|
2017-07-18 09:26:56 +00:00
|
|
|
, events : List Event
|
2017-07-17 09:25:57 +00:00
|
|
|
, eventInstances : List EventInstance
|
2017-08-16 16:08:34 +00:00
|
|
|
, eventLocations : List FilterType
|
|
|
|
, eventTypes : List FilterType
|
2018-05-20 18:08:25 +00:00
|
|
|
, eventTracks : List FilterType
|
2017-08-02 20:20:38 +00:00
|
|
|
, speakers : List Speaker
|
2017-07-17 09:25:57 +00:00
|
|
|
, flags : Flags
|
|
|
|
, filter : Filter
|
2017-07-23 00:51:39 +00:00
|
|
|
, location : Location
|
2017-07-17 09:25:57 +00:00
|
|
|
, route : Route
|
2017-07-23 16:30:27 +00:00
|
|
|
, dataLoaded : Bool
|
2017-07-17 09:25:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Day =
|
|
|
|
{ day_name : String
|
2017-07-17 19:48:56 +00:00
|
|
|
, date : Date
|
2017-07-17 09:25:57 +00:00
|
|
|
, repr : String
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Speaker =
|
|
|
|
{ name : String
|
2017-08-02 20:20:38 +00:00
|
|
|
, slug : SpeakerSlug
|
|
|
|
, biography : String
|
2017-07-17 09:25:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias EventInstance =
|
|
|
|
{ title : String
|
|
|
|
, slug : EventInstanceSlug
|
|
|
|
, id : Int
|
|
|
|
, url : String
|
|
|
|
, eventSlug : EventSlug
|
|
|
|
, eventType : String
|
2018-05-20 18:08:25 +00:00
|
|
|
, eventTrack : String
|
2017-07-17 09:25:57 +00:00
|
|
|
, backgroundColor : String
|
|
|
|
, forgroundColor : String
|
2017-07-17 19:48:56 +00:00
|
|
|
, from : Date
|
|
|
|
, to : Date
|
2017-07-17 09:25:57 +00:00
|
|
|
, timeslots : Float
|
|
|
|
, location : String
|
|
|
|
, locationIcon : String
|
2017-08-03 20:58:12 +00:00
|
|
|
, videoState : String
|
|
|
|
, videoUrl : Maybe String
|
2017-07-27 21:21:16 +00:00
|
|
|
, isFavorited : Maybe Bool
|
2017-07-17 09:25:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Event =
|
|
|
|
{ title : String
|
|
|
|
, slug : EventSlug
|
|
|
|
, abstract : String
|
2017-08-02 20:20:38 +00:00
|
|
|
, speakerSlugs : List SpeakerSlug
|
2017-08-03 20:58:12 +00:00
|
|
|
, videoState : String
|
|
|
|
, videoUrl : Maybe String
|
2017-07-27 21:21:16 +00:00
|
|
|
, eventType : String
|
2017-07-17 09:25:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type alias Flags =
|
|
|
|
{ schedule_timeslot_length_minutes : Int
|
|
|
|
, schedule_midnight_offset_hours : Int
|
|
|
|
, ics_button_href : String
|
|
|
|
, camp_slug : String
|
2017-07-20 09:18:14 +00:00
|
|
|
, websocket_server : String
|
2017-07-17 09:25:57 +00:00
|
|
|
}
|
2017-08-16 16:08:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- FILTERS
|
|
|
|
|
|
|
|
|
|
|
|
type alias FilterName =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias FilterSlug =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias LocationIcon =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias TypeColor =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
|
|
|
type alias TypeLightText =
|
|
|
|
Bool
|
|
|
|
|
|
|
|
|
|
|
|
type FilterType
|
|
|
|
= TypeFilter FilterName FilterSlug TypeColor TypeLightText
|
|
|
|
| LocationFilter FilterName FilterSlug LocationIcon
|
|
|
|
| VideoFilter FilterName FilterSlug
|
2018-05-20 18:08:25 +00:00
|
|
|
| TrackFilter FilterName FilterSlug
|
2017-08-16 16:08:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
type alias Filter =
|
|
|
|
{ eventTypes : List FilterType
|
|
|
|
, eventLocations : List FilterType
|
2018-05-20 18:08:25 +00:00
|
|
|
, eventTracks : List FilterType
|
2017-08-16 16:08:34 +00:00
|
|
|
, videoRecording : List FilterType
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unpackFilterType filter =
|
|
|
|
case filter of
|
|
|
|
TypeFilter name slug _ _ ->
|
|
|
|
( name, slug )
|
|
|
|
|
|
|
|
LocationFilter name slug _ ->
|
|
|
|
( name, slug )
|
|
|
|
|
|
|
|
VideoFilter name slug ->
|
|
|
|
( name, slug )
|
|
|
|
|
2018-05-20 18:08:25 +00:00
|
|
|
TrackFilter name slug ->
|
|
|
|
( name, slug )
|
|
|
|
|
2017-08-16 16:08:34 +00:00
|
|
|
|
|
|
|
getSlugFromFilterType filter =
|
|
|
|
let
|
|
|
|
( _, slug ) =
|
|
|
|
unpackFilterType filter
|
|
|
|
in
|
|
|
|
slug
|
|
|
|
|
|
|
|
|
|
|
|
getNameFromFilterType filter =
|
|
|
|
let
|
|
|
|
( name, slug ) =
|
|
|
|
unpackFilterType filter
|
|
|
|
in
|
|
|
|
name
|