Commit b50a0405 authored by Yuri Mikhin's avatar Yuri Mikhin Committed by Yuri Mikhin

Remove 'visible' property from charts.

parent 8a5c74ae
...@@ -19,7 +19,6 @@ export enum StatsIntervalId { ...@@ -19,7 +19,6 @@ export enum StatsIntervalId {
} }
export type StatsChart = { export type StatsChart = {
visible?: boolean;
id: string; id: string;
title: string; title: string;
description: string; description: string;
......
...@@ -14,7 +14,7 @@ type Props = { ...@@ -14,7 +14,7 @@ type Props = {
} }
const ChartsWidgetsList = ({ charts, interval }: Props) => { const ChartsWidgetsList = ({ charts, interval }: Props) => {
const isAnyChartDisplayed = charts.some((section) => section.charts.some(chart => chart.visible)); const isAnyChartDisplayed = charts.some((section) => section.charts.length > 0);
return ( return (
<Box> <Box>
...@@ -23,7 +23,6 @@ const ChartsWidgetsList = ({ charts, interval }: Props) => { ...@@ -23,7 +23,6 @@ const ChartsWidgetsList = ({ charts, interval }: Props) => {
{ {
charts.map((section) => ( charts.map((section) => (
<ListItem <ListItem
display={ section.charts.every((chart) => !chart.visible) ? 'none' : 'block' }
key={ section.id } key={ section.id }
mb={ 8 } mb={ 8 }
_last={{ _last={{
...@@ -46,7 +45,6 @@ const ChartsWidgetsList = ({ charts, interval }: Props) => { ...@@ -46,7 +45,6 @@ const ChartsWidgetsList = ({ charts, interval }: Props) => {
{ section.charts.map((chart) => ( { section.charts.map((chart) => (
<GridItem <GridItem
key={ chart.id } key={ chart.id }
display={ chart.visible ? 'block' : 'none' }
> >
<ChartWidget <ChartWidget
id={ chart.id } id={ chart.id }
......
...@@ -9,13 +9,11 @@ export const statsChartsScheme: Array<StatsSection> = [ ...@@ -9,13 +9,11 @@ export const statsChartsScheme: Array<StatsSection> = [
id: 'new-blocks', id: 'new-blocks',
title: 'New blocks', title: 'New blocks',
description: 'New blocks number per day', description: 'New blocks number per day',
visible: true,
}, },
{ {
id: 'average-block-size', id: 'average-block-size',
title: 'Average block size', title: 'Average block size',
description: 'Average size of blocks in bytes', description: 'Average size of blocks in bytes',
visible: true,
}, },
], ],
}, },
...@@ -27,25 +25,21 @@ export const statsChartsScheme: Array<StatsSection> = [ ...@@ -27,25 +25,21 @@ export const statsChartsScheme: Array<StatsSection> = [
id: 'average-transaction-fee', id: 'average-transaction-fee',
title: 'Average transaction fee', title: 'Average transaction fee',
description: 'The average amount in USD spent per transaction', description: 'The average amount in USD spent per transaction',
visible: true,
}, },
{ {
id: 'transactions-fees', id: 'transactions-fees',
title: 'Transactions fees', title: 'Transactions fees',
description: 'Amount of tokens paid as fees', description: 'Amount of tokens paid as fees',
visible: true,
}, },
{ {
id: 'new-transactions', id: 'new-transactions',
title: 'Transactions fees', title: 'Transactions fees',
description: 'New transactions number per period', description: 'New transactions number per period',
visible: true,
}, },
{ {
id: 'transactions-growth', id: 'transactions-growth',
title: 'Transactions growth', title: 'Transactions growth',
description: 'Cumulative transactions number per period', description: 'Cumulative transactions number per period',
visible: true,
}, },
], ],
}, },
...@@ -57,13 +51,11 @@ export const statsChartsScheme: Array<StatsSection> = [ ...@@ -57,13 +51,11 @@ export const statsChartsScheme: Array<StatsSection> = [
id: 'active-accounts', id: 'active-accounts',
title: 'Active accounts', title: 'Active accounts',
description: 'Active accounts number per period', description: 'Active accounts number per period',
visible: true,
}, },
{ {
id: 'accounts-growth', id: 'accounts-growth',
title: 'Accounts growth', title: 'Accounts growth',
description: 'Cumulative accounts number per period', description: 'Cumulative accounts number per period',
visible: true,
}, },
], ],
}, },
......
...@@ -25,16 +25,13 @@ export default function useStats() { ...@@ -25,16 +25,13 @@ export default function useStats() {
const filterCharts = useCallback((q: string, currentSection: StatsSectionIds) => { const filterCharts = useCallback((q: string, currentSection: StatsSectionIds) => {
const charts = statsChartsScheme const charts = statsChartsScheme
?.map((section: StatsSection) => { ?.map((section: StatsSection) => {
const charts = section.charts.map((chart: StatsChart) => ({ const charts = section.charts.filter((chart: StatsChart) => isSectionMatches(section, currentSection) && isChartNameMatches(q, chart));
...chart,
visible: isSectionMatches(section, currentSection) && isChartNameMatches(q, chart),
}));
return { return {
...section, ...section,
charts, charts,
}; };
}); }).filter((section: StatsSection) => section.charts.length > 0);
setDisplayedCharts(charts || []); setDisplayedCharts(charts || []);
}, []); }, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment