diff --git a/public/style.css b/public/style.css index e4859cc..58c4375 100644 --- a/public/style.css +++ b/public/style.css @@ -796,4 +796,5 @@ input.form-control[type=file] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + margin-left: 3px; } diff --git a/src/Types.elm b/src/Types.elm index 95194c8..9de0946 100644 --- a/src/Types.elm +++ b/src/Types.elm @@ -83,6 +83,7 @@ type Msg | FilterNotifications NotificationFilter | FollowAccount Int | LoadAccount Int + | LogoutClient Client | TimelineLoadNext String String | MastodonEvent MastodonMsg | NoOp diff --git a/src/Update/Main.elm b/src/Update/Main.elm index 62957f4..e30fd80 100644 --- a/src/Update/Main.elm +++ b/src/Update/Main.elm @@ -58,6 +58,23 @@ update msg model = , Command.loadTimelines <| Just client ] + LogoutClient client -> + let + newClients = + List.filter (\c -> c.token /= client.token) model.clients + + newClient = + List.head newClients + in + { model + | clients = newClients + , currentView = Update.Timeline.preferred model + } + ! [ Command.saveClients newClients + , Command.loadUserAccount newClient + , Command.loadTimelines newClient + ] + MastodonEvent msg -> let ( newModel, commands ) = diff --git a/src/View/AccountSelector.elm b/src/View/AccountSelector.elm index 185f696..88e15f8 100644 --- a/src/View/AccountSelector.elm +++ b/src/View/AccountSelector.elm @@ -47,11 +47,16 @@ accountIdentityView currentUser client = |> replace "/@" "@" |> text ] + , button + [ class "btn btn-danger" + , onClick <| LogoutClient client + ] + [ text "Logout" ] , if isCurrentUser then text "" else button - [ class "btn btn-default" + [ class "btn btn-primary" , onClick <| SwitchClient client ] [ text "Use" ]