-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix post merge revamp navigation bar (#6297)
Closes #6285 @charlesBochet Also added some more utils for our component state v2.
- Loading branch information
1 parent
67e2d5c
commit 1b0759e
Showing
31 changed files
with
1,197 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/twenty-front/src/modules/object-metadata/hooks/useActiveFieldMetadataItems.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; | ||
import { useMemo } from 'react'; | ||
|
||
export const useActiveFieldMetadataItems = ({ | ||
objectMetadataItem, | ||
}: { | ||
objectMetadataItem: ObjectMetadataItem; | ||
}) => { | ||
const activeFieldMetadataItems = useMemo( | ||
() => | ||
objectMetadataItem | ||
? objectMetadataItem.fields.filter( | ||
({ isActive, isSystem }) => isActive && !isSystem, | ||
) | ||
: [], | ||
[objectMetadataItem], | ||
); | ||
|
||
return { activeFieldMetadataItems }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...wenty-front/src/modules/object-record/record-index/hooks/useHandleIndexIdentifierClick.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; | ||
import { buildShowPageURL } from '@/object-record/record-show/utils/buildShowPageURL'; | ||
import { currentViewIdComponentState } from '@/views/states/currentViewIdComponentState'; | ||
import { useNavigate } from 'react-router-dom'; | ||
import { useRecoilValue } from 'recoil'; | ||
|
||
export const useHandleIndexIdentifierClick = ({ | ||
objectMetadataItem, | ||
recordIndexId, | ||
}: { | ||
recordIndexId: string; | ||
objectMetadataItem: ObjectMetadataItem; | ||
}) => { | ||
const navigate = useNavigate(); | ||
|
||
const currentViewId = useRecoilValue( | ||
currentViewIdComponentState({ | ||
scopeId: recordIndexId, | ||
}), | ||
); | ||
|
||
const handleIndexIdentifierClick = (recordId: string) => { | ||
const showPageURL = buildShowPageURL( | ||
objectMetadataItem.nameSingular, | ||
recordId, | ||
currentViewId, | ||
); | ||
|
||
navigate(showPageURL); | ||
}; | ||
|
||
return { handleIndexIdentifierClick }; | ||
}; |
5 changes: 2 additions & 3 deletions
5
...rd-show/graphql/operations/factories/findOneRecordForShowPageOperationSignatureFactory.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; | ||
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem'; | ||
import { RecordGqlOperationSignatureFactory } from '@/object-record/graphql/types/RecordGqlOperationSignatureFactory'; | ||
import { generateDepthOneRecordGqlFields } from '@/object-record/graphql/utils/generateDepthOneRecordGqlFields'; | ||
|
||
export const findOneRecordForShowPageOperationSignatureFactory: RecordGqlOperationSignatureFactory = | ||
export const buildFindOneRecordForShowPageOperationSignature: RecordGqlOperationSignatureFactory = | ||
({ objectMetadataItem }: { objectMetadataItem: ObjectMetadataItem }) => ({ | ||
objectNameSingular: CoreObjectNameSingular.Activity, | ||
objectNameSingular: objectMetadataItem.nameSingular, | ||
variables: {}, | ||
fields: generateDepthOneRecordGqlFields({ objectMetadataItem }), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.