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

Chart fixes #1638

Merged
merged 1 commit into from
Feb 9, 2024
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
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
Loading