diff --git a/elm-package.json b/elm-package.json index 8ca0524..2952b79 100644 --- a/elm-package.json +++ b/elm-package.json @@ -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" } diff --git a/public/style.css b/public/style.css index 911fc59..6f87d4d 100644 --- a/public/style.css +++ b/public/style.css @@ -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; } diff --git a/src/View.elm b/src/View.elm index f778439..592cc15 100644 --- a/src/View.elm +++ b/src/View.elm @@ -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 ] ]