SPARK-1368: Moving buttons again
This commit is contained in:
1 parent
bffb7686a8
commit
8ef02ea4cb
4 files changed
+36
-41
No files matched your search
@@ -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;
|
||||
|
||||
@@ -198,10 +198,10 @@ let update msg (model:Model) : Model * Cmd<Msg> =
|
||||
| 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
|
||||
|
||||
@@ -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
|
||||
]
|
||||
]
|
||||
@@ -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
|
||||
]
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user