From 4cb1f399df65025f2f1758559902d275b42a2c15 Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 21 Sep 2023 19:41:15 -0400 Subject: [PATCH 01/12] Fixing issue #121 --- src/app/components/PriceInfo.tsx | 50 +++++++++++++++----------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index b1a7b108..3b6f53e5 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -9,57 +9,55 @@ export function PriceInfo() { const low = priceInfo.low24h; const volume = priceInfo.value24h; const isNegativeOrZero = priceInfo.isNegativeOrZero; + const basePair = "XRD"; + + function formatNumber(lastPrice, basePair) { + return (lastPrice > 0 ? "+" : "") + lastPrice + " " + basePair; + } return (
- Price + Price {lastPrice} + {basePair}
- 24h Change + 24h Change - {change} + {isNegativeOrZero ? "-" + change : "+" + change} + %
- 24h High - - {high} + 24h Volume + + {volume} + {basePair}
- 24h Low - - {low} + 24h High + + {high} + {basePair}
- 24h Volume - - {volume} + 24h Low + + {low} + {basePair}
From 3d99ed93b94a8b3af43f200d5d0b208c747035ff Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 21 Sep 2023 19:53:44 -0400 Subject: [PATCH 02/12] fixed missed style --- src/app/components/PriceInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 3b6f53e5..dc0a6d60 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -25,7 +25,7 @@ export function PriceInfo() { } > {lastPrice} - {basePair} + {basePair}
From 8f0ee283062486312aba34b3abc55f90df235653 Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 21 Sep 2023 20:03:53 -0400 Subject: [PATCH 03/12] Fixed decimals --- src/app/components/PriceInfo.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index dc0a6d60..42389ae1 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -3,11 +3,11 @@ import { useAppSelector } from "../hooks"; export function PriceInfo() { const priceInfo = useAppSelector((state) => state.priceInfo); - const lastPrice = priceInfo.lastPrice; - const change = priceInfo.change24h; - const high = priceInfo.high24h; - const low = priceInfo.low24h; - const volume = priceInfo.value24h; + const lastPrice = priceInfo.lastPrice.toFixed(3); + const change = priceInfo.change24h.toFixed(2); + const high = priceInfo.high24h.toFixed(3); + const low = priceInfo.low24h.toFixed(3); + const volume = priceInfo.value24h.toFixed(3); const isNegativeOrZero = priceInfo.isNegativeOrZero; const basePair = "XRD"; From 2a227c8530e04c2111370d8e5b731c4b6090109c Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 21 Sep 2023 20:13:55 -0400 Subject: [PATCH 04/12] removing extra function --- src/app/components/PriceInfo.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 42389ae1..2c1203f9 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -10,11 +10,7 @@ export function PriceInfo() { const volume = priceInfo.value24h.toFixed(3); const isNegativeOrZero = priceInfo.isNegativeOrZero; const basePair = "XRD"; - - function formatNumber(lastPrice, basePair) { - return (lastPrice > 0 ? "+" : "") + lastPrice + " " + basePair; - } - + return (
From 378c070b1846f4d7d29aacda3fb39b52f8a39c47 Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 21 Sep 2023 20:15:47 -0400 Subject: [PATCH 05/12] fit prettier highlight --- src/app/components/PriceInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 2c1203f9..237e7d9b 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -10,7 +10,7 @@ export function PriceInfo() { const volume = priceInfo.value24h.toFixed(3); const isNegativeOrZero = priceInfo.isNegativeOrZero; const basePair = "XRD"; - + return (
From 51d61d5578939bba0c108c0e7a7776823925cd0a Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 22 Sep 2023 09:47:20 -0400 Subject: [PATCH 06/12] fixed typo --- src/app/components/PriceInfo.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 237e7d9b..1aa4218a 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -31,7 +31,7 @@ export function PriceInfo() { isNegativeOrZero ? "text-sm font-bold text-red-500" : "text-xs text-green-500" } > - {isNegativeOrZero ? "-" + change : "+" + change} + {isNegativeOrZero ? change : "+" + change} %
From f47c3115ceee63f029e4a94a738567493a223d23 Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 22 Sep 2023 15:38:01 -0400 Subject: [PATCH 07/12] fixing prettier warnings --- src/app/components/PriceInfo.tsx | 50 ++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 1aa4218a..bf5ea446 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -14,46 +14,72 @@ export function PriceInfo() { return (
- Price + + Price + {lastPrice} - {basePair} + + {" "} + {basePair} +
- 24h Change + + 24h Change + - {isNegativeOrZero ? change : "+" + change} + {isNegativeOrZero ? change : "+" + change} %
- 24h Volume + + 24h Volume + {volume} - {basePair} + + {" "} + {basePair} +
- 24h High + + 24h High + {high} - {basePair} + + {" "} + {basePair} +
- 24h Low + + 24h Low + {low} - {basePair} + + {" "} + {basePair} +
From 616176568b51311a6f9c653e5560995ed0c713bb Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 22 Sep 2023 19:20:30 -0400 Subject: [PATCH 08/12] fixed missed text size --- src/app/components/PriceInfo.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index bf5ea446..bad4c399 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -21,7 +21,7 @@ export function PriceInfo() { className={ isNegativeOrZero ? "text-sm font-bold text-red-500" - : "text-xs text-green-500" + : "text-sm text-green-500" } > {lastPrice} @@ -39,7 +39,7 @@ export function PriceInfo() { className={ isNegativeOrZero ? "text-sm font-bold text-red-500" - : "text-xs text-green-500" + : "text-sm text-green-500" } > {isNegativeOrZero ? change : "+" + change} From 56c4b0eb443372bcec96f274b68ba3e26a34173c Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 22 Sep 2023 19:22:58 -0400 Subject: [PATCH 09/12] added missing bold --- src/app/components/PriceInfo.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index bad4c399..62a0a495 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -21,7 +21,7 @@ export function PriceInfo() { className={ isNegativeOrZero ? "text-sm font-bold text-red-500" - : "text-sm text-green-500" + : "text-sm font-bold text-green-500" } > {lastPrice} @@ -39,7 +39,7 @@ export function PriceInfo() { className={ isNegativeOrZero ? "text-sm font-bold text-red-500" - : "text-sm text-green-500" + : "text-sm font-bold text-green-500" } > {isNegativeOrZero ? change : "+" + change} From 33b0550e9c76432e1986bb36903f905ede140f28 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 25 Sep 2023 19:37:19 -0400 Subject: [PATCH 10/12] switched to displayAmount, cleaned up colors --- src/app/components/PriceInfo.tsx | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 62a0a495..e9b83ff9 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -1,13 +1,14 @@ import React from "react"; import { useAppSelector } from "../hooks"; +import { displayAmount } from "../utils"; export function PriceInfo() { const priceInfo = useAppSelector((state) => state.priceInfo); - const lastPrice = priceInfo.lastPrice.toFixed(3); - const change = priceInfo.change24h.toFixed(2); - const high = priceInfo.high24h.toFixed(3); - const low = priceInfo.low24h.toFixed(3); - const volume = priceInfo.value24h.toFixed(3); + const lastPrice = displayAmount(priceInfo.lastPrice, 4, ".", ",", 3); + const change = displayAmount(priceInfo.change24h, 4, ".", ",", 3); + const high = displayAmount(priceInfo.high24h, 4, ".", ",", 3); + const low = displayAmount(priceInfo.low24h, 4, ".", ",", 3); + const volume = displayAmount(priceInfo.value24h, 4, ".", ",", 3); const isNegativeOrZero = priceInfo.isNegativeOrZero; const basePair = "XRD"; @@ -17,13 +18,7 @@ export function PriceInfo() { Price - + {lastPrice} {" "} @@ -38,8 +33,8 @@ export function PriceInfo() { {isNegativeOrZero ? change : "+" + change} From 570bb313d6fce61ffe573e21bf70c33e5555dffb Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 25 Sep 2023 19:47:47 -0400 Subject: [PATCH 11/12] formatting and linter fixes --- src/app/components/PriceInfo.tsx | 44 ++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index e9b83ff9..13a6fed5 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -4,11 +4,45 @@ import { displayAmount } from "../utils"; export function PriceInfo() { const priceInfo = useAppSelector((state) => state.priceInfo); - const lastPrice = displayAmount(priceInfo.lastPrice, 4, ".", ",", 3); - const change = displayAmount(priceInfo.change24h, 4, ".", ",", 3); - const high = displayAmount(priceInfo.high24h, 4, ".", ",", 3); - const low = displayAmount(priceInfo.low24h, 4, ".", ",", 3); - const volume = displayAmount(priceInfo.value24h, 4, ".", ",", 3); + const noDigits = 4; + const decimalSeparator = "."; + const thousandSeparator = ","; + const fixedDecimals = 3; + const lastPrice = displayAmount( + priceInfo.lastPrice, + noDigits, + decimalSeparator, + thousandSeparator, + fixedDecimals + ); + const change = displayAmount( + priceInfo.change24h, + noDigits, + decimalSeparator, + thousandSeparator, + fixedDecimals + ); + const high = displayAmount( + priceInfo.high24h, + noDigits, + decimalSeparator, + thousandSeparator, + fixedDecimals + ); + const low = displayAmount( + priceInfo.low24h, + noDigits, + decimalSeparator, + thousandSeparator, + fixedDecimals + ); + const volume = displayAmount( + priceInfo.value24h, + noDigits, + decimalSeparator, + thousandSeparator, + fixedDecimals + ); const isNegativeOrZero = priceInfo.isNegativeOrZero; const basePair = "XRD"; From 96ed644e8081e3e7fa2f49e184363af435e01f74 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 26 Sep 2023 08:18:09 -0400 Subject: [PATCH 12/12] fix typo --- src/app/components/PriceInfo.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/components/PriceInfo.tsx b/src/app/components/PriceInfo.tsx index 13a6fed5..2ac02cf2 100644 --- a/src/app/components/PriceInfo.tsx +++ b/src/app/components/PriceInfo.tsx @@ -67,8 +67,8 @@ export function PriceInfo() { {isNegativeOrZero ? change : "+" + change}