mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-18 17:12:53 +03:00
Changes to commands in search window (#996)
- changes to commands in search window
This commit is contained in:
parent
eafa30a9cf
commit
20a1946b35
@ -77,6 +77,33 @@ export function CommandMenu() {
|
|||||||
});
|
});
|
||||||
const activities = activityData?.searchResults ?? [];
|
const activities = activityData?.searchResults ?? [];
|
||||||
|
|
||||||
|
const commands = [
|
||||||
|
{
|
||||||
|
to: '/people',
|
||||||
|
label: 'Go to People',
|
||||||
|
shortcuts: ['G', 'P'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: '/companies',
|
||||||
|
label: 'Go to Companies',
|
||||||
|
shortcuts: ['G', 'C'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: '/opportunities',
|
||||||
|
label: 'Go to Opportunities',
|
||||||
|
shortcuts: ['G', 'O'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
to: '/settings/profile',
|
||||||
|
label: 'Go to Settings',
|
||||||
|
shortcuts: ['G', 'S'],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const matchingCommand = commands.find(
|
||||||
|
(cmd) => cmd.shortcuts.join('') === search?.toUpperCase(),
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: Allow performing actions on page through CommandBar
|
TODO: Allow performing actions on page through CommandBar
|
||||||
|
|
||||||
@ -132,6 +159,16 @@ export function CommandMenu() {
|
|||||||
/>
|
/>
|
||||||
<StyledList>
|
<StyledList>
|
||||||
<StyledEmpty>No results found.</StyledEmpty>
|
<StyledEmpty>No results found.</StyledEmpty>
|
||||||
|
{matchingCommand && (
|
||||||
|
<StyledGroup heading="Navigate">
|
||||||
|
<CommandMenuItem
|
||||||
|
key={matchingCommand.shortcuts?.join('')}
|
||||||
|
to={matchingCommand.to}
|
||||||
|
label={matchingCommand.label}
|
||||||
|
shortcuts={matchingCommand.shortcuts}
|
||||||
|
/>
|
||||||
|
</StyledGroup>
|
||||||
|
)}
|
||||||
{!!people.length && (
|
{!!people.length && (
|
||||||
<StyledGroup heading="People">
|
<StyledGroup heading="People">
|
||||||
{people.map((person) => (
|
{people.map((person) => (
|
||||||
@ -182,28 +219,22 @@ export function CommandMenu() {
|
|||||||
))}
|
))}
|
||||||
</StyledGroup>
|
</StyledGroup>
|
||||||
)}
|
)}
|
||||||
<StyledGroup heading="Navigate">
|
{!matchingCommand && (
|
||||||
<CommandMenuItem
|
<StyledGroup heading="Navigate">
|
||||||
to="/people"
|
{commands
|
||||||
label="Go to People"
|
.filter((cmd) =>
|
||||||
shortcuts={['G', 'P']}
|
cmd.shortcuts?.join('').includes(search?.toUpperCase()),
|
||||||
/>
|
)
|
||||||
<CommandMenuItem
|
.map((cmd) => (
|
||||||
to="/companies"
|
<CommandMenuItem
|
||||||
label="Go to Companies"
|
key={cmd.shortcuts.join('')}
|
||||||
shortcuts={['G', 'C']}
|
to={cmd.to}
|
||||||
/>
|
label={cmd.label}
|
||||||
<CommandMenuItem
|
shortcuts={cmd.shortcuts}
|
||||||
to="/opportunities"
|
/>
|
||||||
label="Go to Opportunities"
|
))}
|
||||||
shortcuts={['G', 'O']}
|
</StyledGroup>
|
||||||
/>
|
)}
|
||||||
<CommandMenuItem
|
|
||||||
to="/settings/profile"
|
|
||||||
label="Go to Settings"
|
|
||||||
shortcuts={['G', 'S']}
|
|
||||||
/>
|
|
||||||
</StyledGroup>
|
|
||||||
</StyledList>
|
</StyledList>
|
||||||
</StyledDialog>
|
</StyledDialog>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user