Accept no date
This commit is contained in:
parent
d26dacc40f
commit
383dd93637
|
@ -27,7 +27,7 @@ type alias Video =
|
||||||
{ name : String
|
{ name : String
|
||||||
, url : String
|
, url : String
|
||||||
, duration : Int
|
, duration : Int
|
||||||
, date : Time.Posix
|
, date : Maybe Time.Posix
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -152,10 +152,10 @@ parseVideo url result =
|
||||||
Ok v
|
Ok v
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
Ok { name = "", url = url, duration = 0, date = Time.millisToPosix 0 }
|
Ok { name = "", url = url, duration = 0, date = Nothing }
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
Ok { name = "", url = url, duration = 0, date = Time.millisToPosix 0 }
|
Ok { name = "", url = url, duration = 0, date = Nothing }
|
||||||
|
|
||||||
|
|
||||||
fetchPlaylistsMapper : List String -> Task x (List Playlist)
|
fetchPlaylistsMapper : List String -> Task x (List Playlist)
|
||||||
|
@ -247,4 +247,4 @@ decodeVideo url =
|
||||||
Decode.map3 (\x y -> Video x url y)
|
Decode.map3 (\x y -> Video x url y)
|
||||||
(Decode.field "title" Decode.string)
|
(Decode.field "title" Decode.string)
|
||||||
(Decode.map Basics.round (Decode.field "duration" Decode.float))
|
(Decode.map Basics.round (Decode.field "duration" Decode.float))
|
||||||
(Decode.field "date" Iso8601.decoder)
|
(Decode.nullable (Decode.field "date" Iso8601.decoder))
|
||||||
|
|
|
@ -314,9 +314,14 @@ videoView zone playlist video =
|
||||||
, Element.paddingEach { top = 10, left = 0, bottom = 0, right = 0 }
|
, Element.paddingEach { top = 10, left = 0, bottom = 0, right = 0 }
|
||||||
]
|
]
|
||||||
[ Element.text video.name ]
|
[ Element.text video.name ]
|
||||||
, Element.paragraph
|
, case video.date of
|
||||||
|
Just date ->
|
||||||
|
Element.paragraph
|
||||||
[ Font.size Consts.titleFontSize ]
|
[ Font.size Consts.titleFontSize ]
|
||||||
[ Element.text ("Diffusé le " ++ formatDate zone video.date) ]
|
[ Element.text ("Diffusé le " ++ formatDate zone date) ]
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Element.none
|
||||||
]
|
]
|
||||||
, Element.column [ Element.alignTop, Element.spacing 10, Element.width (Element.fillPortion 1) ]
|
, Element.column [ Element.alignTop, Element.spacing 10, Element.width (Element.fillPortion 1) ]
|
||||||
(List.map (videoInList zone playlist video) playlist.videos)
|
(List.map (videoInList zone playlist video) playlist.videos)
|
||||||
|
@ -331,10 +336,15 @@ videoDescription zone video =
|
||||||
, Font.size Consts.titleFontSize
|
, Font.size Consts.titleFontSize
|
||||||
]
|
]
|
||||||
[ Element.text video.name ]
|
[ Element.text video.name ]
|
||||||
, Element.paragraph
|
, case video.date of
|
||||||
|
Just date ->
|
||||||
|
Element.paragraph
|
||||||
[ Font.color Colors.greyFont
|
[ Font.color Colors.greyFont
|
||||||
]
|
]
|
||||||
[ Element.text ("Diffusé le " ++ formatDate zone video.date) ]
|
[ Element.text ("Diffusé le " ++ formatDate zone date) ]
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
Element.none
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue