Skip to content

fix: card templates panel not re-opening#8895

Open
jianwei1 wants to merge 4 commits intomainfrom
jianweichong/nes-1320-select-card-template-panel-fails-to-reopen-for-new-cards
Open

fix: card templates panel not re-opening#8895
jianwei1 wants to merge 4 commits intomainfrom
jianweichong/nes-1320-select-card-template-panel-fails-to-reopen-for-new-cards

Conversation

@jianwei1
Copy link
Contributor

@jianwei1 jianwei1 commented Mar 23, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Card Templates panel reliably reopens on mobile and resets visibility when switching steps, preventing it from getting stuck closed.
  • Tests

    • Expanded test coverage to validate Card Templates visibility across navigation and open/close flows.
  • Documentation

    • Added a plan documenting the fix and acceptance criteria for Card Templates panel reopen behavior.

@jianwei1 jianwei1 requested a review from Ur-imazing March 23, 2026 04:55
@jianwei1 jianwei1 self-assigned this Mar 23, 2026
@linear
Copy link

linear bot commented Mar 23, 2026

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5ac8665a-49ab-4537-aa03-031a70a7f15e

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc17d6 and 0724462.

📒 Files selected for processing (1)
  • docs/plans/2026-03-23-001-fix-card-template-panel-reopen-plan.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/plans/2026-03-23-001-fix-card-template-panel-reopen-plan.md

Walkthrough

This PR moves Card Templates visibility from local component state to a new editor-global boolean showCardTemplates in EditorProvider, updates reducer and actions to manage it (including resetting on step changes), and updates components/tests to dispatch and reflect the new state.

Changes

Cohort / File(s) Summary
CardWrapper Mobile Handler
apps/journeys-admin/src/components/Editor/Slider/Content/Canvas/CardWrapper/CardWrapper.tsx, apps/journeys-admin/src/components/Editor/Slider/Content/Canvas/CardWrapper/CardWrapper.spec.tsx
Select Card Template click now dispatches SetShowCardTemplatesAction(true) (before existing SetSelectedBlockAction / SetActiveSlideAction); tests updated to assert showCardTemplates: true.
Properties Component
apps/journeys-admin/src/components/Editor/Slider/Settings/CanvasDetails/Properties/Properties.tsx, apps/journeys-admin/src/components/Editor/Slider/Settings/CanvasDetails/Properties/Properties.spec.tsx
Removed local showCardTemplates state; component now reads state.showCardTemplates and dispatches SetShowCardTemplatesAction(false) on close. Tests updated/added to assert rendering based on showCardTemplates.
EditorProvider State & Reducer
libs/journeys/ui/src/libs/EditorProvider/EditorProvider.tsx, libs/journeys/ui/src/libs/EditorProvider/EditorProvider.spec.tsx
Added showCardTemplates?: boolean to EditorState, default true; introduced SetShowCardTemplatesAction and handler; updated step-selection reducer branches to reset showCardTemplates: true; tests updated/added for new behavior.
Test Utilities
apps/journeys-admin/src/libs/TestEditorState/TestEditorState.tsx
Added debug output of state.showCardTemplates to aid test assertions.
Docs / Plan
docs/plans/2026-03-23-001-fix-card-template-panel-reopen-plan.md
Added plan documenting migration of showCardTemplates to global state, reducer semantics, required component dispatch order, and test acceptance criteria.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant CardWrapper as CardWrapper (mobile)
  participant Editor as EditorProvider
  participant Drawer as Drawer / ActiveSlide

  User->>CardWrapper: Click "Select Card Template"
  CardWrapper->>Editor: dispatch SetShowCardTemplates(true)
  CardWrapper->>Editor: dispatch SetSelectedBlock(...)
  CardWrapper->>Editor: dispatch SetActiveSlide(Drawer)
  Editor-->>Drawer: state.showCardTemplates = true
  Drawer-->>User: Render Card Templates panel
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: card templates panel not re-opening' directly and clearly summarizes the main change—it addresses a bug where the card templates panel couldn't be reopened after dismissal.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jianweichong/nes-1320-select-card-template-panel-fails-to-reopen-for-new-cards

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Mar 23, 2026

View your CI Pipeline Execution ↗ for commit adf55d3

Command Status Duration Result
nx run journeys-e2e:e2e ✅ Succeeded 29s View ↗
nx run resources-e2e:e2e ✅ Succeeded 16s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 29s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 6s View ↗
nx run watch-e2e:e2e ✅ Succeeded 21s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
nx run-many --target=upload-sourcemaps --projec... ✅ Succeeded 10s View ↗
nx run-many --target=deploy --projects=journeys... ✅ Succeeded 3m 17s View ↗
Additional runs (12) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-03-23 20:17:21 UTC

@nx-cloud
Copy link

nx-cloud bot commented Mar 23, 2026

View your CI Pipeline Execution ↗ for commit 8dc17d6


☁️ Nx Cloud last updated this comment at 2026-03-23 04:59:17 UTC

@github-actions github-actions bot requested a deployment to Preview - resources March 23, 2026 04:57 Pending
@github-actions github-actions bot temporarily deployed to Preview - journeys March 23, 2026 04:57 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 23, 2026 04:57 Inactive
@github-actions github-actions bot requested a deployment to Preview - journeys-admin March 23, 2026 04:57 Pending
@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Tue Mar 24 09:10:56 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Tue Mar 24 09:10:54 NZDT 2026

@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 23, 2026 05:02 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 23, 2026 05:02 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 23, 2026 05:02 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 23, 2026 05:02 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch March 23, 2026 05:02 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Tue Mar 24 09:11:05 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Tue Mar 24 09:11:24 NZDT 2026

@github-actions
Copy link
Contributor

github-actions bot commented Mar 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Tue Mar 24 09:13:45 NZDT 2026

@blacksmith-sh

This comment has been minimized.

@github-actions github-actions bot temporarily deployed to Preview - journeys-admin March 23, 2026 20:08 Inactive
@github-actions github-actions bot temporarily deployed to Preview - journeys March 23, 2026 20:08 Inactive
@github-actions github-actions bot temporarily deployed to Preview - resources March 23, 2026 20:08 Inactive
@github-actions github-actions bot temporarily deployed to Preview - watch March 23, 2026 20:08 Inactive
@github-actions github-actions bot temporarily deployed to Preview - videos-admin March 23, 2026 20:08 Inactive
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the reason why you are committing the plan document is because this is a compound engineering practice?

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.

2 participants