diff --git a/packages/app/src/library/Graphs/EraPoints.tsx b/packages/app/src/library/Graphs/EraPoints.tsx deleted file mode 100644 index 0fea39992..000000000 --- a/packages/app/src/library/Graphs/EraPoints.tsx +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors -// SPDX-License-Identifier: GPL-3.0-only - -import type { AnyJson } from '@w3ux/types' -import { - CategoryScale, - Chart as ChartJS, - Legend, - LinearScale, - LineElement, - PointElement, - Title, - Tooltip, -} from 'chart.js' -import { useNetwork } from 'contexts/Network' -import { useTheme } from 'contexts/Themes' -import { Line } from 'react-chartjs-2' -import { useTranslation } from 'react-i18next' -import graphColors from 'styles/graphs/index.json' -import type { EraPointsProps } from './types' - -ChartJS.register( - CategoryScale, - LinearScale, - PointElement, - LineElement, - Title, - Tooltip, - Legend -) - -export const EraPoints = ({ items = [], height }: EraPointsProps) => { - const { t } = useTranslation('library') - const { mode } = useTheme() - const { colors } = useNetwork().networkData - - const options = { - responsive: true, - maintainAspectRatio: false, - scales: { - x: { - border: { - display: false, - }, - grid: { - color: 'rgba(0,0,0,0)', - }, - ticks: { - display: true, - maxTicksLimit: 30, - autoSkip: true, - }, - title: { - display: true, - text: 'Era', - font: { - size: 10, - }, - }, - }, - y: { - border: { - display: false, - }, - grid: { - color: graphColors.grid[mode], - }, - min: 0, - ticks: { - display: true, - beginAtZero: false, - }, - }, - }, - plugins: { - legend: { - display: false, - }, - title: { - display: false, - text: t('eraPoints'), - }, - tooltip: { - displayColors: false, - backgroundColor: graphColors.tooltip[mode], - titleColor: graphColors.label[mode], - bodyColor: graphColors.label[mode], - bodyFont: { - weight: 600, - }, - callbacks: { - title: () => [], - label: (context: AnyJson) => `${context.parsed.y}`, - }, - intersect: false, - interaction: { - mode: 'nearest', - }, - }, - }, - } - - const data = { - labels: items.map(({ era }) => era), - datasets: [ - { - label: t('points'), - data: items.map(({ points }) => points), - borderColor: colors.primary[mode], - backgroundColor: colors.primary[mode], - pointStyle: undefined, - pointRadius: 0, - borderWidth: 2, - }, - ], - } - - return ( -
- -
- ) -}