mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-30 13:42:01 +03:00
Consistent Sorting of Workspace Buttons Across Browsers (#3222)
Fixed inconsistent workspace order in different browers (#3217)
This commit is contained in:
parent
67fca68480
commit
f4405b1b38
@ -17,16 +17,16 @@ export const ObjectMetadataNavItems = () => {
|
|||||||
.filter((item) =>
|
.filter((item) =>
|
||||||
['person', 'company', 'opportunity'].includes(item.nameSingular),
|
['person', 'company', 'opportunity'].includes(item.nameSingular),
|
||||||
)
|
)
|
||||||
.sort((objectMetadataItemA, _) => {
|
.sort((objectMetadataItemA, objectMetadataItemB) => {
|
||||||
if (objectMetadataItemA.nameSingular === 'person') {
|
const order = ['person', 'company', 'opportunity'];
|
||||||
return -1;
|
const indexA = order.indexOf(objectMetadataItemA.nameSingular);
|
||||||
|
const indexB = order.indexOf(objectMetadataItemB.nameSingular);
|
||||||
|
if (indexA === -1 || indexB === -1) {
|
||||||
|
return objectMetadataItemA.nameSingular.localeCompare(
|
||||||
|
objectMetadataItemB.nameSingular,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
return indexA - indexB;
|
||||||
if (objectMetadataItemA.nameSingular === 'opportunity') {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}),
|
}),
|
||||||
...activeObjectMetadataItems
|
...activeObjectMetadataItems
|
||||||
.filter(
|
.filter(
|
||||||
|
Loading…
Reference in New Issue
Block a user