From 60f2d1774a58d1ca401fe56986c4f76832214341 Mon Sep 17 00:00:00 2001 From: koalasat Date: Mon, 21 Oct 2024 00:05:05 +0200 Subject: [PATCH] Add skeleton while loading limits --- frontend/src/basic/Routes.tsx | 2 +- frontend/src/components/BookTable/index.tsx | 11 ++++++++--- frontend/src/components/Charts/DepthChart/index.tsx | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frontend/src/basic/Routes.tsx b/frontend/src/basic/Routes.tsx index df673b5a..d67026bc 100644 --- a/frontend/src/basic/Routes.tsx +++ b/frontend/src/basic/Routes.tsx @@ -27,7 +27,7 @@ const Routes: React.FC = () => { return ( - {['/garage/:token?', '/', ''].map((path, index) => { + {['/garage/:token?', '/garage', '/', ''].map((path, index) => { return ( - {`${pn(Math.round(price))} ${currencyCode}/BTC`} + {limitPrice ? ( + `${pn(Math.round(price))} ${currencyCode}/BTC` + ) : ( + + )} ); }, diff --git a/frontend/src/components/Charts/DepthChart/index.tsx b/frontend/src/components/Charts/DepthChart/index.tsx index a957fbe2..d67071f2 100644 --- a/frontend/src/components/Charts/DepthChart/index.tsx +++ b/frontend/src/components/Charts/DepthChart/index.tsx @@ -68,7 +68,7 @@ const DepthChart: React.FC = ({ useEffect(() => { if (Object.values(federation.book).length > 0) { const enriched = Object.values(federation.book).map((order) => { - if (order.coordinatorShortAlias != null && order.currency) { + if (order && order.coordinatorShortAlias != null && order.currency) { const limits = federation.getCoordinator(order.coordinatorShortAlias).limits; const originalPrice = @@ -127,12 +127,12 @@ const DepthChart: React.FC = ({ ? enrichedOrders.sort( (order1, order2) => (order1?.base_price ?? 0) - (order2?.base_price ?? 0), ) - : enrichedOrders.sort((order1, order2) => order1.premium - order2.premium); + : enrichedOrders.sort((order1, order2) => order1?.premium - order2?.premium); const sortedBuyOrders: PublicOrder[] = sortedOrders - .filter((order) => order.type === 0) + .filter((order) => order?.type === 0) .reverse(); - const sortedSellOrders: PublicOrder[] = sortedOrders.filter((order) => order.type === 1); + const sortedSellOrders: PublicOrder[] = sortedOrders.filter((order) => order?.type === 1); const buySerie: Datum[] = generateSerie(sortedBuyOrders); const sellSerie: Datum[] = generateSerie(sortedSellOrders);