Skip to content

Commit 70cf1fe

Browse files
committed
pool+orders: display duration in the orders list
1 parent 649ebc9 commit 70cf1fe

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

app/src/__tests__/components/pool/OrderListSection.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ describe('OrderListSection', () => {
7474
it.each<[string, number[]]>([
7575
['Type', [2, 0, 6, 9, 3]],
7676
['Liquidity', [3, 9, 0, 2, 6]],
77+
['Duration', [2, 3, 9, 6, 0]],
7778
['Rate (bps)', [6, 0, 9, 2, 3]],
7879
['Status', [6, 3, 2, 9, 0]],
7980
['Created On', [2, 3, 0, 6, 9]],
@@ -111,7 +112,7 @@ describe('OrderListSection', () => {
111112
['Balances', [5, 6], 0],
112113
['APR', [6, 5], 0],
113114
['Premium', [5, 6], 0],
114-
['Duration', [6, 5], 0],
115+
['Duration', [6, 5], 1],
115116
['Status', [6, 5], 1],
116117
['Alias', [5, 6], 0],
117118
])('should sort the leases list by %s', (sortBy, sortedOrder, elIndex) => {

app/src/components/pool/orders/OrdersList.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const OrderRow: React.FC<{
6767
<TableCell right>
6868
<Unit sats={order.amount} suffix={false} />
6969
</TableCell>
70+
<TableCell className="text-center">{order.duration}</TableCell>
7071
<TableCell right>{order.basisPoints}</TableCell>
7172
<TableCell>
7273
<OrderStatus status={order.stateLabel}>{order.stateWithCount}</OrderStatus>
@@ -111,6 +112,15 @@ const OrdersList: React.FC = () => {
111112
{l('amount')}
112113
</SortableHeader>
113114
</TableHeader>
115+
<TableHeader className="text-center">
116+
<SortableHeader<Order>
117+
field="duration"
118+
sort={settingsStore.orderSort}
119+
onSort={settingsStore.setOrderSort}
120+
>
121+
{l('duration')}
122+
</SortableHeader>
123+
</TableHeader>
114124
<TableHeader right>
115125
<SortableHeader<Order>
116126
field="rateFixed"

app/src/i18n/locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
"cmps.pool.orders.OrdersList.emptyAllMsg": "Submit an order using the form on the left.",
175175
"cmps.pool.orders.OrdersList.type": "Type",
176176
"cmps.pool.orders.OrdersList.amount": "Liquidity",
177+
"cmps.pool.orders.OrdersList.duration": "Duration",
177178
"cmps.pool.orders.OrdersList.rate": "Rate (bps)",
178179
"cmps.pool.orders.OrdersList.status": "Status",
179180
"cmps.pool.orders.OrdersList.created": "Created On",

app/src/store/models/order.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ export default class Order {
152152
return +a.amount.sub(b.amount);
153153
case 'rateFixed':
154154
return a.rateFixed - b.rateFixed;
155+
case 'duration':
156+
return a.duration - b.duration;
155157
case 'stateLabel':
156158
return a.stateLabel.toLowerCase() > b.stateLabel.toLowerCase() ? 1 : -1;
157159
case 'creationTimestamp':

0 commit comments

Comments
 (0)