-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Revamp navigation bar #6031
feat: Revamp navigation bar #6031
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Introduced
useRecordShowPagePagination
hook for record show page pagination - Added
viewBarId
prop toRecordTable
andRecordTableWithWrappers
- Updated
RecordTableContextProps
to includeviewBarId
- Enhanced
PageHeader
with pagination buttons and updated styles - Modified
useChipFieldDisplay
to append view ID tolinkToShowPage
7 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings
const navigateToPreviousRecord = () => { | ||
const prevRecord = objectRecords[currentRecordPosition - 1]; | ||
navigate( | ||
`/object/${objectNameSingular}/${prevRecord.id}${ | ||
viewIdQueryParam ? `?view=${viewIdQueryParam}` : '' | ||
}`, | ||
); | ||
setCurrentRecordPosition(currentRecordPosition - 1); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧠 logic: Ensure currentRecordPosition - 1
is within bounds before accessing objectRecords
.
const navigateToNextRecord = () => { | ||
const nextRecord = objectRecords[currentRecordPosition + 1]; | ||
navigate( | ||
`/object/${objectNameSingular}/${nextRecord.id}${ | ||
viewIdQueryParam ? `?view=${viewIdQueryParam}` : '' | ||
}`, | ||
); | ||
setCurrentRecordPosition(currentRecordPosition + 1); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧠 logic: Ensure currentRecordPosition + 1
is within bounds before accessing objectRecords
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Enhanced pagination logic in
useRecordShowPagePagination.ts
- Added
viewBarId
property to context inRecordTableCell.perf.stories.tsx
- Replaced back button with close button in
PageHeader.tsx
- Introduced pagination and close button in
RecordShowPage.tsx
4 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Reordered imports in
useRecordShowPagePagination.ts
- Reformatted code for better readability
- Ensured correct invocation of
fetchMoreRecords
- Adjusted logic for fetching more records for clarity
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Updated mock data for
peopleMock
- Added new GraphQL query handler for
FindManyPeople
- Improved accuracy of Storybook tests for
RecordShowPage
component
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Simplified
useEffect
dependency array inuseRecordShowPagePagination.ts
- Potential impact on pagination state management and updates
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
Pass view id to showpage on Kanban |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Added
setRecordPosition
function toChipFieldDisplay.tsx
for handling record positioning - Introduced
setRecordPosition
inuseChipFieldDisplay.ts
using Recoil for state management - Added
recordPositionInternalState.ts
to define state for tracking record positions - Updated
useRecordShowPagePagination.ts
to use Recoil for record position state management - Enhanced
EntityChip.tsx
with an optionalonClick
prop for custom click handlers
5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a lot of small comments but overall it is great! Thanks!!!
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
.../twenty-front/src/modules/object-record/record-field/meta-types/hooks/useChipFieldDisplay.ts
Outdated
Show resolved
Hide resolved
.../twenty-front/src/modules/object-record/record-field/meta-types/hooks/useChipFieldDisplay.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/pages/object-record/RecordShowPage.tsx
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
...ages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowPagePagination.ts
Outdated
Show resolved
Hide resolved
Log
|
@@ -37,7 +37,7 @@ export const useFetchAllRecordIds = <T>({ | |||
const firstQueryResult = | |||
findManyRecordsDataResult?.data?.[objectMetadataItem.namePlural]; | |||
|
|||
const totalCount = firstQueryResult?.totalCount ?? 1; | |||
const totalCount = firstQueryResult?.totalCount ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...es/twenty-front/src/modules/object-record/record-field/states/recordPositionInternalState.ts
Show resolved
Hide resolved
) | ||
.getValue(); | ||
|
||
// TODO: use URL builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,30 @@ | |||
import { RecordGqlRefEdge } from '@/object-record/cache/types/RecordGqlRefEdge'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange file name?
(record) => record.id === lastShowPageRecordId, | ||
); | ||
|
||
const positionInPx = recordPosition * 32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use row height?
@@ -0,0 +1,4 @@ | |||
import { isNull, isUndefined } from '@sniptt/guards'; | |||
|
|||
export const isDefined = <T>(value: T | null | undefined): value is T => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have it in both places? maybe just in twenty-ui then?
@@ -0,0 +1,20 @@ | |||
import { overlayScrollbarsState } from '@/ui/utilities/scroll/states/overlayScrollbarsState'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks very similar to useScrollRestoration? could we merge both?
@@ -169,7 +169,9 @@ export const CalendarEventRow = ({ | |||
? `${participant.firstName} ${participant.lastName}` | |||
: participant.displayName | |||
} | |||
entityId={participant.workspaceMemberId ?? participant.personId} | |||
placeholderColorSeed={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -17,7 +17,7 @@ export const getLabelIdentifierFieldValue = ( | |||
} | |||
|
|||
if (isDefined(labelIdentifierFieldMetadataItem?.name)) { | |||
return record[labelIdentifierFieldMetadataItem.name] as string | number; | |||
return String(record[labelIdentifierFieldMetadataItem.name]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed?
avatarUrl={recordChipData.avatarUrl ?? ''} | ||
linkToEntity={recordChipData.linkToShowPage} | ||
return isLabelIdentifier ? ( | ||
<RecordIndexRecordChip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this naming RecordIndexRecordChip. should be RecordIdentifierChip?
import { isFieldNumber } from '@/object-record/record-field/types/guards/isFieldNumber'; | ||
import { isFieldText } from '@/object-record/record-field/types/guards/isFieldText'; | ||
|
||
export const isFieldChipDisplay = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename this to isFieldIdentifierDisplay
import { useApolloClient } from '@apollo/client'; | ||
import { createApolloStoreFieldName } from '~/utils/createApolloStoreFieldName'; | ||
|
||
export const useRecordIdsFromFindManyCacheRootQuery = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding the comment above, here it would be find if fieldVariables was also containing the cursor
}) => { | ||
if (!viewId) { | ||
return views.find( | ||
(view: any) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any could be typed here
`/object/${objectNameSingular}/${recordBefore.id}${ | ||
viewIdQueryParam ? `?view=${viewIdQueryParam}` : '' | ||
}`, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we use it?
} | ||
}; | ||
|
||
export const useRecordShowPagePagination = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this could be in a separate module "navigate-in-view" or something like this and could be re-used in other places later
@@ -33,7 +33,7 @@ export const RecordTableInternalEffect = ({ | |||
callback: () => { | |||
leaveTableFocus(); | |||
}, | |||
mode: ClickOutsideMode.comparePixels, | |||
mode: ClickOutsideMode.compareHTMLRef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change? don't we have an issue with portals? (filter dropdown, field input) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it in a recent PR but this introduced the bug of double click to open
closes: #4428
Testing for fetchMoreRecords is pending, along with component tests