feat: display label identifier table cell as chip with link to Record… (#3503)

* feat: display label identifier table cell as chip with link to RecordShowPage

Closes #3502

* Fix test

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Thaïs
2024-01-17 13:44:36 -03:00
committed by GitHub
parent 4b7e42c38e
commit 2d929c3b91
32 changed files with 162 additions and 459 deletions

View File

@ -1,27 +0,0 @@
import { EntityForSelect } from '@/object-record/relation-picker/types/EntityForSelect';
import { flatMapAndSortEntityForSelectArrayOfArrayByName } from '../flatMapAndSortEntityForSelectArrayByName';
describe('flatMapAndSortEntityForSelectArrayOfArrayByName', () => {
it('should return the correct value', () => {
const entityForSelectArray = [
[
{ id: 1, name: 'xRya' },
{ id: 2, name: 'BrcA' },
],
[
{ id: 3, name: 'aCxd' },
{ id: 4, name: 'kp7u' },
],
] as unknown as EntityForSelect[][];
const res =
flatMapAndSortEntityForSelectArrayOfArrayByName(entityForSelectArray);
expect(res).toHaveLength(4);
expect(res[0].id).toBe(3);
expect(res[1].id).toBe(2);
expect(res[2].id).toBe(4);
expect(res[3].id).toBe(1);
});
});

View File

@ -1,11 +0,0 @@
import { EntityForSelect } from '@/object-record/relation-picker/types/EntityForSelect';
export const flatMapAndSortEntityForSelectArrayOfArrayByName = <
T extends EntityForSelect,
>(
entityForSelectArray: T[][],
) => {
const sortByName = (a: T, b: T) => a.name.localeCompare(b.name);
return entityForSelectArray.flatMap((entity) => entity).sort(sortByName);
};