kyd-shared-badge 0.3.96 → 0.3.98

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.3.96",
3
+ "version": "0.3.98",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -21,7 +21,8 @@
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.5",
24
+ "@knowyourdeveloper/react-bubble-chart": "^1.0.6",
25
+ "@knowyourdeveloper/react-gauge-component": "^1.1.30",
25
26
  "@radix-ui/react-slot": "^1.2.3",
26
27
  "@radix-ui/react-tooltip": "^1.2.8",
27
28
  "ai": "5.0.47",
@@ -291,10 +291,11 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
291
291
  <SkillsBubble skillsCategoryRadar={graphInsights?.skillsCategoryRadar} headless={isHeadless} skillsByCategory={assessmentResult?.graph_insights?.skillsByCategory} skillsMeta={assessmentResult?.graph_insights?.skillsMeta} />
292
292
  </div>
293
293
  </Reveal>
294
- <div className={'pt-6 text-sm text-center'} style={{ color: 'var(--text-secondary)' }}>
294
+
295
+ </div>
296
+ <div className={'pt-6 text-sm text-center'} style={{ color: 'var(--text-secondary)' }}>
295
297
  Report Completed: {formatLocalDateTime(updatedAt)}
296
298
  </div>
297
- </div>
298
299
  </div>
299
300
  );
300
301
 
@@ -1,9 +1,10 @@
1
1
  'use client';
2
2
 
3
3
  import React from 'react';
4
+ import GaugeComponent from '@knowyourdeveloper/react-gauge-component';
4
5
  import BusinessRuleLink from './BusinessRuleLink';
5
6
  import { FiInfo } from 'react-icons/fi';
6
- import { hexToRgba, scoreToColorHex, scoreToCssVar, clampPercent } from '../colors';
7
+ import { hexToRgba, scoreToColorHex, scoreToCssVar, clampPercent, red, yellow, green } from '../colors';
7
8
 
8
9
  type TopMover = { label?: string; uid?: string };
9
10
 
@@ -28,13 +29,7 @@ export default function GaugeCard({
28
29
  }) {
29
30
  const pct = clampPercent(percent);
30
31
  const displayLabel = label || '';
31
- // Use a fixed internal coordinate system and scale the SVG to container for responsiveness
32
- const size = 280;
33
- const strokeWidth = 32;
34
- const radius = (size - strokeWidth) / 2;
35
- const circumference = Math.PI * radius;
36
- const progress = pct / 100;
37
- const dash = circumference * progress;
32
+ // Keep card tinting consistent with score
38
33
  const progressColor = scoreToCssVar(pct);
39
34
  const headerTint = hexToRgba(scoreToColorHex(pct), 0.06);
40
35
 
@@ -69,11 +64,23 @@ export default function GaugeCard({
69
64
  </div>
70
65
  <div className="flex-grow flex flex-col items-center justify-center" style={{ minHeight: 200 }}>
71
66
  <div className="relative group" style={{ width: '100%', aspectRatio: '2 / 1', maxWidth: 360 }}>
72
- <svg width={'100%'} height={'100%'} viewBox={`0 0 ${size} ${size/2}`} preserveAspectRatio={'xMidYMid meet'}>
73
- <path d={`M ${strokeWidth/2} ${size/2} A ${radius} ${radius} 0 0 1 ${size-strokeWidth/2} ${size/2}`} stroke={'var(--icon-button-secondary)'} strokeWidth={strokeWidth} fill="none" strokeLinecap="round" />
74
- <path d={`M ${strokeWidth/2} ${size/2} A ${radius} ${radius} 0 0 1 ${size-strokeWidth/2} ${size/2}`} stroke={progressColor} strokeWidth={strokeWidth} fill="none" strokeLinecap="round" strokeDasharray={`${dash},${circumference}`} />
75
- <line x1={size/2} y1={size/2} x2={size/2 + radius * Math.cos(Math.PI * progress - Math.PI)} y2={size/2 + radius * Math.sin(Math.PI * progress - Math.PI)} stroke={'var(--text-main)'} strokeWidth="2" />
76
- </svg>
67
+ <GaugeComponent
68
+ type="semicircle"
69
+ style={{ width: '100%', height: '100%' }}
70
+ value={pct}
71
+ minValue={0}
72
+ maxValue={100}
73
+ arc={{
74
+ padding: 0.02,
75
+ // Explicit subArcs ensure left->right map: red -> yellow -> green
76
+ subArcs: [
77
+ { limit: 33, color: red },
78
+ { limit: 66, color: yellow },
79
+ { limit: 100, color: green },
80
+ ],
81
+ }}
82
+ pointer={{ type: 'blob', elastic: true, animationDelay: 0 }}
83
+ />
77
84
  {(tooltipText || description) && (
78
85
  <div className="hidden group-hover:block absolute z-30 left-1/2 -translate-x-1/2 top-full mt-2 w-80">
79
86
  <div style={{ background: 'var(--content-card-background)', border: '1px solid var(--icon-button-secondary)', color: 'var(--text-main)', padding: 10, borderRadius: 6 }}>
@@ -57,6 +57,7 @@ export default function SkillsBubble({ skillsCategoryRadar, skillsByCategory, sk
57
57
  const legendRef = useRef<HTMLDivElement>(null);
58
58
  const [legendTooltip, setLegendTooltip] = useState<HoverTooltipState>(null);
59
59
  const [activeCategory, setActiveCategory] = useState<string | null>(null);
60
+ const [legendHovered, setLegendHovered] = useState<boolean>(false);
60
61
  useEffect(() => {
61
62
  if (typeof window !== 'undefined') {
62
63
  const id = window.setTimeout(() => {
@@ -114,9 +115,10 @@ export default function SkillsBubble({ skillsCategoryRadar, skillsByCategory, sk
114
115
  _id: String(b.label || ''),
115
116
  value: Number(b.value || 0),
116
117
  displayText: String(b.label || ''),
117
- colorValue: Number(b.data?.experience || 0)
118
+ colorValue: Number(b.data?.experience || 0),
119
+ selected: legendHovered && !!activeCategory && String(b.label || '') === String(activeCategory)
118
120
  }));
119
- }, [bubbles]);
121
+ }, [bubbles, legendHovered, activeCategory]);
120
122
 
121
123
  const colorLegend = useMemo(() => {
122
124
  return [green5, green4, green3, green2, green1];
@@ -215,7 +217,7 @@ export default function SkillsBubble({ skillsCategoryRadar, skillsByCategory, sk
215
217
  <div className="flex flex-col min-w-0 justify-center">
216
218
  <div className="flex items-center gap-2 min-w-0 text-lg text-[var(--text-main)]">
217
219
  <span className={'inline-block h-2 w-2 rounded-full'} style={{ backgroundColor: entry ? 'var(--icon-button-secondary)' : 'transparent', flexShrink: 0 }} />
218
- <span className="shrink-0 opacity-70">{idx + (isLeft ? 1 : 6)}.</span>
220
+ <span className="shrink-0 opacity-70 ">{idx + (isLeft ? 1 : 6)}.</span>
219
221
  {entry && typeof entry !== 'string' ? (
220
222
  <span className="truncate" title={entry.label}>{entry.label}</span>
221
223
  ) : (
@@ -254,7 +256,7 @@ export default function SkillsBubble({ skillsCategoryRadar, skillsByCategory, sk
254
256
  </div>
255
257
  {entry && typeof entry !== 'string' ? (
256
258
  <div className="flex flex-col items-end leading-tight h-full justify-between text-base">
257
- {entry.years ? <span className="whitespace-nowrap text-[var(--text-main)]">{`${entry.years} Years`}</span> : <span className="opacity-0 whitespace-nowrap text-[var(--text-main)]">0 Years</span>}
259
+ {entry.years ? <span className="whitespace-nowrap text-[var(--text-secondary)]">{`${entry.years} Years`}</span> : <span className="opacity-0 whitespace-nowrap text-[var(--text-secondary)]">0 Years</span>}
258
260
  {entry.presence ? (
259
261
  <div className="flex items-center gap-1">
260
262
  <span className="inline-block h-2 w-2 rounded-full text-sm" style={{ background: presenceColor(entry.presence) }} />
@@ -340,7 +342,13 @@ export default function SkillsBubble({ skillsCategoryRadar, skillsByCategory, sk
340
342
  />
341
343
  </div>
342
344
  <div className='mt-8'>
343
- <div ref={legendRef} className={'kyd-avoid-break'} style={{ position: 'relative', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}>
345
+ <div
346
+ ref={legendRef}
347
+ className={'kyd-avoid-break'}
348
+ style={{ position: 'relative', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}
349
+ onMouseEnter={() => setLegendHovered(true)}
350
+ onMouseLeave={() => setLegendHovered(false)}
351
+ >
344
352
  <div className="mb-2 text-xs font-medium" style={{ color: 'var(--text-main)' }}>
345
353
 
346
354
  {activeCategory ? (