Added date for each toot (#50)

This commit is contained in:
Nicolas Lœuillet 2017-04-25 12:15:45 +02:00 committed by GitHub
parent 8087317b82
commit 09b52a2c7f
3 changed files with 18 additions and 5 deletions

View File

@ -17,7 +17,8 @@
"elm-lang/navigation": "2.1.0 <= v < 3.0.0", "elm-lang/navigation": "2.1.0 <= v < 3.0.0",
"evancz/url-parser": "2.0.1 <= v < 3.0.0", "evancz/url-parser": "2.0.1 <= v < 3.0.0",
"jinjor/elm-html-parser": "1.1.4 <= v < 2.0.0", "jinjor/elm-html-parser": "1.1.4 <= v < 2.0.0",
"lukewestby/elm-http-builder": "5.1.0 <= v < 6.0.0" "lukewestby/elm-http-builder": "5.1.0 <= v < 6.0.0",
"rluiten/elm-date-extra": "8.5.0 <= v < 9.0.0"
}, },
"elm-version": "0.18.0 <= v < 0.19.0" "elm-version": "0.18.0 <= v < 0.19.0"
} }

View File

@ -100,7 +100,7 @@ body {
border: none; border: none;
background: transparent; background: transparent;
color: #aaa; color: #aaa;
padding: 0 2.4em 0 0; padding: 0 1.2em 0 0;
text-align: left; text-align: left;
} }

View File

@ -8,6 +8,9 @@ import List.Extra exposing (elemIndex, getAt)
import Mastodon import Mastodon
import Model exposing (Model, Draft, DraftMsg(..), Viewer, ViewerMsg(..), Msg(..)) import Model exposing (Model, Draft, DraftMsg(..), Viewer, ViewerMsg(..), Msg(..))
import ViewHelper import ViewHelper
import Date
import Date.Extra.Config.Config_en_au exposing (config)
import Date.Extra.Format as Format exposing (format)
visibilities : Dict.Dict String String visibilities : Dict.Dict String String
@ -150,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
@ -257,6 +261,13 @@ statusActionsView status =
_ -> _ ->
( baseBtnClasses, AddFavorite target.id ) ( baseBtnClasses, AddFavorite target.id )
tootDate =
Date.fromString status.created_at
|> Result.withDefault (Date.fromTime 0)
formatDate =
text <| format config "%m/%d/%Y %H:%M" tootDate
in in
div [ class "btn-group actions" ] div [ class "btn-group actions" ]
[ a [ a
@ -275,6 +286,7 @@ 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 ]
] ]