Skip to content

Commit 1f2d01b

Browse files
authored
Merge pull request #1570 from RoboSats/add-skeleton-while-loading-limits
Add skeleton while loading limits
2 parents 72cd7a8 + 60f2d17 commit 1f2d01b

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

frontend/src/basic/Routes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Routes: React.FC = () => {
2727

2828
return (
2929
<DomRoutes>
30-
{['/garage/:token?', '/', ''].map((path, index) => {
30+
{['/garage/:token?', '/garage', '/', ''].map((path, index) => {
3131
return (
3232
<Route
3333
path={path}

frontend/src/components/BookTable/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
IconButton,
1616
Tooltip,
1717
styled,
18+
Skeleton,
1819
} from '@mui/material';
1920
import {
2021
DataGrid,
@@ -427,8 +428,8 @@ const BookTable = ({
427428
const currencyCode = String(currencyDict[params.row.currency.toString()]);
428429
const coordinator = federation.getCoordinator(params.row.coordinatorShortAlias);
429430
const premium = parseFloat(params.row.premium);
430-
const price =
431-
(coordinator.limits[params.row.currency.toString()]?.price ?? 1) * (1 + premium / 100);
431+
const limitPrice = coordinator.limits[params.row.currency.toString()]?.price;
432+
const price = (limitPrice ?? 1) * (1 + premium / 100);
432433

433434
return (
434435
<div
@@ -437,7 +438,11 @@ const BookTable = ({
437438
onOrderClicked(params.row.id, params.row.coordinatorShortAlias);
438439
}}
439440
>
440-
{`${pn(Math.round(price))} ${currencyCode}/BTC`}
441+
{limitPrice ? (
442+
`${pn(Math.round(price))} ${currencyCode}/BTC`
443+
) : (
444+
<Skeleton variant='rectangular' width={200} height={20} style={{ marginTop: 15 }} />
445+
)}
441446
</div>
442447
);
443448
},

frontend/src/components/Charts/DepthChart/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const DepthChart: React.FC<DepthChartProps> = ({
6868
useEffect(() => {
6969
if (Object.values(federation.book).length > 0) {
7070
const enriched = Object.values(federation.book).map((order) => {
71-
if (order.coordinatorShortAlias != null && order.currency) {
71+
if (order && order.coordinatorShortAlias != null && order.currency) {
7272
const limits = federation.getCoordinator(order.coordinatorShortAlias).limits;
7373

7474
const originalPrice =
@@ -127,12 +127,12 @@ const DepthChart: React.FC<DepthChartProps> = ({
127127
? enrichedOrders.sort(
128128
(order1, order2) => (order1?.base_price ?? 0) - (order2?.base_price ?? 0),
129129
)
130-
: enrichedOrders.sort((order1, order2) => order1.premium - order2.premium);
130+
: enrichedOrders.sort((order1, order2) => order1?.premium - order2?.premium);
131131

132132
const sortedBuyOrders: PublicOrder[] = sortedOrders
133-
.filter((order) => order.type === 0)
133+
.filter((order) => order?.type === 0)
134134
.reverse();
135-
const sortedSellOrders: PublicOrder[] = sortedOrders.filter((order) => order.type === 1);
135+
const sortedSellOrders: PublicOrder[] = sortedOrders.filter((order) => order?.type === 1);
136136

137137
const buySerie: Datum[] = generateSerie(sortedBuyOrders);
138138
const sellSerie: Datum[] = generateSerie(sortedSellOrders);

0 commit comments

Comments
 (0)