import './CustomTimePicker.styles.scss'; import { Button } from 'antd'; import cx from 'classnames'; import ROUTES from 'constants/routes'; import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal'; import { LexicalContext, Option, RelativeDurationSuggestionOptions, } from 'container/TopNav/DateTimeSelectionV2/config'; import { Dispatch, SetStateAction, useMemo } from 'react'; import { useLocation } from 'react-router-dom'; import RangePickerModal from './RangePickerModal'; interface CustomTimePickerPopoverContentProps { options: any[]; setIsOpen: Dispatch>; customDateTimeVisible: boolean; setCustomDTPickerVisible: Dispatch>; onCustomDateHandler: ( dateTimeRange: DateTimeRangeType, lexicalContext?: LexicalContext, ) => void; onSelectHandler: (label: string, value: string) => void; handleGoLive: () => void; selectedTime: string; } function CustomTimePickerPopoverContent({ options, setIsOpen, customDateTimeVisible, setCustomDTPickerVisible, onCustomDateHandler, onSelectHandler, handleGoLive, selectedTime, }: CustomTimePickerPopoverContentProps): JSX.Element { const { pathname } = useLocation(); const isLogsExplorerPage = useMemo(() => pathname === ROUTES.LOGS_EXPLORER, [ pathname, ]); function getTimeChips(options: Option[]): JSX.Element { return (
{options.map((option) => ( ))}
); } return (
{isLogsExplorerPage && ( )} {options.map((option) => ( ))}
{selectedTime === 'custom' || customDateTimeVisible ? ( ) : (
RELATIVE TIMES
{getTimeChips(RelativeDurationSuggestionOptions)}
)}
); } export default CustomTimePickerPopoverContent;