Skip to content

[Docs] Add annotations to all website examples#7110

Merged
ckifer merged 4 commits into
mainfrom
annotations
Mar 10, 2026
Merged

[Docs] Add annotations to all website examples#7110
ckifer merged 4 commits into
mainfrom
annotations

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Docs only. 7 different annotation components with 3 different snapping modes.

There are some small bugs, I will fix that in the devtools repository.

Related Issue

Is this good enough to close #1678?

Summary by CodeRabbit

  • New Features

    • Added an Annotations panel to the code editor toolbar, exposing annotation controls in the editing and preview UI.
  • Chores

    • Updated development dependency @recharts/devtools to ^0.0.11.

@coderabbitai

coderabbitai Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ab1f583d-e556-4a83-8722-dbfca3f800dc

📥 Commits

Reviewing files that changed from the base of the PR and between 0ff63a7 and c695cac.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json
  • www/src/components/CodeEditorWithPreview.tsx
  • www/src/components/Playground/AnnotationsPanel.tsx
  • www/src/components/Playground/ToolFrame.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • package.json
  • www/src/components/Playground/ToolFrame.tsx
  • www/src/components/Playground/AnnotationsPanel.tsx

Walkthrough

Adds a new AnnotationsPanel component, exposes it as a selectable tool in the playground toolbar, extends the ToolType union to include 'annotations', and bumps the @recharts/devtools devDependency version.

Changes

Cohort / File(s) Summary
Dependency
package.json
Updated devDependency @recharts/devtools from ^0.0.9 to ^0.0.11.
Annotations UI
www/src/components/Playground/AnnotationsPanel.tsx
New React component AnnotationsPanel that renders a RechartsAnnotationsPortal container with default inline styles and optional className prop.
Playground Integration
www/src/components/CodeEditorWithPreview.tsx
Imported AnnotationsPanel and added a new tool item { name: 'annotations', label: 'Annotations', component: <AnnotationsPanel /> } to the tools list.
Type update
www/src/components/Playground/ToolFrame.tsx
Extended exported ToolType union to include 'annotations'.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CodeEditorWithPreview
    participant ToolFrame
    participant AnnotationsPanel
    participant RechartsAnnotationsPortal

    User->>CodeEditorWithPreview: open tools menu / select "Annotations"
    CodeEditorWithPreview->>ToolFrame: activate tool 'annotations'
    ToolFrame->>AnnotationsPanel: render panel component
    AnnotationsPanel->>RechartsAnnotationsPortal: mount annotations portal
    RechartsAnnotationsPortal-->>AnnotationsPanel: provide annotations UI
    AnnotationsPanel-->>User: display annotations UI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • ckifer
🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR adds infrastructure (AnnotationsPanel component, type definitions, devDependency) but does not fulfill the core feature requirements from issue #1678: no annotations API implementation, no hover/click behaviors, and no actual annotation examples in documentation. Implement the actual annotations API with configurable behaviors (hover/click display), symbol customization, and documentation examples to meet issue #1678 requirements or clarify that this PR is preparatory work.
Title check ❓ Inconclusive The title describes adding annotations to website examples, but the actual changes are primarily code/component infrastructure (AnnotationsPanel, type definitions, devDependency) rather than documentation or visible examples. Clarify whether this PR adds actual annotation examples to documentation or just the infrastructure. If infrastructure only, consider a more precise title like '[Feature] Add AnnotationsPanel component infrastructure'.
Description check ❓ Inconclusive The description is minimal and incomplete, missing several required template sections: Motivation and Context, How Has This Been Tested, Types of changes, and Checklist items are all absent or unchecked. Complete the PR description using the template: explain the motivation, document testing approach, select appropriate change types, and fill the checklist to align with repository standards.
✅ Passed checks (2 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All changes are within scope: AnnotationsPanel component creation, tool type updates, and devDependency update directly support the annotations feature infrastructure aligned with the PR objectives.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch annotations

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@www/src/components/Playground/ToolFrame.tsx`:
- Line 6: The example metadata type that defines defaultTool needs to include
'annotations' so examples can open the annotations panel by default: update the
union for the defaultTool property in the example metadata/type declaration (the
type used in www/src/docs/exampleComponents/types.ts, e.g. ExampleMeta or
ExampleComponentProps) to 'source' | 'devtools' | 'controls' | 'annotations' to
match ToolType, and ensure any related casts or usages (such as where
example.defaultTool is passed into CodeEditorWithPreview in APIViewNew or props
of CodeEditorWithPreview) accept the new union.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3bb82d7-90b9-425c-963c-b1d99d2d8450

📥 Commits

Reviewing files that changed from the base of the PR and between c04a790 and aa43ceb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • package.json
  • www/src/components/CodeEditorWithPreview.tsx
  • www/src/components/Playground/AnnotationsPanel.tsx
  • www/src/components/Playground/ToolFrame.tsx

* The allowed types of tools in the playground.
*/
export type ToolType = 'source' | 'devtools' | 'controls';
export type ToolType = 'source' | 'devtools' | 'controls' | 'annotations';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Propagate 'annotations' to the example metadata type too.

Line 6 updates ToolType, but www/src/docs/exampleComponents/types.ts still restricts defaultTool to 'source' | 'devtools' | 'controls'. Because www/src/views/APIViewNew.tsx passes example.defaultTool through to CodeEditorWithPreview, examples still can't open the annotations panel by default.

Suggested follow-up change
- defaultTool?: 'source' | 'devtools' | 'controls';
+ defaultTool?: 'source' | 'devtools' | 'controls' | 'annotations';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@www/src/components/Playground/ToolFrame.tsx` at line 6, The example metadata
type that defines defaultTool needs to include 'annotations' so examples can
open the annotations panel by default: update the union for the defaultTool
property in the example metadata/type declaration (the type used in
www/src/docs/exampleComponents/types.ts, e.g. ExampleMeta or
ExampleComponentProps) to 'source' | 'devtools' | 'controls' | 'annotations' to
match ToolType, and ensure any related casts or usages (such as where
example.defaultTool is passed into CodeEditorWithPreview in APIViewNew or props
of CodeEditorWithPreview) accept the new union.

@codecov

codecov Bot commented Mar 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (037552f) to head (c695cac).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7110   +/-   ##
=======================================
  Coverage   89.61%   89.61%           
=======================================
  Files         534      535    +1     
  Lines       40294    40315   +21     
  Branches     5492     5493    +1     
=======================================
+ Hits        36109    36130   +21     
  Misses       4177     4177           
  Partials        8        8           

☔ 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.

@codecov

codecov Bot commented Mar 7, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@github-actions

github-actions Bot commented Mar 7, 2026

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

1 similar comment
@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@github-actions

Copy link
Copy Markdown
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

@PavelVanecek

Copy link
Copy Markdown
Collaborator Author

@ckifer

ckifer commented Mar 10, 2026

Copy link
Copy Markdown
Member

@PavelVanecek they look pretty sweet! Dark mode not great tho lol
image

@ckifer
ckifer merged commit 0fa4cc3 into main Mar 10, 2026
49 checks passed
@ckifer
ckifer deleted the annotations branch March 10, 2026 17:38
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.

Add support for Annotations component

2 participants