323 add object name inside the search (#9962)

Closes https://github.com/twentyhq/core-team-issues/issues/323

Before:
<img width="495" alt="Capture d’écran 2025-01-31 à 18 11 56"
src="https://github.com/user-attachments/assets/dd1d3ac1-6c97-4398-b233-d323eeacdbb9"
/>

After:
<img width="500" alt="Capture d’écran 2025-01-31 à 18 09 58"
src="https://github.com/user-attachments/assets/68d23990-2d0b-437d-ad2e-a686cdb320e1"
/>
This commit is contained in:
Raphaël Bosi
2025-02-01 08:18:48 +01:00
committed by GitHub
parent 58aa86cc0c
commit d9b86475d3
7 changed files with 42 additions and 1 deletions

View File

@ -77,6 +77,7 @@ export const useSearchRecords = () => {
people?.map(({ id, name: { firstName, lastName }, avatarUrl }) => ({
id,
label: `${firstName} ${lastName}`,
description: 'Person',
to: `object/person/${id}`,
shouldCloseCommandMenuOnClick: true,
Icon: () => (
@ -96,6 +97,7 @@ export const useSearchRecords = () => {
companies?.map((company) => ({
id: company.id,
label: company.name ?? '',
description: 'Company',
to: `object/company/${company.id}`,
shouldCloseCommandMenuOnClick: true,
Icon: () => (
@ -116,6 +118,7 @@ export const useSearchRecords = () => {
opportunities?.map(({ id, name }) => ({
id,
label: name ?? '',
description: 'Opportunity',
to: `object/opportunity/${id}`,
shouldCloseCommandMenuOnClick: true,
Icon: () => (
@ -143,6 +146,7 @@ export const useSearchRecords = () => {
notes?.map((note) => ({
id: note.id,
label: note.title ?? '',
description: 'Note',
to: '',
onCommandClick: () => openNoteRightDrawer(note.id),
shouldCloseCommandMenuOnClick: true,
@ -156,6 +160,7 @@ export const useSearchRecords = () => {
tasks?.map((task) => ({
id: task.id,
label: task.title ?? '',
description: 'Task',
to: '',
onCommandClick: () => openTaskRightDrawer(task.id),
shouldCloseCommandMenuOnClick: true,
@ -182,6 +187,7 @@ export const useSearchRecords = () => {
objectRecords.map((objectRecord) => ({
id: objectRecord.record.id,
label: objectRecord.recordIdentifier.name,
description: objectRecord.objectMetadataItem.labelSingular,
to: `object/${objectRecord.objectMetadataItem.nameSingular}/${objectRecord.record.id}`,
shouldCloseCommandMenuOnClick: true,
Icon: () => (