import {useCallback} from 'react'; import styled from '@emotion/styled'; import {SegmentedControl} from 'sentry/components/segmentedControl'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import useRouter from 'sentry/utils/useRouter'; import {TimeWindow} from 'sentry/views/monitors/components/overviewTimeline/types'; interface Props { className?: string; } export function ResolutionSelector({className}: Props) { const {replace, location} = useRouter(); const handleResolutionChange = useCallback( (value: TimeWindow) => { replace({...location, query: {...location.query, timeWindow: value}}); }, [location, replace] ); const timeWindow: TimeWindow = location.query?.timeWindow ?? '24h'; return ( value={timeWindow} onChange={handleResolutionChange} size="xs" aria-label={t('Time Scale')} > {t('Hour')} {t('Day')} {t('Week')} {t('Month')} ); } const ListFilters = styled('div')` display: flex; gap: ${space(1)}; `;