import ChartPage, {WithChart} from '~/components/ChartPage'; import {NextI18NextPage, useTranslation} from '~/utils/i18n'; import React, {useCallback, useMemo, useState} from 'react'; import {SortingMethod, XAxis, sortingMethod as toolTipSortingValues} from '~/resource/scalars'; import {AsideSection} from '~/components/Aside'; import Checkbox from '~/components/Checkbox'; import Content from '~/components/Content'; import Error from '~/components/Error'; import Field from '~/components/Field'; import Preloader from '~/components/Preloader'; import RunAside from '~/components/RunAside'; import ScalarChart from '~/components/ScalarsPage/ScalarChart'; import Select from '~/components/Select'; import Slider from '~/components/Slider'; import {Tag} from '~/types'; import TimeModeSelect from '~/components/TimeModeSelect'; import Title from '~/components/Title'; import {rem} from '~/utils/style'; import styled from 'styled-components'; import useTagFilter from '~/hooks/useTagFilter'; const TooltipSortingDiv = styled.div` margin-top: ${rem(20)}; display: flex; align-items: center; > :last-child { margin-left: ${rem(20)}; flex-shrink: 1; flex-grow: 1; } `; const Scalars: NextI18NextPage = () => { const {t} = useTranslation(['scalars', 'common']); const [running, setRunning] = useState(true); const {runs, tags, selectedRuns, onChangeRuns, loadingRuns, loadingTags} = useTagFilter('scalars', running); const [smoothing, setSmoothing] = useState(0.6); const [xAxis, setXAxis] = useState(XAxis.Step); const [tooltipSorting, setTooltipSorting] = useState(toolTipSortingValues[0]); const [ignoreOutliers, setIgnoreOutliers] = useState(false); const aside = useMemo( () => runs.length ? ( {t('scalars:ignore-outliers')} {t('scalars:tooltip-sorting')}