Skip to content

Commit

Permalink
fix chart and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo committed Sep 26, 2024
1 parent 2a96053 commit 7f49616
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.11.24",
"@dydxprotocol/v4-abacus": "1.12.2",
"@dydxprotocol/v4-client-js": "1.6.1",
"@dydxprotocol/v4-localization": "^1.1.203",
"@dydxprotocol/v4-proto": "^6.0.1",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/components/visx/TimeSeriesChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ export const TimeSeriesChart = <Datum extends {}>({
const [zoomDomain, setZoomDomain] = useState<number | undefined>(
defaultZoomDomain
? getClampedZoomDomain(defaultZoomDomain)
: xAccessor(latestDatum) - xAccessor(earliestDatum)
: latestDatum != null && earliestDatum != null
? xAccessor(latestDatum) - xAccessor(earliestDatum)
: minZoomDomain
);

const [zoomDomainAnimateTo, setZoomDomainAnimateTo] = useState<number | undefined>();
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/vaultsHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const useLoadedVaultDetails = () => {

export const useVaultPnlHistory = () => {
const details = useLoadedVaultDetails();
return useMemo(() => details.data?.history?.toArray(), [details.data?.history]);
return useMemo(() => details.data?.history?.toArray().reverse(), [details.data?.history]);
};

const MAX_UPDATE_SPEED_MS = timeUnits.minute;
Expand Down
1 change: 0 additions & 1 deletion src/pages/vaults/VaultDepositWithdrawForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ export const VaultDepositWithdrawForm = ({
setAmountState('');
dispatch(setVaultFormConfirmationStep(false));

// TODO tell abacus and respond
onSuccess?.();
} catch (e) {
// eslint-disable-next-line no-console
Expand Down
7 changes: 4 additions & 3 deletions src/pages/vaults/VaultPnlChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ export const VaultPnlChart = ({ className }: VaultPnlChartProps) => {
);

const timeUnitsToRender = useMemo(() => {
const dataRange =
data.length > 1 ? (data[data.length - 1].date ?? 0) - (data[0].date ?? 0) : 7 * timeUnits.day;
return TIME_RANGES.filter((t) => t.time <= dataRange + timeUnits.day * 3).map((t) => ({
const dataRange = data.length > 1 ? (data[data.length - 1].date ?? 0) - (data[0].date ?? 0) : 0;
const validRanges = TIME_RANGES.filter((t) => t.time <= dataRange + timeUnits.day * 3);
return validRanges.map((t) => ({
value: t.value,
label: `${t.labelNumDays}${stringGetter({ key: STRING_KEYS.DAYS_ABBREVIATED })}`,
}));
Expand Down Expand Up @@ -166,6 +166,7 @@ export const VaultPnlChart = ({ className }: VaultPnlChartProps) => {
selectedTimeRange != null
? TIME_RANGES.find((t) => t.value === selectedTimeRange)?.time
: undefined;

return (
<div className={className}>
<div tw="row justify-between pl-1 pr-1">
Expand Down

0 comments on commit 7f49616

Please sign in to comment.