Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance order categorization and warning handling in OrdersTableWidget #5320

Merged
merged 40 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b37a6de
feat: only show twap market price for non final states
fairlighteth Jan 16, 2025
c5f8784
feat: address comments children
fairlighteth Jan 16, 2025
64efd78
feat: update market price logic display
fairlighteth Jan 16, 2025
f449a1d
feat: twap child order status logic optimisations
fairlighteth Jan 16, 2025
0fe6a26
feat: order display logic
fairlighteth Jan 16, 2025
e135932
feat: hide orders table widget (#5303)
fairlighteth Jan 16, 2025
971464c
Merge branch 'feat/limit-ui-upgrade-2' into feat/limit-ui-upgrade-13
fairlighteth Jan 16, 2025
5174067
feat: display logic of statusbox
fairlighteth Jan 16, 2025
fac0f1c
Merge branch 'feat/limit-ui-upgrade-13' into feat/limit-ui-upgrade-15
fairlighteth Jan 16, 2025
f75b069
feat: partially filled status box size
fairlighteth Jan 16, 2025
4a33b3b
fix: handle failure when fetching spot price
alfetopito Jan 16, 2025
711ecba
feat: merge conflict
fairlighteth Jan 17, 2025
1dd1c9f
feat: my order scroll to orders table on mobile
fairlighteth Jan 17, 2025
c13a4b5
feat: capitalize settings label
fairlighteth Jan 17, 2025
c44c7af
feat: order details style refactor
fairlighteth Jan 17, 2025
b06458b
feat: ios specific input zoom prevention
fairlighteth Jan 17, 2025
f2d99be
feat: hide search and some tabs if not connected or no orders
fairlighteth Jan 17, 2025
a9d12b9
feat: set table height
fairlighteth Jan 17, 2025
2906017
feat: show search for no results found
fairlighteth Jan 17, 2025
81e4b21
feat: dont show filled for signing orders
fairlighteth Jan 17, 2025
aa5c980
fix: props being passed in DOM
fairlighteth Jan 17, 2025
d7aa0e8
feat: disable global usd settings item
fairlighteth Jan 17, 2025
44fdb03
feat: add close icon search
fairlighteth Jan 17, 2025
70adc49
feat: lint fix
fairlighteth Jan 17, 2025
9017094
Merge branch 'feat/limit-ui-upgrade-2' of https://github.com/cowproto…
shoom3301 Jan 20, 2025
2fceb98
Merge branch 'feat/limit-ui-upgrade' of https://github.com/cowprotoco…
shoom3301 Jan 21, 2025
a3998b0
feat: set fixed width settings dropdown
fairlighteth Jan 21, 2025
0fdb076
feat: order partially filled in twap
fairlighteth Jan 21, 2025
931c757
refactor: enhance order categorization and warning handling in Orders…
fairlighteth Jan 21, 2025
3c8e853
feat: enhance OrdersTabs to conditionally display tab counts
fairlighteth Jan 21, 2025
f23ad81
Merge branch 'feat/limit-ui-upgrade-15' into feat/limit-ui-upgrade-16
fairlighteth Jan 21, 2025
789701e
fix: update hover styles in OrdersTabs to handle disabled and unfilla…
fairlighteth Jan 21, 2025
47f0f03
Merge branch 'feat/limit-ui-upgrade-16' of https://github.com/cowprot…
shoom3301 Jan 22, 2025
1d09986
chore: merge TwapStatusAndToggle changes
shoom3301 Jan 22, 2025
41b9333
chore: fix merge
shoom3301 Jan 22, 2025
3810a05
Merge branch 'feat/limit-ui-upgrade' of https://github.com/cowprotoco…
shoom3301 Jan 23, 2025
fe65d0f
Merge branch 'feat/limit-ui-upgrade-16' of https://github.com/cowprot…
shoom3301 Jan 23, 2025
6188879
feat: enhance warning handling for TWAP child orders in OrdersTable
fairlighteth Jan 23, 2025
fdf457b
fix: show unfillable orders in both OPEN and UNFILLABLE tabs
fairlighteth Jan 23, 2025
f6a3269
Merge branch 'feat/limit-ui-upgrade' into feat/limit-ui-upgrade-17
fairlighteth Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DropdownButton = styled.button`
border: 1px solid var(${UI.COLOR_BORDER});
border-radius: 12px;
padding: 10px 34px 10px 12px;
min-width: 140px;
width: 180px;
cursor: pointer;
font-size: 14px;
display: flex;
Expand Down Expand Up @@ -64,7 +64,7 @@ const DropdownList = styled.div<{ isOpen: boolean }>`
border: 1px solid var(${UI.COLOR_BORDER});
border-radius: 12px;
padding: 6px;
min-width: 140px;
width: 180px;
z-index: 100;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,69 +42,72 @@ export function useOrdersTableList(
}, [allOrders])

// Then, categorize orders into their respective lists
return useMemo(() => {
const { pending, history, unfillable, signing, all } = allSortedOrders.reduce<OrdersTableList>(
(acc, item) => {
const order = isParsedOrder(item) ? item : item.parent
return useMemo(
() =>
allSortedOrders.slice(0, ORDERS_LIMIT).reduce<OrdersTableList>(
(acc, item) => {
const order = isParsedOrder(item) ? item : item.parent

const advancedTabNonAdvancedOrder = orderType === TabOrderTypes.ADVANCED && getIsNotComposableCowOrder(order)
const limitTabNonLimitOrder = orderType === TabOrderTypes.LIMIT && getIsComposableCowOrder(order)

if (advancedTabNonAdvancedOrder || limitTabNonLimitOrder) {
// Skip if order type doesn't match
return acc
}

// Add to 'all' list regardless of status
acc.all.push(item)

const isPending = PENDING_STATES.includes(order.status)
const isSigning = order.status === OrderStatus.PRESIGNATURE_PENDING

// Check if order is unfillable (insufficient balance or allowance)
const params = getOrderParams(chainId, balancesAndAllowances, order)
let isUnfillable = params.hasEnoughBalance === false || params.hasEnoughAllowance === false

// For TWAP orders, also check child orders
if (!isParsedOrder(item) && item.children) {
const hasUnfillableChild = item.children.some((childOrder) => {
const childParams = getOrderParams(chainId, balancesAndAllowances, childOrder)
return (
childOrder.status !== OrderStatus.FULFILLED &&
(childOrder.status === OrderStatus.SCHEDULED || childOrder.status === OrderStatus.PENDING) &&
(childParams.hasEnoughBalance === false || childParams.hasEnoughAllowance === false)
)
})
isUnfillable = isUnfillable || hasUnfillableChild
}

// Update the unfillable flag whenever the state changes, not just when becoming unfillable
if (isPending && order.isUnfillable !== isUnfillable) {
setIsOrderUnfillable({ chainId, id: order.id, isUnfillable })
}

// Add to signing if in presignature pending state
if (isSigning) {
acc.signing.push(item)
}

// Add to unfillable only if pending, unfillable, and not in signing state
if (isPending && isUnfillable && !isSigning) {
acc.unfillable.push(item)
}

// Add to pending if in a pending state and not in signing state
if (isPending && !isSigning) {
acc.pending.push(item)
}

// Add to history if not pending and not signing
if (!isPending && !isSigning) {
acc.history.push(item)
}

const advancedTabNonAdvancedOrder = orderType === TabOrderTypes.ADVANCED && getIsNotComposableCowOrder(order)
const limitTabNonLimitOrder = orderType === TabOrderTypes.LIMIT && getIsComposableCowOrder(order)

if (advancedTabNonAdvancedOrder || limitTabNonLimitOrder) {
// Skip if order type doesn't match
return acc
}

// Add to 'all' list regardless of status
acc.all.push(item)

const isPending = PENDING_STATES.includes(order.status)
const isSigning = order.status === OrderStatus.PRESIGNATURE_PENDING

// Check if order is unfillable (insufficient balance or allowance)
const params = getOrderParams(chainId, balancesAndAllowances, order)
const isUnfillable = params.hasEnoughBalance === false || params.hasEnoughAllowance === false

// Update the unfillable flag whenever the state changes, not just when becoming unfillable
if (isPending && order.isUnfillable !== isUnfillable) {
setIsOrderUnfillable({ chainId, id: order.id, isUnfillable })
}

// Add to signing if in presignature pending state
if (isSigning) {
acc.signing.push(item)
}

// Add to unfillable only if pending, unfillable, and not in signing state
if (isPending && isUnfillable && !isSigning) {
acc.unfillable.push(item)
}

// Add to pending or history based on status
if (isPending && !isSigning) {
acc.pending.push(item)
} else if (!isPending) {
acc.history.push(item)
}

return acc
},
{
pending: [],
history: [],
unfillable: [],
signing: [],
all: [],
},
)

// Return sliced lists to respect ORDERS_LIMIT
return {
pending: pending.slice(0, ORDERS_LIMIT),
history: history.slice(0, ORDERS_LIMIT),
unfillable: unfillable.slice(0, ORDERS_LIMIT),
signing: signing.slice(0, ORDERS_LIMIT),
all: all.slice(0, ORDERS_LIMIT),
}
}, [allSortedOrders, orderType, chainId, balancesAndAllowances, setIsOrderUnfillable])
},
{ pending: [], history: [], unfillable: [], signing: [], all: [] },
),
[allSortedOrders, chainId, balancesAndAllowances, orderType, setIsOrderUnfillable],
)
}
Loading
Loading