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",
"evancz/url-parser": "2.0.1 <= v < 3.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"
}

View File

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

View File

@ -8,6 +8,9 @@ import List.Extra exposing (elemIndex, getAt)
import Mastodon
import Model exposing (Model, Draft, DraftMsg(..), Viewer, ViewerMsg(..), Msg(..))
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
@ -150,9 +153,10 @@ statusView ({ account, content, media_attachments, reblog, mentions } as status)
let
accountLinkAttributes =
[ 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
-- behavior here
-- When clicking on a status, we should not let the browser
-- redirect to a new page. That's why we're preventing the default
-- behavior here
, ViewHelper.onClickWithPreventAndStop (OnLoadUserAccount account.id)
]
in
@ -257,6 +261,13 @@ statusActionsView status =
_ ->
( 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
div [ class "btn-group actions" ]
[ a
@ -275,6 +286,7 @@ statusActionsView status =
, ViewHelper.onClickWithPreventAndStop favEvent
]
[ icon "star", text (toString status.favourites_count) ]
, a [ class baseBtnClasses ] [ icon "time", formatDate ]
]