Skip to content

feat: ai translation#6543

Merged
mikeallisonJS merged 83 commits into
mainfrom
feature/25-04-MA-feat-ai-translation
May 28, 2025
Merged

feat: ai translation#6543
mikeallisonJS merged 83 commits into
mainfrom
feature/25-04-MA-feat-ai-translation

Conversation

@mikeallisonJS
Copy link
Copy Markdown
Collaborator

@mikeallisonJS mikeallisonJS commented May 6, 2025

Summary by CodeRabbit

  • New Features

    • Added the ability to create AI-translated copies of journeys, accessible from the journey menu and "Copy to Team" dialog.
    • Introduced a translation dialog with language selection for supported languages when duplicating or translating journeys.
    • Enhanced dialogs with improved validation and error handling for translation workflows.
  • Improvements

    • Simplified journey template dialogs and related components by removing unnecessary dialog state props.
    • Improved localization with new and updated translations for journey-related actions and statuses.
    • Updated UI components to better handle loading and error states, especially for translation and duplication actions.
  • Bug Fixes

    • Enhanced validation and user feedback in language selection and translation dialogs.
  • Tests

    • Added comprehensive tests for new translation features, dialog behaviors, and improved test reliability for existing duplication flows.
  • Documentation

    • Updated and expanded component documentation and Storybook stories for new and existing dialog components.

mikeallisonJS and others added 12 commits April 29, 2025 11:02
Co-authored-by: Tanner Fleming <tanner.fleming@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Tanner Fleming <tanner.fleming@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Updated the `wrangler.toml` to change the `ENDPOINT_ARCLIGHT_WEIGHT` to "0".
- Added new localization files for various languages including Japanese, Korean, and multiple others.
- Introduced new components in the `journeys-ui` for better internationalization support.
- Enhanced the worker scripts for improved functionality and maintenance.
@mikeallisonJS mikeallisonJS self-assigned this May 6, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2025

Walkthrough

This update introduces a comprehensive journey translation feature to the admin and UI components. It adds dialog interfaces for translating journeys, supports duplication with optional translation, and enhances related menus and dialogs. Supporting hooks, localization keys, and tests are included. Several components are refactored to streamline dialog state management and improve translation workflows.

Changes

Files / Areas Change Summary
JourneyCardMenu, DefaultMenu, TranslateJourneyDialog, CopyToTeamMenuItem, ShareItem Added journey translation dialog, menu item, and props for translation/duplication; refactored menu/dialog logic
CopyToTeamDialog, TranslationDialogWrapper, LanguageAutocomplete Refactored dialogs for translation support; added error handling and improved UI/UX for language selection
useJourneyDuplicateAndTranslate, useJourneyAiTranslateMutation, supportedLanguages Introduced hooks and constants for journey duplication and AI-based translation
TemplateView, TemplateFooter, TemplateCardPreview, TemplatePreviewTabs, TemplateViewHeader Removed explicit dialog state props; simplified component interfaces and usage
Localization files (en/*.json) Added/updated translation keys for journey translation and related UI strings
Test files (.spec.tsx) Added/updated tests for translation dialogs, duplication, and UI flows
Storybook stories (.stories.tsx) Added/updated stories for translation dialogs and wrappers

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant JourneyCardMenu
    participant DefaultMenu
    participant TranslateJourneyDialog
    participant useJourneyDuplicateAndTranslate
    participant useJourneyAiTranslateMutation

    User->>JourneyCardMenu: Opens menu
    JourneyCardMenu->>DefaultMenu: Renders menu items
    User->>DefaultMenu: Clicks "Translate"
    DefaultMenu->>JourneyCardMenu: setOpenTranslateDialog(true)
    JourneyCardMenu->>TranslateJourneyDialog: Renders dialog (open)
    User->>TranslateJourneyDialog: Selects language, clicks "Create"
    TranslateJourneyDialog->>useJourneyDuplicateAndTranslate: duplicateAndTranslate(teamId, language, true)
    useJourneyDuplicateAndTranslate->>useJourneyAiTranslateMutation: If translation requested, call mutation
    useJourneyAiTranslateMutation-->>useJourneyDuplicateAndTranslate: Returns translated journey
    useJourneyDuplicateAndTranslate-->>TranslateJourneyDialog: Success callback, close dialog
    TranslateJourneyDialog-->>User: Shows success message
Loading

Possibly related PRs

  • JesusFilm/core#6689: Introduces/uses useJourneyDuplicateAndTranslate and updates journey translation features in related components.
  • JesusFilm/core#6357: Adds "Share" menu item to DefaultMenu and refactors related menu item handling, overlapping with this PR’s changes to menu structure and props.

Suggested reviewers

  • edmonday

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: 'i18next-parser@9.3.0',
npm warn EBADENGINE required: { node: '^18.0.0 || ^20.0.0 || ^22.0.0', npm: '>=6', yarn: '>=1' },
npm warn EBADENGINE current: { node: 'v24.1.0', npm: '11.3.0' }
npm warn EBADENGINE }
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: 'next-firebase-auth-edge@1.9.1',
npm warn EBADENGINE required: {
npm warn EBADENGINE node: '>=16.0.0 <24.0.0',
npm warn EBADENGINE npm: '>=8.0.0 <12.0.0',
npm warn EBADENGINE yarn: '>=1.22.0 <2.0.0'
npm warn EBADENGINE },
npm warn EBADENGINE current: { node: 'v24.1.0', npm: '11.3.0' }
npm warn EBADENGINE }
npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-28T00_35_31_320Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5020834 and 4b2640f.

📒 Files selected for processing (1)
  • libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx

[error] 130-130: Do not add then to an object.

(lint/suspicious/noThenProperty)

⏰ Context from checks skipped due to timeout of 90000ms (21)
  • GitHub Check: Deploy Preview and Test (journeys, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (journeys-admin, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (videos-admin, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (watch, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (arclight, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (arclight, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (watch, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (videos-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (journeys-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (journeys, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: build (22)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: lint (22)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: build (22)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: lint (22)
🔇 Additional comments (6)
libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx (6)

38-48: Well-defined interfaces for type safety

The new JourneyLanguage and FormValues interfaces provide clear contracts for the component's data structures and improve type safety.


50-70: Excellent JSDoc documentation

The comprehensive JSDoc documentation clearly explains the component's purpose, parameters, and behavior, which greatly improves maintainability.


123-136: Robust form validation with conditional requirements

The Yup validation schema properly handles conditional validation where language selection is only required when translation is enabled. The static analysis warning about the then property is a false positive - this is valid Yup conditional validation syntax.

🧰 Tools
🪛 Biome (1.9.4)

[error] 130-130: Do not add then to an object.

(lint/suspicious/noThenProperty)


168-179: Improved dialog close handling

The handleDialogClose function properly prevents accidental closure during loading states and ensures form cleanup on close, enhancing user experience.


258-274: Conditional language selection with proper error display

The language autocomplete is correctly rendered only when translation is enabled, with proper error handling for form validation and good accessibility through the data-testid attribute.


241-257: Clean translation toggle implementation

The translation switch is well-implemented with proper form integration and clear labeling, providing intuitive UX for enabling/disabling the translation feature.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot temporarily deployed to Preview - watch May 6, 2025 18:34 Inactive
@github-actions github-actions Bot requested a deployment to Preview - journeys-admin May 6, 2025 18:34 Pending
@github-actions github-actions Bot temporarily deployed to Preview - journeys May 6, 2025 18:34 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - docs May 6, 2025 18:34 Inactive
@github-actions github-actions Bot requested a deployment to Preview - videos-admin May 6, 2025 18:34 Pending
@github-actions github-actions Bot temporarily deployed to Preview - arclight May 6, 2025 18:34 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - short-links May 6, 2025 18:34 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - docs May 6, 2025 18:39 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin May 6, 2025 18:39 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - short-links May 6, 2025 18:39 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch May 6, 2025 18:39 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - arclight May 6, 2025 18:39 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin May 6, 2025 18:39 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys May 6, 2025 18:39 Inactive
mikeallisonJS and others added 5 commits May 22, 2025 15:23
Co-authored-by: Tanner Fleming <tanner.fleming@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Added the Language type to the journey schema, marking it as shareable.
- Updated the journey resolver to include the language field, ensuring it resolves correctly.
- Introduced a new language module with external reference implementation.
- Adjusted imports in the schema to include the new language definitions.
- Updated the Language type in the GraphQL schema to mark the ID field as an external reference.
- Adjusted the implementation in the language module to reflect that no additional fields are needed.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (9)
apis/api-journeys-modern/src/lib/auth/ability.spec.ts (2)

19-19: Minor style note regarding leading semicolon.

The leading semicolon is used to prevent issues with automatic semicolon insertion. While functional, consider using a consistent approach across the codebase for readability.


11-12: Consider strengthening type definitions.

The tests use as any type assertions which bypass TypeScript's type checking. While common in tests, consider creating proper mock types that match the expected interface structure for better type safety and documentation.

-  const mockUser = { id: 'user1' } as any
-  const mockJourney = { id: 'journey1' } as any
+  // Create interfaces or use existing ones
+  interface User {
+    id: string;
+    // other required properties
+  }
+  
+  interface Journey {
+    id: string;
+    // other required properties
+  }
+  
+  const mockUser = { id: 'user1' } as User
+  const mockJourney = { id: 'journey1' } as Journey
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getBlockContent.spec.ts (2)

9-21: Mock helpers as jest.fn().mockResolvedValue() for clearer intent

Two helpers are asynchronous (getImageBlockContent, getVideoBlockContent) while the others are synchronous. Using jest.fn(() => Promise.resolve(...)) works, but the more idiomatic and readable form is:

jest.fn().mockResolvedValue('image-content')

(analogous mockReturnValue for the sync helpers).
This also prevents accidental wrapping of a non-Promise value if the helper later becomes async.


30-74: Reduce duplication with describe.each

The 6 test cases that check delegation all share the same arrange-act-assert structure. Parameterising them will shrink the file and make it easier to add more block types:

describe.each`
  type                | factory                                       | calledWith
  ${'ImageBlock'}     | ${() => ({ __typename: 'ImageBlock' })}       | ${{ block: expect.any(Object) }}
  ${'VideoBlock'}     | ${() => ({ __typename: 'VideoBlock' })}       | ${{ blocks: expect.any(Array), block: expect.any(Object) }}
  ...
`('delegates $type', async ({ factory, calledWith }) => {
  const result = await getBlockContent({ blocks, block: factory() })
  expect(mockedHelper).toHaveBeenCalledWith(calledWith)
  expect(result).toBe(expected)
})
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getCardBlocksContent.spec.ts (3)

7-12: Strongly type the mocked helpers

Casting with as jest.Mock later in the file leaks any-typed functions and defeats TypeScript’s safety. Provide the full generic signature when mocking:

import type { getBlockContent as realGetBlockContent } from './getBlockContent'

jest.mock('./getBlockContent', () => ({
  getBlockContent: jest.fn<ReturnType<typeof realGetBlockContent>, Parameters<typeof realGetBlockContent>>()
}))

This preserves type inference for the mockImplementation that follows.


44-50: Accidental ASI hazard – keep the semicolon with IIFE-style casts

The leading ; before (getBlockContent as jest.Mock)… prevents JavaScript’s automatic semicolon insertion from concatenating with the previous statement when the file is minified or transformed. Good catch! Add a comment explaining why it exists so future refactors don’t remove it inadvertently:

// Ensure previous statement is terminated before the cast
;(getBlockContent as jest.Mock)...

52-69: Use regex or split assertions instead of indexOf ordering

indexOf on strings can give false positives when substrings repeat. Prefer splitting the result into lines and asserting on the relative order:

const lines = result[0].split('\n')
const idxChild2 = lines.indexOf('block:child2')
const idxChild1 = lines.indexOf('block:child1')
expect(idxChild2).toBeLessThan(idxChild1)

or use a single regex:

expect(result[0]).toMatch(/block:child2[\s\S]*block:child1/)
apis/api-journeys-modern/src/schema/journeyAiTranslate/journeyAiTranslate.spec.ts (2)

40-54: Async iterator stub lacks return / throw – may leave open handles

for-await loops call return() or throw() on the iterator when they finish early or on error. Omitting these optional methods isn’t spec-breaking, but Node will emit an “iterator not closed” warning in future versions. Adding no-op implementations prevents that:

return {
  [Symbol.asyncIterator]() {
    let index = 0
    return {
      next: () => Promise.resolve(
        index < items.length
          ? { done: false, value: items[index++] }
          : { done: true,  value: undefined }
      ),
      return: () => Promise.resolve({ done: true, value: undefined }),
      throw : (e) => Promise.reject(e)
    }
  }
}

191-231: Use a fixed createdAt date for deterministic snapshots

new Date() introduces time-dependent behaviour that can break snapshot or CI comparisons when the string representation differs across environments/time-zones. Replace with new Date('2023-01-01T00:00:00Z') or a constant timestamp.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ecd47ae and 4031b61.

📒 Files selected for processing (13)
  • apis/api-journeys-modern/schema.graphql (3 hunks)
  • apis/api-journeys-modern/src/lib/auth/ability.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/lib/auth/ability.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getBlockContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getBlockContent.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getButtonBlockContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getCardBlocksContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getCoverBlockContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getImageBlockContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getRadioQuestionBlockContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getVideoBlockContent.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/journeyAiTranslate.spec.ts (1 hunks)
  • apis/api-journeys-modern/src/schema/language/language.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • apis/api-journeys-modern/src/schema/language/language.ts
  • apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getBlockContent.ts
  • apis/api-journeys-modern/src/lib/auth/ability.ts
  • apis/api-journeys-modern/schema.graphql
🧰 Additional context used
🧬 Code Graph Analysis (4)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getButtonBlockContent.spec.ts (1)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getButtonBlockContent.ts (1)
  • getButtonBlockContent (3-9)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getImageBlockContent.spec.ts (1)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getImageBlockContent.ts (1)
  • getImageBlockContent (4-31)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getRadioQuestionBlockContent.spec.ts (1)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getRadioQuestionBlockContent.ts (1)
  • getRadioQuestionBlockContent (3-23)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getVideoBlockContent.spec.ts (2)
libs/journeys/ui/src/components/Card/Card.mock.ts (1)
  • videoBlock (193-244)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getVideoBlockContent.ts (1)
  • getVideoBlockContent (4-44)
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: Deploy Preview and Test (journeys-admin, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (videos-admin, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (watch, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (short-links, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (journeys, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (watch, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (journeys, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (journeys-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (short-links, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (arclight, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (videos-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: lint (22)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: build (22)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (19)
apis/api-journeys-modern/src/lib/auth/ability.spec.ts (6)

1-8: Well-structured test setup with appropriate mocking.

The import statements and mock setup are clear and follow best practices. Mocking the journeyAcl function appropriately isolates the ability function under test.


10-16: Good test preparation with proper test isolation.

The test suite uses appropriate mock objects and implements beforeEach to clear mocks between tests, ensuring test cases don't affect each other.


18-31: Well-implemented positive test case.

This test correctly verifies that the ability function returns true when the underlying journeyAcl function returns true, and confirms the correct parameters are passed.


33-46: Well-implemented negative test case.

This test properly verifies that the ability function returns false when the underlying journeyAcl function returns false, maintaining consistency with the positive test case structure.


48-60: Good edge case handling for unknown subjects.

The test correctly verifies that the ability function returns false for unknown subject types without calling journeyAcl, demonstrating robust error handling.


62-67: Appropriate handling of undefined subject objects.

The test uses @ts-expect-error appropriately to test the edge case of undefined subject objects, ensuring the function handles this gracefully without crashing.

apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getButtonBlockContent.spec.ts (1)

1-30: Comprehensive button block content extraction tests!

This test suite thoroughly verifies the getButtonBlockContent function for all critical scenarios:

  1. Successfully formats output with block ID and label
  2. Properly handles null labels
  3. Correctly handles undefined labels

The tests ensure the function works reliably for the AI translation feature.

apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getRadioQuestionBlockContent.spec.ts (2)

5-20: Well-structured test fixtures

The test data setup is clear and reusable, with appropriate typing using Partial<Block>. The different test cases can effectively reuse these fixtures.


22-64: Complete test coverage for radio question content extraction

This test suite thoroughly covers all relevant scenarios:

  1. Includes block ID and label in output
  2. Lists all radio question block labels
  3. Properly filters out non-radio blocks
  4. Handles single radio question block case
  5. Handles empty blocks array gracefully

The tests ensure the function reliably extracts and formats radio question content for AI translation.

apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getImageBlockContent.spec.ts (3)

6-8: Proper mocking approach

Good use of Jest's mocking capabilities to isolate the component under test.


13-15: Good test hygiene

Using beforeEach to clear mocks between tests prevents test pollution and ensures test isolation.


17-60: Comprehensive image block content test suite

The test cases effectively cover:

  1. Successfully retrieving and using image descriptions
  2. Handling missing descriptions
  3. Handling missing image sources
  4. Correctly using different labels based on the block type

This thorough coverage ensures reliable image content extraction for AI translation.

apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getVideoBlockContent.spec.ts (3)

10-21: Well-structured test fixtures

Good approach to setting up reusable test data that models the relationship between video blocks and their poster blocks.


48-56: Excellent error handling test

Good test for verifying graceful error handling when getImageDescription throws an exception. This ensures the translation process won't fail if image description generation encounters issues.


27-102: Thorough video block content test coverage

This test suite comprehensively covers all scenarios:

  1. Successfully retrieving video descriptions from poster images
  2. Handling missing descriptions
  3. Handling API errors
  4. Handling missing poster blocks
  5. Handling poster blocks with no source
  6. Correctly using different labels based on block type

The tests ensure reliable and resilient video content extraction for the AI translation feature.

apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getBlockContent.spec.ts (1)

24-29: Empty blocks array may mask integration issues

const blocks: Block[] = [] keeps the tests isolated, but getBlockContent delegates to other helpers that can rely on parent/child relations contained in the blocks parameter (e.g. getVideoBlockContent may need to resolve a VideoBlockSource). Passing an empty array hides those expectations.

Provide a minimal but realistic fixture (at least the block under test) or add a separate test that asserts blocks is forwarded correctly.

apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getCardBlocksContent.spec.ts (1)

85-101: Duplicate card ids make the assertion brittle

Both cardBlock and cardNoCover reuse the id card1. In the multiple-card test you introduce card2, but the original cardBlock is present twice (in blocks2 and in the imported outer scope). This can mask bugs in deduplication logic inside getCardBlocksContent.

Assign distinct ids to each fixture to mirror production data.

apis/api-journeys-modern/src/schema/journeyAiTranslate/journeyAiTranslate.spec.ts (1)

250-263: Permission check mock ignores subject parameter

The production ability helper usually takes (action, subject, user); the call here passes undefined as subject. Stubbing ability to always return true means the test never fails, but an incomplete call signature can hide integration bugs. Mock it so the test still verifies the correct subject is provided:

expect(mockAbility).toHaveBeenCalledWith(Action.Update, expect.any(Object), mockUser)
apis/api-journeys-modern/src/schema/journeyAiTranslate/getCardBlocksContent/getCoverBlockContent.spec.ts (1)

1-119: Well-structured and comprehensive test suite.

This test suite thoroughly covers all the expected scenarios for the getCoverBlockContent function, including:

  • Image cover block handling
  • Video cover block with poster image handling
  • Error handling and fallback cases
  • Unsupported block types

The tests are well-organized with clear descriptions, proper mocking, and specific assertions. I particularly appreciate the attention to error handling in lines 64-91, covering cases where image descriptions might be missing or fail to load.

The test fixtures are reused efficiently and the mocks are properly cleared between tests, ensuring test independence.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (1)

89-89: Clean up unused mock variable.

The setOpenTeamDialogMock variable is no longer used since the component now manages dialog state internally. Consider removing it to keep the test file clean.

-const setOpenTeamDialogMock = jest.fn()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4031b61 and 1ad04b4.

📒 Files selected for processing (15)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (5 hunks)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (5 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.spec.tsx (2 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.stories.tsx (1 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.tsx (2 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplateCardPreview/TemplateCardPreview.spec.tsx (4 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplateCardPreview/TemplateCardPreview.stories.tsx (1 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplateCardPreview/TemplateCardPreview.tsx (3 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplatePreviewTabs.spec.tsx (2 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplatePreviewTabs.stories.tsx (1 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplatePreviewTabs.tsx (3 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateView.tsx (2 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.spec.tsx (4 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.stories.tsx (0 hunks)
  • libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.tsx (4 hunks)
💤 Files with no reviewable changes (1)
  • libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.stories.tsx
✅ Files skipped from review due to trivial changes (5)
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplatePreviewTabs.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplatePreviewTabs.stories.tsx
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplateCardPreview/TemplateCardPreview.stories.tsx
  • libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplateCardPreview/TemplateCardPreview.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx
🧰 Additional context used
🧬 Code Graph Analysis (4)
libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.spec.tsx (1)
libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.tsx (1)
  • TemplateFooter (12-45)
libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.stories.tsx (1)
libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.tsx (1)
  • TemplateFooter (12-45)
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (1)
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1)
  • CreateJourneyButton (30-172)
libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.tsx (1)
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx (1)
  • CreateJourneyButton (30-172)
⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: Deploy Preview and Test (docs, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (journeys-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (journeys, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (videos-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (videos-admin, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (journeys-admin, 6543/merge, pull_request, 22)
  • GitHub Check: Deploy Preview and Test (arclight, 6543/merge, pull_request, 22)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: lint (22)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: build (22)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: test (22, 3/3)
  • GitHub Check: test (22, 1/3)
  • GitHub Check: test (22, 2/3)
  • GitHub Check: build (22)
🔇 Additional comments (15)
libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.spec.tsx (1)

19-19: LGTM! Test simplification aligns with component interface changes.

The removal of unused props from the test cases correctly reflects the simplified TemplateFooter component interface. The component now only requires the signedIn prop (when needed) and manages dialog state internally.

Also applies to: 36-36

libs/journeys/ui/src/components/TemplateView/TemplateView.tsx (1)

106-106: Excellent refactoring! Removes unnecessary prop drilling.

This change eliminates the need to pass dialog state through multiple component layers. Each component now manages its own dialog state internally, which:

  • Reduces coupling between components
  • Simplifies the component interfaces
  • Makes the code more maintainable
  • Follows the principle of keeping state close to where it's used

Also applies to: 108-108, 153-153

libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.stories.tsx (1)

26-26: Story correctly updated to match simplified component interface.

The removal of props from the story aligns with the TemplateFooter component's refactored interface. The story now accurately represents how the component is used in the application.

libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx (2)

2-2: Excellent test improvements! Testing behavior instead of implementation.

The updated tests are much better because they:

  • Test actual user-visible behavior (dialog presence) rather than implementation details
  • Use screen.getByTestId('CopyToTeamDialog') to verify the dialog is rendered
  • Align with the component's new internal state management

This follows testing best practices by focusing on what users experience rather than internal function calls.

Also applies to: 142-144, 171-173


103-103: Component interface correctly simplified.

The removal of openTeamDialog and setOpenTeamDialog props from all test instances correctly reflects the component's new interface where dialog state is managed internally via useState.

Also applies to: 138-138, 164-164, 392-392

libs/journeys/ui/src/components/TemplateView/TemplateFooter/TemplateFooter.tsx (2)

8-14: LGTM! Clean interface simplification.

The removal of openTeamDialog and setOpenTeamDialog props simplifies the component interface. This aligns with the refactor where CreateJourneyButton now manages dialog state internally, improving separation of concerns.


42-42: Consistent prop passing after refactor.

The simplified prop passing to CreateJourneyButton is consistent with the component's new interface that only requires the signedIn prop.

libs/journeys/ui/src/components/TemplateView/TemplateViewHeader/TemplateViewHeader.tsx (2)

17-25: Interface simplification improves component architecture.

Good refactor removing the dialog state props from the component interface. This follows the pattern of centralizing dialog state management in CreateJourneyButton.


152-152: Correct prop derivation and consistent usage.

The signedIn prop is correctly derived from authUser?.id != null for both desktop and mobile button instances, maintaining the same authentication logic.

Also applies to: 161-161

libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplatePreviewTabs.tsx (3)

7-7: Clean import optimization.

Good cleanup removing unused Dispatch and SetStateAction imports that are no longer needed after removing dialog state props.


23-29: Simplified component interface.

The interface and props destructuring have been properly updated to reflect the removal of dialog state management, maintaining only the necessary authUser prop.


99-99: Consistent prop passing in component hierarchy.

The TemplateCardPreview component usage correctly reflects the simplified interface, passing only the required props.

libs/journeys/ui/src/components/TemplateView/TemplatePreviewTabs/TemplateCardPreview/TemplateCardPreview.tsx (3)

9-9: Proper import cleanup.

Good removal of unused React type imports that are no longer needed after the dialog state refactor.


30-33: Interface and props simplified correctly.

The component interface and props destructuring have been updated appropriately to reflect the centralized dialog state management approach.

Also applies to: 112-115


201-201: Correct authentication prop derivation.

The signedIn prop is properly derived from authUser?.id != null, maintaining the authentication logic while using the simplified component interface.

edmonday and others added 3 commits May 23, 2025 15:17
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (4)
apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/TranslateJourneyDialog/TranslateJourneyDialog.spec.tsx (1)

20-207: Test coverage expansion still needed.

The test suite covers basic functionality but is missing critical test scenarios as previously identified.

libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx (2)

96-100: Pass languageSelect only when translation is enabled.

The submitAction receives values.languageSelect even when showTranslation is false, requiring downstream consumers to defensively check the flag.


85-90: Add error handling to the language query.

The useLanguagesQuery call lacks error handling, which means users won't receive feedback if the language query fails.

apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.spec.tsx (1)

210-234: Fix type casting and avoid journey object duplication.

The journey object type casting and duplication issues identified in previous reviews still need to be addressed.

🧹 Nitpick comments (2)
libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.tsx (1)

78-102: Remove unnecessary Fragment wrapper.

The Fragment wrapper is redundant here since it only contains conditional JSX elements.

Apply this diff to simplify the JSX structure:

-        <>
           {!loading && (
-            <>
+            <React.Fragment>
               <Button
                 variant="outlined"
                 color="secondary"
                 onClick={onClose}
                 disabled={loading}
                 sx={{ mr: 3 }}
               >
                 {t('Cancel')}
               </Button>
               <LoadingButton
                 variant="contained"
                 onClick={onTranslate}
                 loading={loading}
                 sx={{
                   backgroundColor: 'secondary.dark'
                 }}
               >
                 {submitLabel ?? t('Create')}
               </LoadingButton>
-            </>
+            </React.Fragment>
           )}
-        </>
🧰 Tools
🪛 Biome (1.9.4)

[error] 78-102: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.spec.tsx (1)

26-26: Remove useless rename of import.

The import renames JourneyFields to itself, which is unnecessary.

Apply this diff to clean up the import:

-import { JourneyFields as JourneyFields } from '../../../../__generated__/JourneyFields'
+import { JourneyFields } from '../../../../__generated__/JourneyFields'
🧰 Tools
🪛 Biome (1.9.4)

[error] 26-26: Useless rename.

Safe fix: Remove the renaming.

(lint/complexity/noUselessRename)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c996e78 and 2cfd7c4.

📒 Files selected for processing (12)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.tsx (3 hunks)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/JourneyCardMenu.tsx (7 hunks)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/TranslateJourneyDialog/TranslateJourneyDialog.spec.tsx (1 hunks)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/TranslateJourneyDialog/TranslateJourneyDialog.tsx (1 hunks)
  • apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.spec.tsx (3 hunks)
  • apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.tsx (2 hunks)
  • libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx (1 hunks)
  • libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.spec.tsx (1 hunks)
  • libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.stories.tsx (1 hunks)
  • libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.tsx (1 hunks)
  • libs/journeys/ui/src/libs/useJourneyAiTranslateMutation/index.ts (1 hunks)
  • libs/shared/ui/src/components/LanguageAutocomplete/LanguageAutocomplete.tsx (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
  • libs/journeys/ui/src/libs/useJourneyAiTranslateMutation/index.ts
  • libs/shared/ui/src/components/LanguageAutocomplete/LanguageAutocomplete.tsx
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.tsx
  • apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.tsx
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/JourneyCardMenu.tsx
  • libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.spec.tsx
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/TranslateJourneyDialog/TranslateJourneyDialog.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.spec.tsx

[error] 26-26: Useless rename.

Safe fix: Remove the renaming.

(lint/complexity/noUselessRename)

libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx

[error] 130-130: Do not add then to an object.

(lint/suspicious/noThenProperty)

libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.tsx

[error] 78-102: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Deploy Preview and Test (journeys-admin, feature/25-04-MA-feat-ai-translation, push, 22)
  • GitHub Check: Deploy Preview and Test (watch, feature/25-04-MA-feat-ai-translation, push, 22)
🔇 Additional comments (3)
libs/journeys/ui/src/components/TranslationDialogWrapper/TranslationDialogWrapper.tsx (1)

11-118: Well-structured reusable dialog component.

The component provides excellent encapsulation of translation dialog concerns with:

  • Comprehensive TypeScript interfaces
  • Detailed JSDoc documentation
  • Proper loading state handling
  • Flexible customization options
🧰 Tools
🪛 Biome (1.9.4)

[error] 78-102: Avoid using unnecessary Fragment.

A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
Unsafe fix: Remove the Fragment

(lint/complexity/noUselessFragments)

libs/journeys/ui/src/components/CopyToTeamDialog/CopyToTeamDialog.tsx (1)

123-136: Yup conditional validation schema is correctly implemented.

The validation schema properly uses Yup's conditional validation to require language selection only when translation is enabled. The static analysis hint about the "then" property is a false positive - this is valid Yup syntax.

🧰 Tools
🪛 Biome (1.9.4)

[error] 130-130: Do not add then to an object.

(lint/suspicious/noThenProperty)

apps/journeys-admin/src/components/Team/CopyToTeamMenuItem/CopyToTeamMenuItem.spec.tsx (1)

194-371: Excellent test coverage for translation workflow.

The tests comprehensively cover both the basic duplication and the new AI translation flows, including proper GraphQL mock setup, user interactions, and assertion of expected mutations.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.spec.tsx (1)

21-21: Consider removing ThemeProvider import if no longer needed.

The ThemeProvider import is present but doesn't appear to be used in any of the tests after the changes. This might be leftover from previous test setup that was simplified.

If ThemeProvider is no longer used, remove the import:

- import { ThemeProvider } from '../../../../ThemeProvider'

Also applies to: 192-938

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c694db and 061210f.

📒 Files selected for processing (4)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.spec.tsx (16 hunks)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.tsx (3 hunks)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/JourneyCardMenu.spec.tsx (2 hunks)
  • libs/locales/en/apps-journeys-admin.json (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/locales/en/apps-journeys-admin.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/JourneyCardMenu.spec.tsx
  • apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.spec.tsx (1)
apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.tsx (1)
  • DefaultMenu (95-259)
🪛 GitHub Check: test (22, 3/3)
apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.spec.tsx

[failure] 212-212: DefaultMenu › should render menu for journey
TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Duplicate"

Here are the accessible roles:

menuitem:

Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [warning] 212-212: RETRY 3: DefaultMenu › should render menu for journey
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Duplicate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [warning] 212-212: RETRY 2: DefaultMenu › should render menu for journey
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Duplicate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [warning] 212-212: RETRY 1: DefaultMenu › should render menu for journey
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Duplicate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [failure] 935-935: DefaultMenu › should call correct functions on Translate click
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Translate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [warning] 935-935: RETRY 3: DefaultMenu › should call correct functions on Translate click
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Translate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [warning] 935-935: RETRY 2: DefaultMenu › should call correct functions on Translate click
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Translate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • [warning] 935-935: RETRY 1: DefaultMenu › should call correct functions on Translate click
    TestingLibraryElementError: Unable to find an accessible element with the role "menuitem" and name "Translate"

    Here are the accessible roles:

    menuitem:

    Name "Edit Details":

  • Name "Access":

  • Name "Preview":

    Name "Share":

  • Name "Copy to ...":


  • separator:

    Name "":


    Name "":


    Name "":



    Ignored nodes: comments, script, style

  • Edit Details

  • ⏰ Context from checks skipped due to timeout of 90000ms (23)
    • GitHub Check: Deploy Preview and Test (short-links, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (journeys, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (watch, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (videos-admin, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (docs, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (arclight, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (journeys-admin, feature/25-04-MA-feat-ai-translation, push, 22)
    • GitHub Check: Deploy Preview and Test (videos-admin, 6543/merge, pull_request, 22)
    • GitHub Check: Deploy Preview and Test (short-links, 6543/merge, pull_request, 22)
    • GitHub Check: Deploy Preview and Test (docs, 6543/merge, pull_request, 22)
    • GitHub Check: Deploy Preview and Test (watch, 6543/merge, pull_request, 22)
    • GitHub Check: Deploy Preview and Test (journeys, 6543/merge, pull_request, 22)
    • GitHub Check: Deploy Preview and Test (journeys-admin, 6543/merge, pull_request, 22)
    • GitHub Check: Deploy Preview and Test (arclight, 6543/merge, pull_request, 22)
    • GitHub Check: test (22, 3/3)
    • GitHub Check: test (22, 2/3)
    • GitHub Check: build (22)
    • GitHub Check: test (22, 1/3)
    • GitHub Check: lint (22)
    • GitHub Check: Analyze (javascript)
    • GitHub Check: test (22, 2/3)
    • GitHub Check: test (22, 1/3)
    • GitHub Check: build (22)
    🔇 Additional comments (2)
    apps/journeys-admin/src/components/JourneyList/JourneyCard/JourneyCardMenu/DefaultMenu/DefaultMenu.spec.tsx (2)

    203-203: Consistent prop addition across all test instances.

    The setOpenTranslateDialog={noop} prop has been systematically added to all DefaultMenu component instances throughout the test file. This ensures consistency and prevents prop validation errors.

    Also applies to: 237-237, 279-279, 307-307, 346-346, 385-385, 447-447, 510-510, 573-573, 638-638, 700-700, 759-759, 820-820, 890-890, 928-928


    252-257: Correct test expectations for template journeys.

    The test correctly verifies that "Duplicate" and "Translate" menu items are not present for template journeys, which aligns with the business logic that these features should only be available for regular journeys.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    4 participants