Added link to original toot on date (#52)

This commit is contained in:
Nicolas Lœuillet 2017-04-25 15:29:33 +02:00 committed by Nicolas Perriault
parent 4385aed0a2
commit ff81482572

View File

@ -153,9 +153,10 @@ statusView ({ account, content, media_attachments, reblog, mentions } as status)
let let
accountLinkAttributes = accountLinkAttributes =
[ href account.url [ href account.url
-- When clicking on a status, we should not let the browser
-- redirect to a new page. That's why we're preventing the default -- When clicking on a status, we should not let the browser
-- behavior here -- redirect to a new page. That's why we're preventing the default
-- behavior here
, ViewHelper.onClickWithPreventAndStop (OnLoadUserAccount account.id) , ViewHelper.onClickWithPreventAndStop (OnLoadUserAccount account.id)
] ]
in in
@ -239,7 +240,7 @@ accountTimelineView account statuses label iconName =
statusActionsView : Mastodon.Status -> Html Msg statusActionsView : Mastodon.Status -> Html Msg
statusActionsView status = statusActionsView status =
let let
target = targetStatus =
Mastodon.extractReblog status Mastodon.extractReblog status
baseBtnClasses = baseBtnClasses =
@ -248,31 +249,31 @@ statusActionsView status =
( reblogClasses, reblogEvent ) = ( reblogClasses, reblogEvent ) =
case status.reblogged of case status.reblogged of
Just True -> Just True ->
( baseBtnClasses ++ " reblogged", Unreblog target.id ) ( baseBtnClasses ++ " reblogged", Unreblog targetStatus.id )
_ -> _ ->
( baseBtnClasses, Reblog target.id ) ( baseBtnClasses, Reblog targetStatus.id )
( favClasses, favEvent ) = ( favClasses, favEvent ) =
case status.favourited of case status.favourited of
Just True -> Just True ->
( baseBtnClasses ++ " favourited", RemoveFavorite target.id ) ( baseBtnClasses ++ " favourited", RemoveFavorite targetStatus.id )
_ -> _ ->
( baseBtnClasses, AddFavorite target.id ) ( baseBtnClasses, AddFavorite targetStatus.id )
tootDate = statusDate =
Date.fromString status.created_at Date.fromString status.created_at
|> Result.withDefault (Date.fromTime 0) |> Result.withDefault (Date.fromTime 0)
formatDate = formatDate =
text <| DateFormat.format DateEn.config "%m/%d/%Y %H:%M" tootDate text <| DateFormat.format DateEn.config "%m/%d/%Y %H:%M" statusDate
in in
div [ class "btn-group actions" ] div [ class "btn-group actions" ]
[ a [ a
[ class baseBtnClasses [ class baseBtnClasses
, ViewHelper.onClickWithPreventAndStop <| , ViewHelper.onClickWithPreventAndStop <|
DraftEvent (UpdateReplyTo target) DraftEvent (UpdateReplyTo targetStatus)
] ]
[ icon "share-alt" ] [ icon "share-alt" ]
, a , a
@ -285,7 +286,12 @@ statusActionsView status =
, ViewHelper.onClickWithPreventAndStop favEvent , ViewHelper.onClickWithPreventAndStop favEvent
] ]
[ icon "star", text (toString status.favourites_count) ] [ icon "star", text (toString status.favourites_count) ]
, a [ class baseBtnClasses ] [ icon "time", formatDate ] , a
[ class baseBtnClasses
, href status.url
, target "_blank"
]
[ icon "time", formatDate ]
] ]