Skip to content

Commit

Permalink
matched status
Browse files Browse the repository at this point in the history
  • Loading branch information
sehyunc committed Feb 26, 2024
1 parent 44cd134 commit 35f0695
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions trade.renegade.fi/components/panels/orders-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ function SingleOrder({
.cancelOrder(accountId, id)
.then(() =>
toast.message(
`Started to cancel order to ${
side === "buy" ? "Buy" : "Sell"
`Started to cancel order to ${side === "buy" ? "Buy" : "Sell"
} ${amount} ${base}`,
{
description: "Check the history tab for the status of the task",
Expand Down Expand Up @@ -289,14 +288,25 @@ function OrderBookPanel() {
>
{Object.values(globalOrders).map((counterpartyOrder) => {
const title = formatTitle(orders, counterpartyOrder)
const status = formatStatus(orders, counterpartyOrder, savedOrders)
// const status = formatStatus(orders, counterpartyOrder, savedOrders)
const status =
counterpartyOrder.id in orders
? "ACTIVE"
: counterpartyOrder.state === "Cancelled" &&
!(counterpartyOrder.id in orders) &&
savedOrders.some(({ id }) => id === counterpartyOrder.id)
? "MATCHED"
: counterpartyOrder.state === "Cancelled"
? "VERIFIED"
: counterpartyOrder.state.toUpperCase()

const ago = dayjs.unix(counterpartyOrder.timestamp).fromNow()
const textColor =
status === "ACTIVE" || status === "MATCHED"
? "green"
: status === "CANCELLED"
? "red"
: "white.60"
? "red"
: "white.60"

return (
<Flex
Expand Down

0 comments on commit 35f0695

Please sign in to comment.