From 82ada5ede820b44402faf166d8e015039f9706bd Mon Sep 17 00:00:00 2001 From: Nicolas Perriault Date: Sat, 22 Apr 2017 17:03:35 +0200 Subject: [PATCH] Add a button to close the account view. --- public/style.css | 3 ++- src/Model.elm | 4 ++++ src/View.elm | 12 ++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/public/style.css b/public/style.css index b59664a..0b8b29c 100644 --- a/public/style.css +++ b/public/style.css @@ -28,7 +28,8 @@ body { .panel-heading { font-weight: bold; } -.panel-heading > .glyphicon { +.panel-heading > .glyphicon, +.panel-heading > .row > .heading > .glyphicon { margin-right: 8px; } diff --git a/src/Model.elm b/src/Model.elm index 7a91cae..94b79c1 100644 --- a/src/Model.elm +++ b/src/Model.elm @@ -35,6 +35,7 @@ type Msg | UrlChange Navigation.Location | UseGlobalTimeline Bool | UserAccount (Result Mastodon.Error Mastodon.Account) + | ClearOpenedAccount | UserTimeline (Result Mastodon.Error (List Mastodon.Status)) @@ -305,6 +306,9 @@ update msg model = Err error -> { model | account = Nothing, errors = (errorText error) :: model.errors } ! [] + ClearOpenedAccount -> + { model | account = Nothing } ! [] + StatusPosted _ -> { model | draft = defaultDraft } ! [ loadTimelines model.client ] diff --git a/src/View.elm b/src/View.elm index b9ee22f..d560a0c 100644 --- a/src/View.elm +++ b/src/View.elm @@ -168,8 +168,16 @@ accountTimelineView account statuses label iconName = div [ class "col-md-3" ] [ div [ class "panel panel-default" ] [ div [ class "panel-heading" ] - [ icon iconName - , text label + [ div [ class "row" ] + [ div [ class "col-xs-9 heading" ] [ icon iconName, text label ] + , div [ class "col-xs-3 text-right" ] + [ a + [ href "" + , ViewHelper.onClickWithPreventAndStop ClearOpenedAccount + ] + [ icon "remove" ] + ] + ] ] , div [ class "account-detail", style [ ( "background-image", "url('" ++ account.header ++ "')" ) ] ] [ div [ class "opacity-layer" ]