From 8ef02ea4cb95a75d0276b3513c9ae0df16d29cbf Mon Sep 17 00:00:00 2001 From: Michael Harding Date: Mon, 16 Jul 2018 15:08:57 -0400 Subject: [PATCH] SPARK-1368: Moving buttons again --- src/web/ui/sass/main.scss | 15 +++++---------- src/web/ui/src/Accounts/State.fs | 8 ++++---- src/web/ui/src/Accounts/View.fs | 27 +++++++++++++-------------- src/web/ui/src/Users/View.fs | 27 ++++++++++++++------------- 4 files changed, 36 insertions(+), 41 deletions(-) diff --git a/src/web/ui/sass/main.scss b/src/web/ui/sass/main.scss index 4744e4a59..11eea09e6 100644 --- a/src/web/ui/sass/main.scss +++ b/src/web/ui/sass/main.scss @@ -137,16 +137,11 @@ body { } .is-main-control-bar { - width:100%; - height:$tabs-height; - background:$grey-lighter; + margin:2rem 3rem 0 0; overflow: hidden; - .is-light { - background:$grey-lighter; - border-right: 1px solid $grey-light; - &:hover { - background:$grey-light; - } + text-align: center; + .button { + margin-left: 1em; } } @@ -224,7 +219,7 @@ body { .is-tab-content { $tab-content-left-margin: 3rem; padding: 0.5rem 0.2rem 1.5rem $tab-content-left-margin; - height: calc(100% - #{$tabs-height} - #{$tabs-height} - 1.6rem); + height: calc(100% - #{$tabs-height} - 1.6rem); overflow: auto; input[type=text], input[type=password] { max-width: 43rem; diff --git a/src/web/ui/src/Accounts/State.fs b/src/web/ui/src/Accounts/State.fs index 72421eab8..043c9cfcb 100644 --- a/src/web/ui/src/Accounts/State.fs +++ b/src/web/ui/src/Accounts/State.fs @@ -198,10 +198,10 @@ let update msg (model:Model) : Model * Cmd = | ProductLimits (oldLimit, newLimit) -> let emptyLimit = { product = { - exchange = bts.api.Venue.GLBX - securityType = bts.api.SecurityType.FUTURE - securitySymbol = model.AllValue - } + exchange = bts.api.Venue.GLBX + securityType = bts.api.SecurityType.FUTURE + securitySymbol = model.AllValue + } longPositionLimit = 0u shortPositionLimit = 0u netPositionLimit = 0u diff --git a/src/web/ui/src/Accounts/View.fs b/src/web/ui/src/Accounts/View.fs index a9b229bdd..7c5fa3e61 100644 --- a/src/web/ui/src/Accounts/View.fs +++ b/src/web/ui/src/Accounts/View.fs @@ -30,7 +30,7 @@ let saveButton model dispatch = let buttonText = if isNew then "Create" else "Save" let dirty = isDirty model || isNew let enabled = if dirty then Button.Enabled else Button.Disabled - let flavor = if dirty then "is-success" else "is-light" + let flavor = if dirty then "is-success" else "" Button.button buttonText flavor "" enabled (fun _ -> dispatch SaveScratch) // // General @@ -609,6 +609,16 @@ let exchangeSettings model dispatch = //Fields.map "Misc Tag Mapping" cme.miscTags [] (MiscTagMapping>>send) ] +let accountControls model (dispatch:Msg->unit) = + let revertFun = + match (selectedAccount model) with + | Some acc -> fun _ -> (dispatch <| SelectAccount acc) + | None -> ignore + + div [ClassName "is-main-control-bar"] [ + saveButton model dispatch + Button.button "Revert" "" "" (if isDirty model then Button.Enabled else Button.Disabled) revertFun + ] let tabContent model dispatch = div [Key (string model.scratch.id); ClassName "is-tab-content"] [ @@ -618,20 +628,10 @@ let tabContent model dispatch = | ConnectionsTab -> ConnectionsView model dispatch | CreditLimitsTab -> creditLimitsView model dispatch | ExchangeSettingsTab -> exchangeSettings model dispatch) + + accountControls model dispatch ] - -let accountControls model (dispatch:Msg->unit) = - let revertFun = - match (selectedAccount model) with - | Some acc -> fun _ -> (dispatch <| SelectAccount acc) - | None -> ignore - - div [ClassName "is-main-control-bar"] [ - saveButton model dispatch - Button.button "Revert" "is-light" "" (if isDirty model then Button.Enabled else Button.Disabled) revertFun - ] - let isActive account = function | Some a when a = account -> "is-active" | _ -> "" @@ -813,7 +813,6 @@ let root (model:Model) dispatch = ] ] tabContent model dispatch - accountControls model dispatch modal ] ] \ No newline at end of file diff --git a/src/web/ui/src/Users/View.fs b/src/web/ui/src/Users/View.fs index 5a86ddd9b..605cc1424 100644 --- a/src/web/ui/src/Users/View.fs +++ b/src/web/ui/src/Users/View.fs @@ -34,7 +34,7 @@ let saveButton (model:Users.Types.Model) dispatch = let buttonText = if State.isNewUser model.scratchUser then "Create" else "Save" let dirty = State.userIsdirty State.defaultScratchUser model.scratchUser (State.getCurrentUser model) let enabled = if dirty then Button.Enabled else Button.Disabled - let flavor = if dirty then "is-success" else "is-light" + let flavor = if dirty then "is-success" else "" Button.button buttonText flavor "" enabled (fun _ -> dispatch SaveUser) let generalTabView (model:Model) (dispatch:Msg->Unit) = @@ -161,16 +161,6 @@ let orderRoutingTabView (model:Model) (dispatch:Msg->Unit) = ] ] -let tabContent (model:Model) (dispatch:Msg->Unit) = - div [Key (string model.scratchUser.id); ClassName "is-tab-content"] [ - (match model.currentTab, (State.userIsSelected model.scratchUser State.defaultScratchUser) with - | _, false -> p [Style [ Color "Red" ]] [ str "Select a User" ] - | Tab.General, true -> generalTabView model dispatch - | Tab.Accounts, true -> accountsTabView model dispatch - | Tab.MDEntitlements, true -> mdEntitlementsTabView model dispatch - | Tab.OrderRouting, true -> orderRoutingTabView model dispatch) - ] - let userControls (model:Model) (dispatch:Msg->Unit) = let currentUser = State.getCurrentUser model let dirty = State.userIsdirty State.defaultScratchUser model.scratchUser (State.getCurrentUser model) @@ -178,7 +168,7 @@ let userControls (model:Model) (dispatch:Msg->Unit) = div [ ClassName "is-main-control-bar" ] [ saveButton model dispatch - Button.button "Revert" "is-light" "" (if dirty then Button.Enabled else Button.Disabled) (fun _ -> SwitchUser (currentUser) |> dispatch) + Button.button "Revert" "" "" (if dirty then Button.Enabled else Button.Disabled) (fun _ -> SwitchUser (currentUser) |> dispatch) (*p [ ClassName "control" ] [ a [ ClassName "button is-light" Title "Clone" @@ -203,6 +193,18 @@ let userControls (model:Model) (dispatch:Msg->Unit) = ] +let tabContent (model:Model) (dispatch:Msg->Unit) = + div [Key (string model.scratchUser.id); ClassName "is-tab-content"] [ + (match model.currentTab, (State.userIsSelected model.scratchUser State.defaultScratchUser) with + | _, false -> p [Style [ Color "Red" ]] [ str "Select a User" ] + | Tab.General, true -> generalTabView model dispatch + | Tab.Accounts, true -> accountsTabView model dispatch + | Tab.MDEntitlements, true -> mdEntitlementsTabView model dispatch + | Tab.OrderRouting, true -> orderRoutingTabView model dispatch) + + userControls model dispatch + ] + let usersMenu (usersList:BTSUser list) (currentUser:BTSUser) (dispatch:Msg->Unit) = let activeUsers = usersList |> List.sortBy (fun u -> u.name.ToLower()) @@ -382,7 +384,6 @@ let root (model:Model) (dispatch:Msg->Unit) = ] ] tabContent model dispatch - userControls model dispatch modal ] ]