Add search to cmd bar (#667)
* Move useFilteredSearchEntityQuery from relation picker to search module * refactor duplicated code with useFilteredSearchCompanyQuery * Implement similar pattern for people than for companies with useFilteredSearchEntityQuery * Fix warning from a previous PR * Enable search from menu * Add companies to search * Fix ESLint * Refactor * Fix according to peer review --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
|
||||
import { IconArrowUpRight } from '@/ui/icons';
|
||||
|
||||
import { isCommandMenuOpenedState } from '../states/isCommandMenuOpened';
|
||||
import { useCommandMenu } from '../hooks/useCommandMenu';
|
||||
|
||||
import {
|
||||
StyledIconAndLabelContainer,
|
||||
@ -30,15 +29,15 @@ export function CommandMenuItem({
|
||||
icon,
|
||||
shortcuts,
|
||||
}: OwnProps) {
|
||||
const setOpen = useSetRecoilState(isCommandMenuOpenedState);
|
||||
const navigate = useNavigate();
|
||||
const { closeCommandMenu } = useCommandMenu();
|
||||
|
||||
if (to) {
|
||||
if (to && !icon) {
|
||||
icon = <IconArrowUpRight />;
|
||||
}
|
||||
|
||||
const onItemClick = () => {
|
||||
setOpen(false);
|
||||
closeCommandMenu();
|
||||
|
||||
if (onClick) {
|
||||
onClick();
|
||||
|
||||
Reference in New Issue
Block a user