Skip to content

Commit

Permalink
fix: chart counter enum and lower value for collateral (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjeatt committed Feb 9, 2024
1 parent f76b897 commit 4d911fe
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
7 changes: 5 additions & 2 deletions src/config/charts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const COUNT_OF_DATES_FOR_CHART = 180;
enum CountOfDatesForChart {
SIX_MONTHS = 180,
ONE_MONTH = 30
}

export { COUNT_OF_DATES_FOR_CHART };
export { CountOfDatesForChart };
4 changes: 2 additions & 2 deletions src/pages/Dashboard/IssuedChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { useQuery } from 'react-query';

import { getLastMidnightTimestamps } from '@/common/utils/utils';
import { COUNT_OF_DATES_FOR_CHART } from '@/config/charts';
import { CountOfDatesForChart } from '@/config/charts';
import { WRAPPED_TOKEN, WRAPPED_TOKEN_SYMBOL } from '@/config/relay-chains';
import ErrorFallback from '@/legacy-components/ErrorFallback';
import cumulativeVolumesFetcher, {
Expand All @@ -17,7 +17,7 @@ import { KUSAMA, POLKADOT } from '@/utils/constants/relay-chain-names';

import LineChart from '../LineChart';

const cutoffTimestamps = getLastMidnightTimestamps(COUNT_OF_DATES_FOR_CHART, true);
const cutoffTimestamps = getLastMidnightTimestamps(CountOfDatesForChart.SIX_MONTHS, true);

const IssuedChart = (): JSX.Element => {
const { t } = useTranslation();
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Dashboard/cards/ActiveVaultsCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
import { useQuery } from 'react-query';

import { formatNumber, getLastMidnightTimestamps } from '@/common/utils/utils';
import { COUNT_OF_DATES_FOR_CHART } from '@/config/charts';
import { CountOfDatesForChart } from '@/config/charts';
import ErrorFallback from '@/legacy-components/ErrorFallback';
import graphqlFetcher, { GRAPHQL_FETCHER, GraphqlReturn } from '@/services/fetchers/graphql-fetcher';
import { INTERLAY_DENIM, KINTSUGI_SUNDOWN } from '@/utils/constants/colors';
Expand All @@ -23,7 +23,7 @@ interface VaultRegistration {
registrationTimestamp: number;
}

const cutoffTimestamps = getLastMidnightTimestamps(COUNT_OF_DATES_FOR_CHART, true);
const cutoffTimestamps = getLastMidnightTimestamps(CountOfDatesForChart.SIX_MONTHS, true);

const ActiveVaultsCard = ({ hasLinks }: Props): JSX.Element => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useErrorHandler, withErrorBoundary } from 'react-error-boundary';
import { useTranslation } from 'react-i18next';

import { convertMonetaryAmountToValueInUSD, formatUSD, getLastMidnightTimestamps } from '@/common/utils/utils';
import { COUNT_OF_DATES_FOR_CHART } from '@/config/charts';
import { CountOfDatesForChart } from '@/config/charts';
import { useGetPrices } from '@/hooks/api/use-get-prices';
import useAllCumulativeVaultCollateralVolumes from '@/hooks/use-all-cumulative-vault-collateral-volumes';
import ErrorFallback from '@/legacy-components/ErrorFallback';
Expand All @@ -16,7 +16,7 @@ import DashboardCard from '../../../cards/DashboardCard';
import LineChart from '../../../LineChart';
import Stats, { StatsDd, StatsDt, StatsRouterLink } from '../../../Stats';

const cutoffTimestamps = getLastMidnightTimestamps(COUNT_OF_DATES_FOR_CHART, true);
const cutoffTimestamps = getLastMidnightTimestamps(CountOfDatesForChart.ONE_MONTH, true);

const LockedCollateralsCard = (): JSX.Element => {
const { t } = useTranslation();
Expand All @@ -31,7 +31,7 @@ const LockedCollateralsCard = (): JSX.Element => {
const cumulativeUSDVolumes = React.useMemo(() => {
if (allCumulativeVaultCollateralVolumes === undefined) return;

return Array<number>(COUNT_OF_DATES_FOR_CHART)
return Array<number>(CountOfDatesForChart.ONE_MONTH)
.fill(0)
.map((_, index) => {
const collateralTickers = Object.keys(allCumulativeVaultCollateralVolumes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { useQuery } from 'react-query';

import { getLastMidnightTimestamps } from '@/common/utils/utils';
import { COUNT_OF_DATES_FOR_CHART } from '@/config/charts';
import { CountOfDatesForChart } from '@/config/charts';
import { WRAPPED_TOKEN } from '@/config/relay-chains';
import ErrorFallback from '@/legacy-components/ErrorFallback';
import cumulativeVolumesFetcher, {
Expand All @@ -17,7 +17,7 @@ import { KUSAMA, POLKADOT } from '@/utils/constants/relay-chain-names';

import LineChart from '../../../../LineChart';

const cutoffTimestamps = getLastMidnightTimestamps(COUNT_OF_DATES_FOR_CHART, true);
const cutoffTimestamps = getLastMidnightTimestamps(CountOfDatesForChart.SIX_MONTHS, true);

const RedeemedChart = (): JSX.Element => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
displayMonetaryAmountInUSDFormat,
getLastMidnightTimestamps
} from '@/common/utils/utils';
import { COUNT_OF_DATES_FOR_CHART } from '@/config/charts';
import { CountOfDatesForChart } from '@/config/charts';
import useCumulativeCollateralVolumes from '@/hooks/use-cumulative-collateral-volumes';
import ErrorFallback from '@/legacy-components/ErrorFallback';
import DashboardCard from '@/pages/Dashboard/cards/DashboardCard';
Expand All @@ -16,7 +16,7 @@ import Stats, { StatsDd, StatsDt } from '@/pages/Dashboard/Stats';
import { INTERLAY_DENIM, KINTSUGI_SUPERNOVA } from '@/utils/constants/colors';
import { KUSAMA, POLKADOT } from '@/utils/constants/relay-chain-names';

const cutoffTimestamps = getLastMidnightTimestamps(COUNT_OF_DATES_FOR_CHART, true);
const cutoffTimestamps = getLastMidnightTimestamps(CountOfDatesForChart.SIX_MONTHS, true);

interface Props {
collateralToken: CollateralCurrencyExt;
Expand Down

0 comments on commit 4d911fe

Please sign in to comment.