Clean up some old TODOs
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user