dnazarenkoo 56402b0d40
feat: add the url pagination & update options menu (#2943)
* feat: add dynamic table based on query

* fix: group by repeating

* fix: change view when groupBy exist in the list

* fix: table scroll

* feat: add the pagination and update options menu

* feat: trace explorer is updated

---------

Co-authored-by: Yevhen Shevchenko <y.shevchenko@seedium.io>
Co-authored-by: Nazarenko19 <danil.nazarenko2000@gmail.com>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
2023-06-24 00:09:59 +05:30

50 lines
1.4 KiB
TypeScript

import { SettingFilled, SettingOutlined } from '@ant-design/icons';
import { Popover, Space } from 'antd';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import AddColumnField from './AddColumnField';
import FormatField from './FormatField';
import MaxLinesField from './MaxLinesField';
import { OptionsContainer, OptionsContentWrapper } from './styles';
import { OptionsMenuConfig } from './types';
import useOptionsMenu from './useOptionsMenu';
interface OptionsMenuProps {
config: OptionsMenuConfig;
}
function OptionsMenu({ config }: OptionsMenuProps): JSX.Element {
const { t } = useTranslation(['trace']);
const isDarkMode = useIsDarkMode();
const OptionsContent = useMemo(
() => (
<OptionsContentWrapper direction="vertical">
{config?.format && <FormatField config={config.format} />}
{config?.maxLines && <MaxLinesField config={config.maxLines} />}
{config?.addColumn && <AddColumnField config={config.addColumn} />}
</OptionsContentWrapper>
),
[config],
);
const SettingIcon = isDarkMode ? SettingOutlined : SettingFilled;
return (
<OptionsContainer>
<Popover placement="bottom" trigger="click" content={OptionsContent}>
<Space align="center">
{t('options_menu.options')}
<SettingIcon />
</Space>
</Popover>
</OptionsContainer>
);
}
export default OptionsMenu;
export { useOptionsMenu };