Skip to content

Commit d2d8213

Browse files
authored
Sort mapping accounts (#497)
1 parent e55a3bb commit d2d8213

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

governance/xc-admin/packages/xc-admin-frontend/components/MinPublishers.tsx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,30 @@ function MinPublishers() {
3636
</thead>
3737
<tbody>
3838
{rawConfig.mappingAccounts.length ? (
39-
rawConfig.mappingAccounts[0].products.map((product) =>
40-
product.priceAccounts.map((priceAccount) => {
41-
return (
42-
<tr
43-
key={product.metadata.symbol}
44-
className="border-t border-beige-300"
45-
>
46-
<td className="py-3 pl-4 pr-2 lg:pl-14">
47-
{product.metadata.symbol}
48-
</td>
49-
<td className="py-3 pl-1 lg:pl-14">
50-
<span className="mr-2">
51-
{priceAccount.minPub}
52-
</span>
53-
</td>
54-
</tr>
55-
)
56-
})
57-
)
39+
rawConfig.mappingAccounts
40+
.sort(
41+
(mapping1, mapping2) =>
42+
mapping2.products.length - mapping1.products.length
43+
)[0]
44+
.products.map((product) =>
45+
product.priceAccounts.map((priceAccount) => {
46+
return (
47+
<tr
48+
key={product.metadata.symbol}
49+
className="border-t border-beige-300"
50+
>
51+
<td className="py-3 pl-4 pr-2 lg:pl-14">
52+
{product.metadata.symbol}
53+
</td>
54+
<td className="py-3 pl-1 lg:pl-14">
55+
<span className="mr-2">
56+
{priceAccount.minPub}
57+
</span>
58+
</td>
59+
</tr>
60+
)
61+
})
62+
)
5863
) : (
5964
<tr className="border-t border-beige-300">
6065
<td className="py-3 pl-1 lg:pl-14" colSpan={2}>

0 commit comments

Comments
 (0)