feat: add share menu item#6357
Conversation
…nguage update mutation - Replaced `useJourneyUpdateMutation` with `useTitleDescLanguageUpdateMutation` in JourneyDetailsDialog component. - Updated test cases to reflect the change in mutation and ensure correct handling of journey title and description updates. - Adjusted optimistic response structure to align with new mutation requirements.
…add setOpenDetailsDialog prop - Changed the menu item label from 'Edit' to 'Edit Details' in the DefaultMenu component. - Added setOpenDetailsDialog prop to relevant components in the DefaultMenu. - Updated tests to reflect the new menu item label and ensure proper functionality.
- Changed the test name from 'Edit existing journey' to 'Edit existing journey from custom journey page' to improve clarity and context in the e2e testing suite.
- Updated GetJourney, JourneyFields, GetAdminJourney, GetAdminJourneys, and related files to include customDomains field in journey and team interfaces. - Enhanced ShareItem and SlugDialog components to utilize journeySlug and customDomains for improved functionality. - Adjusted related queries to fetch customDomains data for better integration across the application.
## Walkthrough
This update refactors sharing-related components to decouple them from context, passing journey and team data explicitly via props. It introduces a lazy GraphQL query hook for fetching journey data for sharing, updates menu structures to add a "Share" option, and revises tests to align with the new prop-driven architecture and improved accessibility queries.
## Changes
| File(s) | Change Summary |
|---------|----------------|
| `apps/journeys-admin/src/components/Editor/Toolbar/Items/ShareItem/ShareItem.tsx`, `.../EmbedJourneyDialog/EmbedJourneyDialog.tsx`, `.../EmbedJourneyDialog/EmbedCardPreview/EmbedCardPreview.tsx`, `.../QrCodeDialog/QrCodeDialog.tsx`, `.../SlugDialog/SlugDialog.tsx` | Refactored components to accept `journey` (and where needed, `teamId`) as props instead of using context; updated internal logic to use these props and modified prop interfaces accordingly. |
| `apps/journeys-admin/src/components/Editor/Toolbar/Items/Items.tsx`, `.../Menu/Menu.tsx` | Updated to pass the current journey as a prop to `ShareItem` and renamed the menu close handler prop. |
| `apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.tsx`, `.../JourneyCardMenu.tsx` | Modified to support and pass journey data for sharing; added a "Share" menu item; updated prop interfaces and menu structure. |
| `apps/journeys-admin/src/libs/useJourneyForShareLazyQuery/useJourneyForShareLazyQuery.ts`, `.../index.ts` | Added a new lazy GraphQL query hook for fetching journey data for sharing and re-exported it. |
| `apps/journeys-admin/src/components/Editor/Toolbar/Items/Item/Item.tsx` | Adjusted styling: removed `gap: 2` from `MenuItem` and applied color styling to `ListItemIcon`. |
| `apps/journeys-admin/src/components/Editor/Toolbar/Items/ShareItem/ShareItem.spec.tsx`, `.../SlugDialog/SlugDialog.spec.tsx`, `.../QrCodeDialog/QrCodeDialog.spec.tsx`, `.../DefaultMenu/DefaultMenu.spec.tsx` | Updated tests to explicitly pass new props, use improved mocks, add context providers, and synchronize with asynchronous UI updates. |
| `apps/journeys-admin/src/components/JourneyList/ActiveJourneyList/ActiveJourneyList.spec.tsx`, `.../ArchivedJourneyList/ArchivedJourneyList.spec.tsx`, `.../TrashedJourneyList/TrashedJourneyList.spec.tsx`, `.../TemplateList/ActiveTemplateList/ActiveTemplateList.spec.tsx`, `.../ArchivedTemplateList/ArchivedTemplateList.spec.tsx` | Refactored tests to use `getByRole` for button selection, improving accessibility and reliability. |
| `apps/journeys-admin/src/components/TemplateList/TemplateListItem/TemplateListItem.spec.tsx` | Wrapped tests in additional context providers and added user role mocks for more accurate test environments. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant Menu
participant ShareItem
participant useJourneyForSharingLazyQuery
participant Dialogs
User->>Menu: Opens journey card menu
Menu->>ShareItem: Renders ShareItem with journey prop
ShareItem->>useJourneyForSharingLazyQuery: (If needed) Fetch journey data for sharing
ShareItem->>Dialogs: Opens share/slug/embed/QR dialogs with journey prop
Dialogs->>ShareItem: User interacts (copy, edit, etc.)Possibly related PRs
Suggested reviewers
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
|
The latest updates on your projects.
|
…dating MockedProvider usage
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/journeys-admin-e2e/src/pages/journey-page.ts (1)
1274-1274: Added timeout improves test reliabilityThe added timeout of 10 seconds provides adequate wait time for the URL field value to update, improving test stability. This is especially important since the PR refactors sharing functionality to use lazy loading with the new
useJourneyForSharingLazyQueryhook.For consistency with other timeouts in this file, consider using a named constant instead of the inline value:
- ).toHaveValue(new RegExp(expectedValue), { timeout: 10000 }) + ).toHaveValue(new RegExp(expectedValue), { timeout: tenSecondsTimeout })With a constant defined at the top of the file:
const tenSecondsTimeout = 10000
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/journeys-admin-e2e/src/pages/journey-page.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Deploy Preview and Test (journeys-admin, 6357/merge, pull_request, 22)
- GitHub Check: Analyze (javascript)
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/journeys-admin-e2e/src/e2e/discover/teams.spec.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Deploy Preview and Test (journeys-admin, 6357/merge, pull_request, 22)
- GitHub Check: Analyze (javascript)
…nd team integration to match
|
Plan Error |
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Tests