import { Button, Input, Segmented } from 'antd'; import { observer } from 'mobx-react-lite'; import React from 'react'; import { useStore } from 'App/mstore'; import { debounce } from 'App/utils'; import ReloadButton from 'Shared/ReloadButton'; import { useTranslation } from 'react-i18next'; const SpotsListHeader = observer( ({ onDelete, selectedCount, onClearSelection, tenantHasSpots, onRefresh, }: { onDelete: () => void; selectedCount: number; onClearSelection: () => void; onRefresh: () => void; isEmpty?: boolean; tenantHasSpots: boolean; }) => { const { t } = useTranslation(); const { spotStore } = useStore(); const debouncedFetch = React.useMemo( () => debounce(spotStore.fetchSpots, 250), [], ); const onSearch = (value: string) => { spotStore.setQuery(value); void spotStore.fetchSpots(); }; const handleInputChange = (e: React.ChangeEvent) => { spotStore.setQuery(e.target.value); debouncedFetch(); }; const onFilterChange = (key: 'all' | 'own') => { spotStore.setFilter(key); void spotStore.fetchSpots(); }; const handleSegmentChange = (value: string) => { const key = value === t('All Spots') ? 'all' : 'own'; onFilterChange(key); }; return (

{t('Spots')}

{tenantHasSpots ? (
{selectedCount > 0 && ( <> )}
) : null}
); }, ); export default SpotsListHeader;