72e89d5c6b
FIELD widgets displaying ONE_TO_MANY relations now show a "See all" action button (arrow-up-right icon) that navigates to the record index with filtered relations. ### Demo https://github.com/user-attachments/assets/fd632553-70e3-4757-8f26-80aa8d2ce0d2 ### Changes - **`WidgetAction` type**: Added `'see-all'` to `WidgetActionId` - **`useWidgetActions` hook**: Returns `'see-all'` action for ONE_TO_MANY relation fields (position 0, before edit) - **`WidgetActionFieldSeeAll` component**: Renders the navigation button with: - `IconArrowUpRight` icon - Link computed using same logic as `RecordDetailRelationSection` - Hover visibility behavior matching existing edit button - **`WidgetActionRenderer`**: Added case for `'see-all'` action - **Storybook**: Added `OneToManyRelationFieldWidgetWithSeeAllButton` story verifying button visibility and well-formed link ### Link computation Uses the same filter URL pattern as `RecordDetailRelationSection`: ```typescript const filterQueryParams = { filter: { [relationFieldMetadataItem.name]: { [ViewFilterOperand.IS]: { selectedRecordIds: [targetRecord.id], }, }, }, viewId: indexViewId, }; const filterLinkHref = getAppPath( AppPath.RecordIndexPage, { objectNamePlural: relationObjectMetadataItem.namePlural }, filterQueryParams, ); ``` The "see-all" action is shown regardless of field read-only status since it's a navigation action, not an edit action. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[RPL] Display "See all" widget action for FIELD widget displaying relations</issue_title> > <issue_description>The "See all" widget action is the button you can see in the top right corner in the following screen. We should redirect the user to the record index showing the filtered relations. > > <img width="1334" height="712" alt="Image" src="https://github.com/user-attachments/assets/c8aca25e-2136-43b3-8896-abd161a5693e" /> > > Example of interaction today in production: > > https://github.com/user-attachments/assets/3730301c-d04b-4195-b2fb-a51f8efee08a > > ## Technical details > > See `useWidgetActions` and `WidgetActionRenderer`. Use the `arrow-up-right` icon. > > See how link is computed here: https://github.com/twentyhq/twenty/blob/3cf7803ee1ae545add02f0c628a933618ce736d5/packages/twenty-front/src/modules/object-record/record-field-list/record-detail-section/relation/components/RecordDetailRelationSection.tsx#L193-L204. Reuse the same link. > > ## Acceptance criteria > > - The action should be displayed in addition to other actions that might be rendered today > - The action must only be displayed for ONE_TO_MANY relations > - Ensure you write at least one story to ensure the button is correctly displayed; the button should a well formed link</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes twentyhq/core-team-issues#2064 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Devessier <29370468+Devessier@users.noreply.github.com> Co-authored-by: Devessier <baptiste@devessier.fr>