kyd-shared-badge 0.3.88 → 0.3.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/components/SkillsBubble.tsx +39 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kyd-shared-badge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.90",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"module": "./src/index.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@aws-sdk/lib-dynamodb": "^3.893.0",
|
|
22
22
|
"@chatscope/chat-ui-kit-react": "^2.1.1",
|
|
23
23
|
"@chatscope/chat-ui-kit-styles": "^1.4.0",
|
|
24
|
-
"@knowyourdeveloper/react-bubble-chart": "^1.0.
|
|
24
|
+
"@knowyourdeveloper/react-bubble-chart": "^1.0.2",
|
|
25
25
|
"@radix-ui/react-slot": "^1.2.3",
|
|
26
26
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
27
27
|
"ai": "5.0.47",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import React, { useMemo, useRef, useState, useEffect } from 'react';
|
|
4
|
-
import BubbleChart from '@knowyourdeveloper/react-bubble-chart';
|
|
4
|
+
import { BubbleChart } from '@knowyourdeveloper/react-bubble-chart';
|
|
5
|
+
import '@knowyourdeveloper/react-bubble-chart/style.css';
|
|
5
6
|
|
|
6
7
|
type SkillsRadarPoint = {
|
|
7
8
|
axis: string;
|
|
@@ -90,6 +91,20 @@ export default function SkillsBubble({ skillsCategoryRadar, headless }: { skills
|
|
|
90
91
|
});
|
|
91
92
|
}, [skillsRadarLimited]);
|
|
92
93
|
|
|
94
|
+
const bubbleData = useMemo(() => {
|
|
95
|
+
return bubbles.map((b) => ({
|
|
96
|
+
_id: String(b.label || ''),
|
|
97
|
+
value: Number(b.value || 0),
|
|
98
|
+
displayText: String(b.label || ''),
|
|
99
|
+
colorValue: Number(b.data?.experience || 0)
|
|
100
|
+
}));
|
|
101
|
+
}, [bubbles]);
|
|
102
|
+
|
|
103
|
+
const colorLegend = useMemo(() => {
|
|
104
|
+
const steps = [20, 35, 50, 65, 80, 90, 100];
|
|
105
|
+
return steps.map((s) => `hsl(210 ${s}% 45%)`);
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
93
108
|
const percentLegend = useMemo(() => {
|
|
94
109
|
const total = bubbles.reduce((sum, b) => sum + (b.data?.ratio || 0), 0);
|
|
95
110
|
return bubbles
|
|
@@ -103,24 +118,37 @@ export default function SkillsBubble({ skillsCategoryRadar, headless }: { skills
|
|
|
103
118
|
<div className={'kyd-avoid-break'}>
|
|
104
119
|
<div ref={containerRef} style={{ width: '100%', height: 340 }}>
|
|
105
120
|
<BubbleChart
|
|
106
|
-
|
|
107
|
-
height={'100%'}
|
|
108
|
-
graph={{ zoom: 1 }}
|
|
109
|
-
showLegend={false}
|
|
110
|
-
data={bubbles}
|
|
121
|
+
data={bubbleData}
|
|
111
122
|
legend={false}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
tooltip
|
|
124
|
+
colorLegend={colorLegend}
|
|
125
|
+
fixedDomain={{ min: 0, max: 100 }}
|
|
126
|
+
onClick={(d) => {
|
|
115
127
|
try {
|
|
116
128
|
if (typeof window !== 'undefined') {
|
|
117
|
-
const
|
|
129
|
+
const label = String(d.displayText || d._id || '');
|
|
130
|
+
const anchor = `#appendix-skills-cat-${encodeURIComponent(label.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, ''))}`;
|
|
118
131
|
const url = `#appendix${anchor}`;
|
|
119
132
|
window.location.hash = url;
|
|
120
133
|
}
|
|
121
134
|
} catch {}
|
|
122
135
|
}}
|
|
123
|
-
|
|
136
|
+
tooltipFunc={(node, d) => {
|
|
137
|
+
try {
|
|
138
|
+
node.innerHTML = '';
|
|
139
|
+
const title = document.createElement('div');
|
|
140
|
+
title.style.fontWeight = '600';
|
|
141
|
+
title.textContent = String(d.displayText || d._id || '');
|
|
142
|
+
const body = document.createElement('div');
|
|
143
|
+
body.style.fontSize = '12px';
|
|
144
|
+
body.style.color = 'var(--text-secondary)';
|
|
145
|
+
const ratio = Number(d.value || 0);
|
|
146
|
+
const experience = Number(d.colorValue || 0);
|
|
147
|
+
body.textContent = `${ratio}% ratio • Experience ${experience}`;
|
|
148
|
+
node.appendChild(title);
|
|
149
|
+
node.appendChild(body);
|
|
150
|
+
} catch {}
|
|
151
|
+
}}
|
|
124
152
|
/>
|
|
125
153
|
</div>
|
|
126
154
|
<div className={'mt-3'}>
|