Clean up some old TODOs

This commit is contained in:
Richard Feldman
2018-08-13 06:12:52 -04:00
parent 7ac13cb8f5
commit 5d27ab52a7
8 changed files with 76 additions and 168 deletions

View File

@@ -28,21 +28,6 @@ decoder =
-- TRANSFORM
src : Avatar -> Attribute msg
src (Avatar maybeUrl) =
Html.Attributes.src (resolveAvatarUrl maybeUrl)
resolveAvatarUrl : Maybe String -> String
resolveAvatarUrl maybeUrl =
{- 👉 TODO #1 of 2: return the user's avatar from maybeUrl, if maybeUrl actually
contains one. If maybeUrl is Nothing, return this URL instead:
https://static.productionready.io/images/smiley-cyrus.jpg
-}
""
encode : Avatar -> Value
encode (Avatar maybeUrl) =
case maybeUrl of
@@ -53,6 +38,19 @@ encode (Avatar maybeUrl) =
Encode.null
src : Avatar -> Attribute msg
src (Avatar maybeUrl) =
case maybeUrl of
Nothing ->
Asset.src Asset.defaultAvatar
Just "" ->
Asset.src Asset.defaultAvatar
Just url ->
Html.Attributes.src url
toMaybeString : Avatar -> Maybe String
toMaybeString (Avatar maybeUrl) =
maybeUrl