+ tabs: Array<{ id: string; title: string; count: number; isActive?: boolean }>
+ chainId: number
+ orders: any[]
+ selectedOrders: any[]
+ allowsOffchainSigning: boolean
+ balancesAndAllowances: any
+ orderActions: OrderActions
+ currentPageNumber: number
+ pendingOrdersPrices: any
+ getSpotPrice: any
+ ordersPermitStatus: any
}
export function OrdersTableContainer({
@@ -175,7 +194,6 @@ export function OrdersTableContainer({
isSafeViaWc,
displayOrdersOnlyForSafeApp,
selectedOrders,
- isOpenOrdersTab,
allowsOffchainSigning,
balancesAndAllowances,
orderActions,
@@ -188,6 +206,11 @@ export function OrdersTableContainer({
ordersPermitStatus,
injectedWidgetParams,
}: OrdersProps) {
+ const currentTab = useMemo(() => {
+ const activeTab = tabs.find((tab) => tab.isActive)
+ return activeTab?.id || ALL_ORDERS_TAB.id
+ }, [tabs])
+
const content = () => {
const emptyOrdersImage = injectedWidgetParams.images?.emptyOrders
@@ -227,17 +250,30 @@ export function OrdersTableContainer({
)}
- {isOpenOrdersTab ? 'No open orders' : 'No orders history'}
+
+ {currentTab === ALL_ORDERS_TAB.id
+ ? 'No orders'
+ : currentTab === UNFILLABLE_TAB.id
+ ? 'No unfillable orders'
+ : currentTab === OPEN_TAB.id
+ ? 'No open orders'
+ : 'No orders history'}
+
{displayOrdersOnlyForSafeApp && isSafeViaWc ? (
- Use the to see {isOpenOrdersTab ? 'open orders' : 'orders history'}
+ Use the to see {currentTab === HISTORY_TAB.id ? 'orders history' : 'your orders'}
) : (
<>
- You don't have any {isOpenOrdersTab ? 'open' : ''} orders at the moment.
- Time to create a new one! {/* TODO: add link for Advanced orders also */}
+
+ You don't have any{' '}
+ {currentTab === UNFILLABLE_TAB.id ? 'unfillable' : currentTab === OPEN_TAB.id ? 'open' : ''} orders at
+ the moment.
+ {' '}
+
+ Time to create a new one!{' '}
{orderType === TabOrderTypes.LIMIT ? (
Learn more
@@ -252,32 +288,36 @@ export function OrdersTableContainer({
}
return (
-
+ <>
+
+ >
)
}
return (
- <>
-
+
+
+
+ Orders
+
+ {children && {children}}
- {children || }
-
{content()}
- >
+
)
}
From d0f80ecafd6198cc0d5123773b3694e1796ab9f4 Mon Sep 17 00:00:00 2001
From: fairlighteth <31534717+fairlighteth@users.noreply.github.com>
Date: Mon, 9 Dec 2024 17:18:27 +0000
Subject: [PATCH 2/2] fix: remove debug
---
.../pure/OrdersTableContainer/OrderRow/index.tsx | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx b/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx
index d359e82a4f..5303ca82be 100644
--- a/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx
+++ b/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/OrderRow/index.tsx
@@ -204,17 +204,6 @@ export function OrderRow({
(status === OrderStatus.PENDING || status === OrderStatus.SCHEDULED)
const isOrderScheduled = order.status === OrderStatus.SCHEDULED
- console.log('Order warning debug:', {
- orderId: order.id,
- hasEnoughBalance,
- hasEnoughAllowance,
- hasValidPendingPermit,
- status,
- withAllowanceWarning,
- withWarning,
- isOrderScheduled,
- })
-
const isScheduledCreating = isOrderScheduled && Date.now() > creationTime.getTime()
const expirationTimeAgo = useTimeAgo(expirationTime, TIME_AGO_UPDATE_INTERVAL)
const creationTimeAgo = useTimeAgo(creationTime, TIME_AGO_UPDATE_INTERVAL)