Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize historical data #214

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/coin-analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const App = ({
const pageSize = 20;

const [dataPage, setDataPage] = useState<number>(0);
const [maxDataPage, setMaxDataPage] = useState<number>(0);

const [actions, setActions] = useState<AssetAction[]>([]);
const [latestAsset, setLatestAsset] = useState<Asset | undefined>();
Expand Down Expand Up @@ -116,11 +115,12 @@ const App = ({
setWalletAliasMap(wam);
});

// update max page
}, [actions]);

const maxDataPage = useMemo(() => {
// - 0.000000000001 is for float number precision
const mp = Math.floor(actions.length / pageSize - 0.000000000001);
// set max data page
setMaxDataPage(mp >= 0 ? mp : 0);
return mp >= 0 ? mp : 0;
}, [actions]);

const breakevenPrice = useMemo(
Expand Down
4 changes: 2 additions & 2 deletions src/components/comparison.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ const App = ({ currency }: { currency: CurrencyRateDetail }) => {
<div className="col-start-2 col-end-4">
<Select onValueChange={onBaseSelectChange} value={baseId}>
<SelectTrigger className="w-[150px]">
<SelectValue placeholder="Select Base Date" />
<SelectValue placeholder="Base Date" />
</SelectTrigger>
<SelectContent className="overflow-y-auto max-h-[20rem]">
<SelectGroup>
Expand All @@ -377,7 +377,7 @@ const App = ({ currency }: { currency: CurrencyRateDetail }) => {
<div className="col-end-7 col-span-2">
<Select onValueChange={onHeadSelectChange} value={headId}>
<SelectTrigger className="w-[150px]">
<SelectValue placeholder="Select Head Date" />
<SelectValue placeholder="Head Date" />
</SelectTrigger>
<SelectContent className="overflow-y-auto max-h-[20rem]">
<SelectGroup>
Expand Down
Loading
Loading