Commit 4e9d699
authored
feat(compare): add animated Developer Skills Radar Chart using recharts (use best to best tech) (JhaSourav07#3086)
### Description
This PR introduces an interactive, animated **Developer Skills Radar
Chart** (Spider Web chart) to the Compare Developers page, transforming
raw stat comparisons into a stunning visual "developer shape" overlay.
Fixes JhaSourav07#3079
Currently, users must mentally parse 8+ individual `StatBattle` cards to
form an overall opinion of two developers. This chart solves that by
mapping five distinct skill dimensions onto a single **overlapping
polygon chart**, letting users instantly see who dominates in which area
— at a single glance.
**🧠 The 5 Skill Dimensions (Normalized 0–100):**
| Skill | Formula | What it Measures |
|---|---|---|
| **Volume** | `totalContributions + LoC additions` | Raw output and
code throughput |
| **Consistency** | `currentStreak × 2 + peakStreak` | Long-term coding
discipline |
| **Impact** | `stars × 3 + followers` | Community reach and project
influence |
| **Collaboration** | `PRs × 2 + issues` | Teamwork through code reviews
and bug tracking |
| **Versatility** | `uniqueLanguages × 20` | Breadth of tech stack
knowledge |
All values are normalized against `Math.max(user1, user2)` per
dimension, ensuring fair visual comparison regardless of absolute
numbers (a 50k-commit veteran vs. a 500-commit newcomer won't break the
chart).
### Pillar
- [x] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🛠️ Other (Feature Enhancement, UI Upgrades)
### 🚀 What's Changed
#### New Dependency
- **`recharts`** — Lightweight, React-native charting library with
built-in SVG animations. Chosen over Chart.js for its declarative
component API and zero-config animation support.
#### `app/compare/CompareClient.tsx`
- **`normalizeSkill()`** — Pure utility function that clamps any raw
stat into a 0–100 range relative to the max of both users.
- **`DeveloperSkillsRadar`** — New component rendering a `<RadarChart>`
with:
- **Two overlapping `<Radar>` polygons:**
- User 1 → Violet (`#8B5CF6`, 25% fill opacity, 2px stroke)
- User 2 → Cyan (`#06B6D4`, 25% fill opacity, 2px stroke)
- **`<PolarGrid>`** with dashed stroke lines for a clean, modern
aesthetic.
- **`<PolarAngleAxis>`** with custom `11px` / `600 weight` label
styling.
- **`<Tooltip>`** with dark-themed glassmorphic styling (`#0a0a0a` bg,
10px border-radius).
- **Dot markers** (4px radius) on each vertex for precision.
- **1200ms ease-out** SVG entry animation via recharts built-in
`animationDuration`.
- Wrapped in **Framer Motion** `<motion.div>` for scroll-triggered
fade-in (`whileInView`).
- **Responsive:** Uses `<ResponsiveContainer width="100%" height={380}>`
for all screen sizes.
- **Placement:** Between `CodeVolumeShowdown` and `LanguageComparison`
for logical visual flow.
### Screenshots
> 3 files changed
Lines changed: 443 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
5 | 14 | | |
6 | 15 | | |
7 | 16 | | |
| |||
624 | 633 | | |
625 | 634 | | |
626 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
627 | 786 | | |
628 | 787 | | |
629 | 788 | | |
| |||
915 | 1074 | | |
916 | 1075 | | |
917 | 1076 | | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
918 | 1080 | | |
919 | 1081 | | |
920 | 1082 | | |
| |||
0 commit comments