Browse Source

Merge #247

247: Add RollOver button to UI r=bonomat a=bonomat

Probably got lost in one of the rebases... 

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
compile-for-aarch64
bors[bot] 3 years ago
committed by GitHub
parent
commit
3216fdbda3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      daemon/src/to_sse_event.rs
  2. 1
      frontend/src/components/Types.tsx
  3. 9
      frontend/src/components/cfdtables/CfdTable.tsx

5
daemon/src/to_sse_event.rs

@ -300,13 +300,16 @@ fn available_actions(state: CfdState, role: Role) -> Vec<CfdAction> {
(CfdState::IncomingSettlementProposal { .. }, Role::Maker) => {
vec![CfdAction::AcceptSettlement, CfdAction::RejectSettlement]
}
(CfdState::IncomingRollOverProposal { .. }, Role::Maker) => {
vec![CfdAction::AcceptRollOver, CfdAction::RejectRollOver]
}
// If there is an outgoing settlement proposal already, user can't
// initiate new one
(CfdState::OutgoingSettlementProposal { .. }, Role::Maker) => {
vec![CfdAction::Commit]
}
(CfdState::Open { .. }, Role::Taker) => {
vec![CfdAction::Commit, CfdAction::Settle]
vec![CfdAction::RollOver, CfdAction::Commit, CfdAction::Settle]
}
(CfdState::Open { .. }, Role::Maker) => vec![CfdAction::Commit],
_ => vec![],

1
frontend/src/components/Types.tsx

@ -169,6 +169,7 @@ export enum Action {
REJECT_ORDER = "rejectOrder",
COMMIT = "commit",
SETTLE = "settle",
ROLL_OVER = "rollOver",
ACCEPT_SETTLEMENT = "acceptSettlement",
REJECT_SETTLEMENT = "rejectSettlement",
ACCEPT_ROLL_OVER = "acceptRollOver",

9
frontend/src/components/cfdtables/CfdTable.tsx

@ -4,6 +4,7 @@ import {
ChevronRightIcon,
ChevronUpIcon,
CloseIcon,
RepeatIcon,
TriangleDownIcon,
TriangleUpIcon,
WarningIcon,
@ -199,6 +200,12 @@ function iconForAction(action: Action): any {
return <CheckIcon />;
case Action.REJECT_SETTLEMENT:
return <CloseIcon />;
case Action.ROLL_OVER:
return <RepeatIcon />;
case Action.ACCEPT_ROLL_OVER:
return <CheckIcon />;
case Action.REJECT_ROLL_OVER:
return <CloseIcon />;
}
}
@ -212,6 +219,8 @@ function colorSchemaForAction(action: Action): string {
return "red";
case Action.SETTLE:
return "green";
case Action.ROLL_OVER:
return "green";
case Action.ACCEPT_SETTLEMENT:
return "green";
case Action.REJECT_SETTLEMENT:

Loading…
Cancel
Save