2023-07-04 08:24:34 +03:00
|
|
|
import Controls, { ControlsProps } from 'container/Controls';
|
|
|
|
|
import OptionsMenu from 'container/OptionsMenu';
|
|
|
|
|
import { OptionsMenuConfig } from 'container/OptionsMenu/types';
|
|
|
|
|
import useQueryPagination from 'hooks/queryPagination/useQueryPagination';
|
2023-06-19 15:57:58 +03:00
|
|
|
import { memo } from 'react';
|
|
|
|
|
|
|
|
|
|
import { Container } from './styles';
|
|
|
|
|
|
2023-07-04 08:24:34 +03:00
|
|
|
function TraceExplorerControls({
|
|
|
|
|
isLoading,
|
|
|
|
|
totalCount,
|
|
|
|
|
perPageOptions,
|
|
|
|
|
config,
|
|
|
|
|
}: TraceExplorerControlsProps): JSX.Element | null {
|
|
|
|
|
const {
|
|
|
|
|
pagination,
|
|
|
|
|
handleCountItemsPerPageChange,
|
|
|
|
|
handleNavigateNext,
|
|
|
|
|
handleNavigatePrevious,
|
|
|
|
|
} = useQueryPagination(totalCount, perPageOptions);
|
2023-06-19 15:57:58 +03:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Container>
|
2023-07-04 08:24:34 +03:00
|
|
|
{config && <OptionsMenu config={{ addColumn: config?.addColumn }} />}
|
|
|
|
|
|
2023-06-19 15:57:58 +03:00
|
|
|
<Controls
|
2023-07-04 08:24:34 +03:00
|
|
|
isLoading={isLoading}
|
|
|
|
|
totalCount={totalCount}
|
|
|
|
|
offset={pagination.offset}
|
|
|
|
|
countPerPage={pagination.limit}
|
|
|
|
|
perPageOptions={perPageOptions}
|
2023-06-19 15:57:58 +03:00
|
|
|
handleCountItemsPerPageChange={handleCountItemsPerPageChange}
|
2023-07-04 08:24:34 +03:00
|
|
|
handleNavigateNext={handleNavigateNext}
|
|
|
|
|
handleNavigatePrevious={handleNavigatePrevious}
|
2023-06-19 15:57:58 +03:00
|
|
|
/>
|
|
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-04 08:24:34 +03:00
|
|
|
TraceExplorerControls.defaultProps = {
|
|
|
|
|
config: null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type TraceExplorerControlsProps = Pick<
|
|
|
|
|
ControlsProps,
|
|
|
|
|
'isLoading' | 'totalCount' | 'perPageOptions'
|
|
|
|
|
> & {
|
|
|
|
|
config?: OptionsMenuConfig | null;
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-19 15:57:58 +03:00
|
|
|
export default memo(TraceExplorerControls);
|