Skip to content

Conversation

@Nefaris
Copy link
Contributor

@Nefaris Nefaris commented Jan 16, 2026

Passes the isRedesignEnabled feature flag through the Content Insights component tree so child components can conditionally render Blueprint vs BUIE variants. This keeps the toggle controlled by the end‑user app and enables gradual migration to Blueprint across the Content Insights UI.

Changes

  • Add isRedesignEnabled prop to ContentInsightsSummaryGraphCardPreviewsSummaryMetricSummaryHeaderWithCount / CompactCount / OpenContentInsightsButton
  • Render Blueprint Button and Text variants when redesign is enabled
  • Adjust Content Insights spacing for redesigned layout
  • Add VRT stories for ContentInsightsSummary
  • Fix flaky Metadata sidebar story (SuggestionForNewlyCreatedTemplateInstance) with waitFor

Usage

<SidebarContentInsights
  contentInsights={contentInsights}
  onContentInsightsClick={handleClick}
  isRedesignEnabled={true}  // enables Blueprint components
/>

Screenshot

Without redesign flag With redesign flag With modernized flag

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optional redesigned UI variant for content insights with improved visual styling and layout.
    • Added comprehensive visual regression tests for the redesigned interface and its various states.
  • Style

    • Updated styling for redesigned content insights components with adjusted spacing and typography.
  • Other

    • Minor message text update for improved consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@Nefaris Nefaris requested review from a team as code owners January 16, 2026 16:06
@CLAassistant
Copy link

CLAassistant commented Jan 16, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 16, 2026

Walkthrough

This change introduces a isRedesignEnabled feature flag across multiple content insights components, enabling conditional rendering of redesigned UI variants. Props are propagated through the component tree, with corresponding CSS updates and new Storybook visual regression tests added.

Changes

Cohort / File(s) Summary
Content Insights Components
src/features/content-insights/ContentInsightsSummary.tsx, OpenContentInsightsButton.tsx, CompactCount.tsx, GraphCardPreviewsSummary.tsx, HeaderWithCount.tsx, MetricSummary.tsx
Added optional isRedesignEnabled?: boolean prop to each component's Props interface. Updated component signatures to accept and propagate the flag through the tree. Implemented conditional rendering logic: when enabled, components render new UI variants using Text from Blueprint and classNames for dynamic styling; otherwise, fall back to existing implementation.
Component Styling
src/features/content-insights/ContentInsightsSummary.scss, GraphCardPreviewsSummary.scss, MetricSummary.scss
Added redesigned variant selectors (&--redesigned) to each SCSS file with adjusted margins and colors to reflect new UI styling. MetricSummary.scss also adds align-items: center to .MetricSummary-period.
Visual Regression Tests
src/features/content-insights/stories/tests/ContentInsightsSummary-visual.stories.tsx
New Storybook file with 9 exported story variants covering default, redesign-enabled, loading, error, and trend scenarios. Includes mock graph data, IntlProvider wrapper, and comprehensive UI state coverage.
Test Utilities & Messages
src/elements/content-sidebar/stories/tests/MetadataSidebarRedesign-visual.stories.tsx, src/features/content-insights/messages.ts
Updated test wait logic from direct assertion to waitFor with polling for async content. Updated message default text from 'PREVIEWS' to 'Previews'.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

ready-to-merge

Suggested reviewers

  • jpan-box
  • tjuanitas
  • reneshen0328

Poem

🐰 A redesign flag hops through the tree,
Props cascade down with such glee,
Blueprint Text and Blueprint Button dance,
While SCSS variants give styled flair and glance,
Content Insights now redesigned and free! 🎨✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Title check ✅ Passed The title accurately describes the main change: adding an isRedesignEnabled flag to enable Blueprint button variants in the Content Insights component tree.
Description check ✅ Passed The pull request description is comprehensive and well-structured, covering changes, usage examples, and screenshots. However, it does not follow the repository's PR description template.

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

✨ 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

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

@loonskai
Copy link
Contributor

Can we add some VRT tests here?

Copy link
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/features/content-insights/OpenContentInsightsButton.tsx (1)

14-35: Correct the BlueprintButton size prop value.

The implementation correctly follows React hooks rules by calling useIntl unconditionally at the component top. The early return pattern provides clean separation between the two rendering paths while maintaining consistent className for styling and test selectors.

However, the size="small" prop is incorrect. According to the @box/blueprint-web Button API, valid size values are 'sm', 'default', or 'lg'. Change size="small" to size="sm" on line 20. The variant="secondary" prop is correct.

tjiang-box
tjiang-box previously approved these changes Jan 20, 2026
tjiang-box
tjiang-box previously approved these changes Jan 20, 2026
@tjiang-box tjiang-box dismissed their stale review January 20, 2026 17:46

left some new comments

Copy link
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: 1

🤖 Fix all issues with AI agents
In `@src/features/content-insights/CompactCount.tsx`:
- Line 24: CompactCount.tsx passes a redundant string into the classNames call
causing a leading space; remove the unnecessary `' '` argument so the JSX uses
classNames(className) (locate the className={classNames(' ', className)} usage
in the CompactCount component and replace it with a single-argument call to
classNames or equivalent handling of className).
🧹 Nitpick comments (4)
src/features/content-insights/messages.ts (1)

78-82: Inconsistent casing with other message defaults.

previewGraphType now uses title case ('Previews') while similar messages like downloadGraphType ('DOWNLOADS') and peopleTitle ('PEOPLE') remain in all caps. If the redesign requires title case, consider updating all related messages for consistency, or ensure the casing is handled via CSS text-transform to avoid divergence.

src/features/content-insights/CompactCount.tsx (1)

34-37: Reuse formattedCount in the non-redesigned branch.

formattedCount is already computed at line 18 but the non-redesigned path calls formatCount(count, intl) again. Reuse the variable for consistency and to avoid redundant computation.

Proposed fix
     return (
         <span className={classNames('CompactCount', className)} {...rest}>
-            {formatCount(count, intl)}
+            {formattedCount}
         </span>
     );
src/features/content-insights/stories/tests/ContentInsightsSummary-visual.stories.tsx (1)

65-74: Consider adding a WithErrorRedesign story.

The error state is only tested without the redesign flag. For comprehensive VRT coverage, consider adding a story that tests the error state with isRedesignEnabled={true} to ensure the error UI renders correctly in the redesigned layout.

Suggested addition
export const WithErrorRedesign = {
    render: () => (
        <Wrapper>
            <ContentInsightsSummary
                {...defaultProps}
                error={Object.assign(new Error('An error occurred'), { status: 500 })}
                isRedesignEnabled
            />
        </Wrapper>
    ),
};
src/features/content-insights/MetricSummary.tsx (1)

3-4: Pre-existing: Shadowing of global isFinite and isNaN.

Static analysis flags these imports as shadowing global names. While this is intentional (lodash versions handle edge cases like isNaN(undefined) differently), consider aliasing them to avoid confusion:

import isFiniteLodash from 'lodash/isFinite';
import isNaNLodash from 'lodash/isNaN';

This is pre-existing code and not blocking for this PR.

tjiang-box
tjiang-box previously approved these changes Jan 22, 2026
tjiang-box
tjiang-box previously approved these changes Jan 26, 2026
@mergify mergify bot added the queued label Jan 27, 2026
@mergify mergify bot merged commit 051fe54 into box:master Jan 27, 2026
8 of 9 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jan 27, 2026

Merge Queue Status

✅ The pull request has been merged at e1e381c

This pull request spent 7 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge

@mergify mergify bot removed the queued label Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants