import ChartPage, {WithChart} from '~/components/ChartPage'; import {Modes, modes} from '~/resource/histogram'; import React, {FunctionComponent, useCallback, useMemo, useState} from 'react'; import {AsideSection} from '~/components/Aside'; import Content from '~/components/Content'; import Error from '~/components/Error'; import Field from '~/components/Field'; import HistogramChart from '~/components/HistogramPage/HistogramChart'; import RadioButton from '~/components/RadioButton'; import RadioGroup from '~/components/RadioGroup'; import RunAside from '~/components/RunAside'; import type {TagWithSingleRun} from '~/types'; import Title from '~/components/Title'; import useTagFilter from '~/hooks/useTagFilter'; import {useTranslation} from 'react-i18next'; const Histogram: FunctionComponent = () => { const {t} = useTranslation(['histogram', 'common']); const [running, setRunning] = useState(true); const {runs, tagsWithSingleRun, selectedRuns, onChangeRuns, loading} = useTagFilter('histogram', running); const [mode, setMode] = useState(Modes.Offset); const aside = useMemo( () => runs.length ? ( {modes.map(value => ( {t(`histogram:mode-value.${value}`)} ))} ) : null, [t, mode, onChangeRuns, running, runs, selectedRuns] ); const withChart = useCallback>( ({label, run, ...args}) => , [running, mode] ); return ( <> {t('common:histogram')} {!loading && !runs.length ? ( ) : ( )} ); }; export default Histogram;