Skip to content

refactor: move Panel to app component library#18880

Open
adamhaeger wants to merge 9 commits into
mainfrom
refactor/move-Panel-to-app
Open

refactor: move Panel to app component library#18880
adamhaeger wants to merge 9 commits into
mainfrom
refactor/move-Panel-to-app

Conversation

@adamhaeger
Copy link
Copy Markdown
Contributor

@adamhaeger adamhaeger commented May 20, 2026

Description

Moves Panel from src/App/frontend/src/app-components/Panel to libs/form-component/src/app-components/Panel and exposes it through @app/form-component.

The migrated Panel is a dumb UI component:

  • title is now React.ReactNode — callers pass already-translated content (e.g. <Lang id=… />) instead of a TranslationKey. This drops the dependency on AppComponentsProvider/useTranslation inside the lib.
  • The fullWidth / isOnBottom / isOnTop props (which wrapped the panel in FullWidthWrapper) are removed. The two call sites that need full-width framing (PanelComponent, signing panels) now wrap with FullWidthWrapper themselves, keeping FullWidthWrapper and ConditionalWrapper in app-frontend.

All Panel call sites in app-frontend were updated to import from @app/form-component and to do their own wrapping/translation. Unit tests and a Storybook story were added in the lib, and scripts/compare-frontend-repos.ts update was run.

Verification

  • Related issues are connected (if applicable)
  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Summary by CodeRabbit

  • New Features
    • New shared Panel component available with info/warning/error/success variants, optional title, optional icons and a forced-mobile layout option.
  • Documentation
    • Storybook stories added showcasing variants, icon/title options and mobile layout.
  • Tests
    • Unit tests added covering rendering, title handling, icon visibility and style/class application.
  • Refactor
    • App components updated to consume the shared Panel and adjusted wrappers to preserve layout and full-width behaviour.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: def28b19-69bc-4083-9045-9272045cfed3

📥 Commits

Reviewing files that changed from the base of the PR and between 07b767d and b847039.

📒 Files selected for processing (3)
  • libs/form-component/src/app-components/index.ts
  • src/App/frontend/monorepo-changed-paths.txt
  • src/App/frontend/src/layout/Group/GroupComponent.tsx
✅ Files skipped from review due to trivial changes (3)
  • src/App/frontend/monorepo-changed-paths.txt
  • libs/form-component/src/app-components/index.ts
  • src/App/frontend/src/layout/Group/GroupComponent.tsx

📝 Walkthrough

Walkthrough

This PR extracts and reimplements the Panel component in libs/form-component (types, implementation, tests, Storybook) and migrates frontend consumers to import the shared Panel and use FullWidthWrapper for layout control instead of Panel-specific layout props.

Changes

Panel component migration to shared library

Layer / File(s) Summary
Panel component definition, types, and tests
libs/form-component/src/app-components/Panel/Panel.tsx, libs/form-component/src/app-components/Panel/Panel.test.tsx, libs/form-component/src/app-components/Panel/index.ts, libs/form-component/src/app-components/index.ts
Introduces PanelVariant and PanelProps, implements Panel and PanelIcon with mobile/layout logic and conditional icon rendering, adds tests validating rendering and prop propagation, and exposes the component via barrel exports.
Panel Storybook stories and variants
libs/form-component/src/app-components/Panel/Panel.stories.tsx
Adds typed Storybook meta and seven stories covering info/warning/error/success variants and permutations (WithoutIcon, WithoutTitle, ForcedMobileLayout).
Consumer migration to new Panel location and layout patterns
src/App/frontend/src/layout/Group/GroupComponent.tsx, src/App/frontend/src/layout/IFrame/IFrameComponent.tsx, src/App/frontend/src/layout/Panel/PanelComponent.tsx, src/App/frontend/src/layout/Panel/config.ts, src/App/frontend/src/layout/SigningActions/PanelAwaitingCurrentUserSignature.tsx, src/App/frontend/src/layout/SigningActions/PanelSigning.tsx, src/App/frontend/src/layout/SigningActions/SigningActionsComponent.tsx, src/App/frontend/monorepo-changed-paths.txt
Switches consumers to import Panel from @app/form-component, inlines PANEL_VARIANTS in config to avoid barrel imports, and replaces isOnBottom/isOnTop/fullWidth Panel props by wrapping content with FullWidthWrapper where needed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

kind/chore, frontend, quality/testing

Suggested reviewers

  • framitdavid
  • phlipsterit

Poem

🐰 I hopped a Panel out to share,
From app to lib with gentle care,
FullWidthWrapper holds the flow,
Icons, titles — on they go.
A tiny refactor — nice and fair.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the main change: moving the Panel component to the app component library.
Description check ✅ Passed The description covers the main changes, reasoning for the refactor, and verification status, though manual testing remains incomplete.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/move-Panel-to-app

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@github-actions github-actions Bot added the skip-releasenotes Issues that do not make sense to list in our release notes label May 20, 2026
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.

🧹 Nitpick comments (1)
src/App/frontend/src/layout/Panel/config.ts (1)

4-6: ⚡ Quick win

Consider adding a verification mechanism to ensure sync with the library.

The inlined PANEL_VARIANTS constant addresses the codegen CSS import issue, but it creates a maintenance risk: if PanelVariant in @app/form-component is updated, this constant may drift out of sync. Consider adding a verification script or a test that imports both and compares them to catch discrepancies.

🔍 Example verification approach

Add a test file (e.g., config.test.ts) that runs outside codegen context:

import { PANEL_VARIANTS } from './config';
import type { PanelVariant } from '`@app/form-component`';

// This will fail to compile if the types don't match
const _typeCheck: readonly PanelVariant[] = PANEL_VARIANTS;

test('PANEL_VARIANTS matches library PanelVariant', () => {
  // Runtime verification could go here if needed
  expect(PANEL_VARIANTS).toEqual(['info', 'warning', 'error', 'success']);
});

Alternatively, add a prominent comment reminding maintainers to keep them synchronized.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/App/frontend/src/layout/Panel/config.ts` around lines 4 - 6, Add a
verification step to ensure the inlined PANEL_VARIANTS stays in sync with the
library PanelVariant: create a test or script that imports PANEL_VARIANTS from
this module and the PanelVariant type from `@app/form-component` (reference
PANEL_VARIANTS and PanelVariant) and fails if the arrays/types diverge;
alternatively add a clear TODO comment in config.ts pointing maintainers to
update PANEL_VARIANTS when PanelVariant changes and link to the library so
future edits catch the drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/App/frontend/src/layout/Panel/config.ts`:
- Around line 4-6: Add a verification step to ensure the inlined PANEL_VARIANTS
stays in sync with the library PanelVariant: create a test or script that
imports PANEL_VARIANTS from this module and the PanelVariant type from
`@app/form-component` (reference PANEL_VARIANTS and PanelVariant) and fails if the
arrays/types diverge; alternatively add a clear TODO comment in config.ts
pointing maintainers to update PANEL_VARIANTS when PanelVariant changes and link
to the library so future edits catch the drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a78d695b-059a-42fd-9340-0d417bae7ddd

📥 Commits

Reviewing files that changed from the base of the PR and between 04ea309 and 07b767d.

📒 Files selected for processing (17)
  • libs/form-component/src/app-components/Panel/Panel.module.css
  • libs/form-component/src/app-components/Panel/Panel.stories.tsx
  • libs/form-component/src/app-components/Panel/Panel.test.tsx
  • libs/form-component/src/app-components/Panel/Panel.tsx
  • libs/form-component/src/app-components/Panel/index.ts
  • libs/form-component/src/app-components/index.ts
  • src/App/frontend/monorepo-changed-paths.txt
  • src/App/frontend/src/app-components/Panel/Panel.test.tsx
  • src/App/frontend/src/app-components/Panel/Panel.tsx
  • src/App/frontend/src/app-components/Panel/constants.ts
  • src/App/frontend/src/layout/Group/GroupComponent.tsx
  • src/App/frontend/src/layout/IFrame/IFrameComponent.tsx
  • src/App/frontend/src/layout/Panel/PanelComponent.tsx
  • src/App/frontend/src/layout/Panel/config.ts
  • src/App/frontend/src/layout/SigningActions/PanelAwaitingCurrentUserSignature.tsx
  • src/App/frontend/src/layout/SigningActions/PanelSigning.tsx
  • src/App/frontend/src/layout/SigningActions/SigningActionsComponent.tsx
💤 Files with no reviewable changes (3)
  • src/App/frontend/src/app-components/Panel/constants.ts
  • src/App/frontend/src/app-components/Panel/Panel.test.tsx
  • src/App/frontend/src/app-components/Panel/Panel.tsx

@codecov
Copy link
Copy Markdown

codecov Bot commented May 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.84%. Comparing base (50540fa) to head (ffb5e09).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18880   +/-   ##
=======================================
  Coverage   95.84%   95.84%           
=======================================
  Files        3018     3018           
  Lines       39575    39585   +10     
  Branches     4849     4857    +8     
=======================================
+ Hits        37931    37941   +10     
  Misses       1230     1230           
  Partials      414      414           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

skip-releasenotes Issues that do not make sense to list in our release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants