Skip to content

Commit

Permalink
optimize comparison style (#213)
Browse files Browse the repository at this point in the history
* optimize comparison style

* optimize comparison style

* optimize comparison style
  • Loading branch information
domechn committed Dec 10, 2023
1 parent 7e216f7 commit b6a4d6b
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 241 deletions.
10 changes: 7 additions & 3 deletions src/components/coin-analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { appCacheDir as getAppCacheDir } from "@tauri-apps/api/path";
import { useNavigate, useParams } from "react-router-dom";
import {
currencyWrapper,
prettyNumberKeepNDigitsAfterDecimalPoint,
prettyNumberToLocaleString,
prettyPriceNumberToLocaleString,
} from "@/utils/currency";
Expand Down Expand Up @@ -172,6 +173,11 @@ const App = ({
[currency, profit]
);

const maxPositionStr = useMemo(
() => prettyNumberKeepNDigitsAfterDecimalPoint(maxPosition, 8),
[maxPosition]
);

const profitRate = useMemo(
() =>
breakevenPrice === 0
Expand Down Expand Up @@ -434,9 +440,7 @@ const App = ({
</div>
<p className="text-xs text-muted-foreground overflow-hidden whitespace-nowrap overflow-ellipsis">
max pos:{" "}
{Number.isInteger(maxPosition)
? maxPosition
: maxPosition.toFixed(8).replace(/0+$/, "")}
{maxPositionStr}
</p>
</CardContent>
</Card>
Expand Down
Loading

0 comments on commit b6a4d6b

Please sign in to comment.