59004306c9
This PR connects the chart filters settings page to the backend. Both for persisting the filters in the chart's configuration and also for querying with those filters. I made sure that the filters configuration is reset in the draft if we change the data source object.
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { useNavigateCommandMenu } from '@/command-menu/hooks/useNavigateCommandMenu';
|
|
import { type PageLayoutCommandMenuPage } from '@/command-menu/pages/page-layout/types/PageLayoutCommandMenuPage';
|
|
import { getPageLayoutIcon } from '@/command-menu/pages/page-layout/utils/getPageLayoutIcon';
|
|
import { getPageLayoutPageTitle } from '@/command-menu/pages/page-layout/utils/getPageLayoutPageTitle';
|
|
import { useRecoilCallback } from 'recoil';
|
|
import { isDefined } from 'twenty-shared/utils';
|
|
import { type IconComponent } from 'twenty-ui/display';
|
|
|
|
type NavigatePageLayoutCommandMenuProps = {
|
|
commandMenuPage: PageLayoutCommandMenuPage;
|
|
pageTitle?: string;
|
|
pageIcon?: IconComponent;
|
|
};
|
|
|
|
export const useNavigatePageLayoutCommandMenu = () => {
|
|
const { navigateCommandMenu } = useNavigateCommandMenu();
|
|
|
|
const navigatePageLayoutCommandMenu = useRecoilCallback(() => {
|
|
return ({
|
|
commandMenuPage,
|
|
pageTitle,
|
|
pageIcon,
|
|
}: NavigatePageLayoutCommandMenuProps) => {
|
|
navigateCommandMenu({
|
|
page: commandMenuPage,
|
|
pageTitle: isDefined(pageTitle)
|
|
? pageTitle
|
|
: getPageLayoutPageTitle(commandMenuPage),
|
|
pageIcon: isDefined(pageIcon)
|
|
? pageIcon
|
|
: getPageLayoutIcon(commandMenuPage),
|
|
});
|
|
};
|
|
}, [navigateCommandMenu]);
|
|
|
|
return {
|
|
navigatePageLayoutCommandMenu,
|
|
};
|
|
};
|