Skip to content

Feat/recharts poc#500

Closed
Shramkoweb wants to merge 22 commits into
mainfrom
feat/recharts-poc
Closed

Feat/recharts poc#500
Shramkoweb wants to merge 22 commits into
mainfrom
feat/recharts-poc

Conversation

@Shramkoweb

@Shramkoweb Shramkoweb commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added interactive visualization dashboard with multiple chart types (bar, line, dual-axis, donut, histogram)
    • Introduced KPI cards displaying metrics with period-over-period performance comparisons
    • Added sortable breakdown table for keyword performance analysis
    • Included performance optimization mode for efficient rendering
    • Added dark and light theme support
  • Chores

    • Updated project dependencies

@Shramkoweb Shramkoweb self-assigned this Jun 9, 2026
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
portfolio Ready Ready Preview Jun 9, 2026 12:57pm

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Shramkoweb, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 16 minutes and 50 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f56ab11-831b-4477-ad15-4155b8a23e22

📥 Commits

Reviewing files that changed from the base of the PR and between f0f5837 and 430c1fc.

📒 Files selected for processing (19)
  • components/recharts-poc/RechartsPocPage.tsx
  • components/recharts-poc/charts/FeatureAdoptionCard.tsx
  • components/recharts-poc/charts/FeatureRetentionCard.tsx
  • components/recharts-poc/charts/MonthlyActiveUsersCard.tsx
  • components/recharts-poc/charts/NewUsersCohortCard.tsx
  • components/recharts-poc/charts/ProgramUtilizationCard.tsx
  • components/recharts-poc/charts/SimpleLineCard.tsx
  • components/recharts-poc/charts/UserActivitySegmentsCard.tsx
  • components/recharts-poc/data/engagement.ts
  • components/recharts-poc/kpi/EngagementKpiCard.tsx
  • components/recharts-poc/primitives/ChartCard.tsx
  • components/recharts-poc/primitives/ChartLegend.tsx
  • components/recharts-poc/primitives/FeatureDropdown.tsx
  • components/recharts-poc/primitives/InfoTooltip.tsx
  • components/recharts-poc/primitives/SectionFrame.tsx
  • components/recharts-poc/primitives/theme.ts
  • components/recharts-poc/sections/EngagementSection.tsx
  • components/recharts-poc/sections/TrendsSection.tsx
  • next-env.d.ts
📝 Walkthrough

Walkthrough

This PR introduces a complete Recharts proof-of-concept (POC) with five chart types, a KPI metrics system, a sortable breakdown table, color theming, and mock data, all deployed at /labs/recharts with comprehensive evaluation documentation.

Changes

Recharts POC Feature

Layer / File(s) Summary
Primitives and utilities foundation
components/recharts-poc/primitives/useIsMounted.ts, components/recharts-poc/primitives/periodOverPeriod.ts, components/recharts-poc/primitives/periodOverPeriod.test.ts, components/recharts-poc/primitives/colors.ts, components/recharts-poc/primitives/colors.test.ts, components/recharts-poc/primitives/ChartCard.tsx, components/recharts-poc/primitives/LabelsToggle.tsx
useIsMounted hook prevents hydration mismatches; periodOverPeriod computes deltas with null handling for zero-baseline division; Palette types and LIGHT_PALETTE/DARK_PALETTE constants drive theme consistency; usePalette() integrates next-themes; ChartCard wraps ResponsiveContainer and shows skeleton on mount; LabelsToggle controls chart label visibility.
KPI system and deltas
components/recharts-poc/kpi/DeltaBadge.tsx, components/recharts-poc/kpi/KpiCard.tsx, components/recharts-poc/mocks/kpis.ts
DeltaBadge renders inline direction (up/down/flat) and delta with conditional baseline-missing marker; KpiCard composes an icon, label, formatted current value, and DeltaBadge showing period-over-period change; KPIS array provides four sample metrics (Unique Pages, Page Views, CTR, Active Users) with icons and format hints.
Chart mock datasets
components/recharts-poc/mocks/keywordLength.ts, components/recharts-poc/mocks/keywords.ts, components/recharts-poc/mocks/devicePerformance.ts, components/recharts-poc/mocks/improvedKeywords.ts, components/recharts-poc/mocks/salesAsp.ts
Five typed mock data shapes: KEYWORD_LENGTH (length buckets 1–10 with current/previous counts), KEYWORDS (time-series shortTail/longTail), DEVICE_PERFORMANCE (device name/value pairs), IMPROVED_KEYWORDS (keyword position changes), SALES_ASP (month/asp/sales for dual-axis).
Chart card implementations
components/recharts-poc/charts/BarChartCard.tsx, components/recharts-poc/charts/LineChartCard.tsx, components/recharts-poc/charts/DonutCard.tsx, components/recharts-poc/charts/DualAxisChartCard.tsx, components/recharts-poc/charts/HistogramCard.tsx
Five Recharts wrappers: BarChartCard with label position picker; LineChartCard with Area/Line series visibility toggle; DonutCard with percent label positioning via polar math; DualAxisChartCard with dual Y axes and legend-click series toggle; HistogramCard with current/previous period bars and label toggle. All disable animation when perfMode === true, use usePalette() for styling, and format tooltips via Intl.NumberFormat.
Breakdown table with sorting
components/recharts-poc/table/BreakdownTable.tsx
Sortable table rendering IMPROVED_KEYWORDS enriched with periodOverPeriod deltas; click table headers to toggle sort column/direction; per-row delta-based background tint computed as a fraction of max delta; local Th component renders clickable headers with active-sort arrow indicator.
Page orchestration and routing
components/recharts-poc/RechartsPocPage.tsx, components/recharts-poc/index.ts, pages/labs/recharts.tsx
RechartsPocPage reads perf from router.query to compute perfMode, renders header with conditional badge, maps KPIS to KpiCard rows, renders all five chart cards with perfMode prop, and appends BreakdownTable. Lab page at /labs/recharts wraps the POC page with SEO metadata (robots: noindex,nofollow). Module index exports RechartsPocPage.
Configuration, dependencies, and documentation
jest.config.js, next-sitemap.config.cjs, package.json, docs/recharts-poc-report.md
Jest coveragePathIgnorePatterns excludes components/recharts-poc except tested primitives/(colors|periodOverPeriod).ts; sitemap excludes /labs/*; package.json adds recharts@^3.8.1, bumps @tailwindcss/typography, oxfmt, oxlint; POC report documents verdict, functional criteria (chart types, labels, deltas, legend interactivity), non-functional criteria (bundle size, TypeScript, documentation), weak-laptop performance test steps, and known limitations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Shramkoweb/Portfolio#479: Updates sitemap exclusion configuration via EXCLUDED_PATHS; this PR adds the /labs/* pattern to exclude the new POC routes.

Poem

📊 Charts bloom where data flows,
Bars and lines in color rows,
Delta badges keep the score,
KPIs that users will adore,
Sorting tables, themes aligned—
Recharts magic, well-designed! 🐰

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The PR title "Feat/recharts poc" is vague and uses generic terms ("poc", "feat") without clearly describing the specific changes or their purpose, making it difficult for reviewers to understand what was implemented. Consider using a more descriptive title that specifies the main deliverable, such as "Add Recharts dashboard with KPI cards and interactive chart components" or "Implement Recharts proof-of-concept page with performance mode."
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/recharts-poc

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 commented Jun 9, 2026

Copy link
Copy Markdown

Lighthouse Results

URL Perf A11y BP SEO LCP FCP TBT CLS
/ 56 96 96 66 4.17s 1.25s 3761ms 0.000
/ 96 96 96 66 2.16s 0.93s 178ms 0.000
/blog 90 100 96 63 2.07s 1.02s 377ms 0.000
/blog 93 100 96 63 1.99s 0.94s 289ms 0.000
/about 97 96 93 66 2.12s 0.92s 162ms 0.000
/about 96 96 93 66 2.20s 0.92s 171ms 0.000
/ 99 96 96 66 1.52s 0.93s 103ms 0.000
/blog 87 100 96 63 3.27s 0.93s 291ms 0.000
/about 97 96 93 66 2.12s 0.92s 171ms 0.000

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
components/recharts-poc/table/BreakdownTable.tsx (1)

121-127: Replace React.ReactNode with an imported ReactNode type.

@types/react exposes a global React namespace (export as namespace React), so this often compiles as-is; importing ReactNode removes reliance on that global namespace and makes the type usage more explicit.

Proposed fix
-import { useMemo, useState } from 'react';
+import { useMemo, useState } from 'react';
+import type { ReactNode } from 'react';
@@
 interface ThProps {
   onClick: () => void;
   active: boolean;
   dir: SortDir;
   align?: 'left' | 'right';
-  children: React.ReactNode;
+  children: ReactNode;
 }
🤖 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 `@components/recharts-poc/table/BreakdownTable.tsx` around lines 121 - 127,
Update the ThProps interface to stop relying on the global React namespace:
import the ReactNode type from 'react' (e.g., add `import { ReactNode } from
'react'`) and change the children property type in the ThProps interface from
`React.ReactNode` to `ReactNode`; this makes the type explicit and avoids the
ambient global `React` namespace dependency (locate the ThProps interface in
BreakdownTable.tsx).

Source: Coding guidelines

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

Inline comments:
In `@components/recharts-poc/primitives/periodOverPeriod.test.ts`:
- Around line 28-50: Add a test to cover the missing edge case where previous
=== 0 and current is negative: call periodOverPeriod(-50, 0) and assert it
returns absDelta: -50, pctDelta: null, and direction: 'down'. Place the new
it(...) alongside the other tests in periodOverPeriod.spec (or
periodOverPeriod.test.ts) near the existing cases so the behavior in the
periodOverPeriod(...) function is validated for negative current with zero
previous.

In `@components/recharts-poc/primitives/periodOverPeriod.ts`:
- Around line 11-16: The branch handling previous === 0 currently assigns
direction as current > 0 ? 'up' : 'flat', which treats negative currents as
flat; update the logic inside the function that computes
absDelta/pctDelta/direction (the block referencing previous, current, absDelta,
pctDelta, direction) so that direction is 'up' for current > 0, 'down' for
current < 0, and 'flat' only for current === 0 (e.g. change the ternary to check
current < 0 separately).

---

Nitpick comments:
In `@components/recharts-poc/table/BreakdownTable.tsx`:
- Around line 121-127: Update the ThProps interface to stop relying on the
global React namespace: import the ReactNode type from 'react' (e.g., add
`import { ReactNode } from 'react'`) and change the children property type in
the ThProps interface from `React.ReactNode` to `ReactNode`; this makes the type
explicit and avoids the ambient global `React` namespace dependency (locate the
ThProps interface in BreakdownTable.tsx).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0acf64c-1f5f-4119-94e1-269a9963f57c

📥 Commits

Reviewing files that changed from the base of the PR and between d6311fa and f0f5837.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (28)
  • components/recharts-poc/RechartsPocPage.tsx
  • components/recharts-poc/charts/BarChartCard.tsx
  • components/recharts-poc/charts/DonutCard.tsx
  • components/recharts-poc/charts/DualAxisChartCard.tsx
  • components/recharts-poc/charts/HistogramCard.tsx
  • components/recharts-poc/charts/LineChartCard.tsx
  • components/recharts-poc/index.ts
  • components/recharts-poc/kpi/DeltaBadge.tsx
  • components/recharts-poc/kpi/KpiCard.tsx
  • components/recharts-poc/mocks/devicePerformance.ts
  • components/recharts-poc/mocks/improvedKeywords.ts
  • components/recharts-poc/mocks/keywordLength.ts
  • components/recharts-poc/mocks/keywords.ts
  • components/recharts-poc/mocks/kpis.ts
  • components/recharts-poc/mocks/salesAsp.ts
  • components/recharts-poc/primitives/ChartCard.tsx
  • components/recharts-poc/primitives/LabelsToggle.tsx
  • components/recharts-poc/primitives/colors.test.ts
  • components/recharts-poc/primitives/colors.ts
  • components/recharts-poc/primitives/periodOverPeriod.test.ts
  • components/recharts-poc/primitives/periodOverPeriod.ts
  • components/recharts-poc/primitives/useIsMounted.ts
  • components/recharts-poc/table/BreakdownTable.tsx
  • docs/recharts-poc-report.md
  • jest.config.js
  • next-sitemap.config.cjs
  • package.json
  • pages/labs/recharts.tsx

Comment on lines +28 to +50
it('handles previous === 0 by returning null pctDelta and up direction when current > 0', () => {
expect(periodOverPeriod(50, 0)).toEqual({
absDelta: 50,
pctDelta: null,
direction: 'up',
});
});

it('handles current === 0 and previous > 0 with -100% delta and down direction', () => {
expect(periodOverPeriod(0, 100)).toEqual({
absDelta: -100,
pctDelta: -100,
direction: 'down',
});
});

it('handles both zero by returning flat with null pct', () => {
expect(periodOverPeriod(0, 0)).toEqual({
absDelta: 0,
pctDelta: null,
direction: 'flat',
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a test for previous === 0 and negative current.

Current suite misses the periodOverPeriod(-50, 0) case, which should assert direction: 'down' and would guard this edge branch.

🤖 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 `@components/recharts-poc/primitives/periodOverPeriod.test.ts` around lines 28
- 50, Add a test to cover the missing edge case where previous === 0 and current
is negative: call periodOverPeriod(-50, 0) and assert it returns absDelta: -50,
pctDelta: null, and direction: 'down'. Place the new it(...) alongside the other
tests in periodOverPeriod.spec (or periodOverPeriod.test.ts) near the existing
cases so the behavior in the periodOverPeriod(...) function is validated for
negative current with zero previous.

Comment on lines +11 to +16
if (previous === 0) {
return {
absDelta,
pctDelta: null,
direction: current > 0 ? 'up' : 'flat',
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Handle negative current when previous === 0 correctly.

Line 15 currently maps all non-positive values to flat; current < 0 should return down.

Suggested fix
   if (previous === 0) {
     return {
       absDelta,
       pctDelta: null,
-      direction: current > 0 ? 'up' : 'flat',
+      direction: current > 0 ? 'up' : current < 0 ? 'down' : 'flat',
     };
   }
🤖 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 `@components/recharts-poc/primitives/periodOverPeriod.ts` around lines 11 - 16,
The branch handling previous === 0 currently assigns direction as current > 0 ?
'up' : 'flat', which treats negative currents as flat; update the logic inside
the function that computes absDelta/pctDelta/direction (the block referencing
previous, current, absDelta, pctDelta, direction) so that direction is 'up' for
current > 0, 'down' for current < 0, and 'flat' only for current === 0 (e.g.
change the ternary to check current < 0 separately).

@Shramkoweb
Shramkoweb deleted the feat/recharts-poc branch June 12, 2026 00:03
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.

1 participant