kyd-shared-badge 0.3.98 → 0.3.99
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
|
@@ -27,6 +27,7 @@ import UseCases from './components/UseCases';
|
|
|
27
27
|
import SummaryCards from './components/SummaryCards';
|
|
28
28
|
import GaugeCard from './components/GaugeCard';
|
|
29
29
|
import RiskCard from './components/RiskCard';
|
|
30
|
+
import RoleOverviewCard from './components/RoleOverviewCard';
|
|
30
31
|
import TopContributingFactors from './components/TopContributingFactors';
|
|
31
32
|
import AiUsageBody from './components/AiUsageBody';
|
|
32
33
|
import SanctionsMatches from './components/SanctionsMatches';
|
|
@@ -226,22 +227,17 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
|
|
|
226
227
|
/>
|
|
227
228
|
</div>
|
|
228
229
|
{/* Top-right: Role match section */}
|
|
229
|
-
<div
|
|
230
|
-
<div className={'text-lg font-semibold mb-2'} style={{ color: 'var(--text-main)' }}>Role Alignment</div>
|
|
230
|
+
<div>
|
|
231
231
|
{(() => {
|
|
232
232
|
const em = assessmentResult?.enterprise_match;
|
|
233
233
|
if (!em) return <div className={'text-sm'} style={{ color: 'var(--text-secondary)' }}>No role match available.</div>;
|
|
234
234
|
const role = em.role || {};
|
|
235
235
|
return (
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
{em.description ? (
|
|
242
|
-
<div className={'text-sm'} style={{ color: 'var(--text-secondary)' }}>{em.description}</div>
|
|
243
|
-
) : null}
|
|
244
|
-
</div>
|
|
236
|
+
<RoleOverviewCard
|
|
237
|
+
title={'Role Alignment'}
|
|
238
|
+
matchLabel={em.label}
|
|
239
|
+
roleName={role?.name || 'Role'}
|
|
240
|
+
/>
|
|
245
241
|
);
|
|
246
242
|
})()}
|
|
247
243
|
</div>
|
|
@@ -70,6 +70,13 @@ export default function GaugeCard({
|
|
|
70
70
|
value={pct}
|
|
71
71
|
minValue={0}
|
|
72
72
|
maxValue={100}
|
|
73
|
+
labels={{
|
|
74
|
+
valueLabel: {
|
|
75
|
+
// Show backend-provided label in the center instead of percent
|
|
76
|
+
formatTextValue: () => displayLabel,
|
|
77
|
+
matchColorWithArc: true,
|
|
78
|
+
},
|
|
79
|
+
}}
|
|
73
80
|
arc={{
|
|
74
81
|
padding: 0.02,
|
|
75
82
|
// Explicit subArcs ensure left->right map: red -> yellow -> green
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import GaugeComponent from '@knowyourdeveloper/react-gauge-component';
|
|
5
|
+
import { clampPercent, hexToRgba, scoreToColorHex, red, yellow, green } from '../colors';
|
|
6
|
+
|
|
7
|
+
export default function RoleOverviewCard({
|
|
8
|
+
title,
|
|
9
|
+
matchLabel,
|
|
10
|
+
roleName,
|
|
11
|
+
}: {
|
|
12
|
+
title: string;
|
|
13
|
+
matchLabel?: string;
|
|
14
|
+
roleName?: string;
|
|
15
|
+
}) {
|
|
16
|
+
const pct = useMemo(() => {
|
|
17
|
+
const raw = String(matchLabel || '').toLowerCase();
|
|
18
|
+
let mapped = 0;
|
|
19
|
+
if (raw.includes('optimal')) mapped = 100;
|
|
20
|
+
else if (raw.includes('strong')) mapped = 75;
|
|
21
|
+
else if (raw.includes('partial')) mapped = 50;
|
|
22
|
+
else if (raw.includes('weak')) mapped = 25;
|
|
23
|
+
else mapped = 0; // incompatible or unknown
|
|
24
|
+
return clampPercent(mapped);
|
|
25
|
+
}, [matchLabel]);
|
|
26
|
+
|
|
27
|
+
const headerTint = hexToRgba(scoreToColorHex(pct), 0.06);
|
|
28
|
+
const displayLabel = String(matchLabel || '').trim();
|
|
29
|
+
|
|
30
|
+
const segmentLabels = [
|
|
31
|
+
'Incompatible',
|
|
32
|
+
'Weak',
|
|
33
|
+
'Partial',
|
|
34
|
+
'Strong',
|
|
35
|
+
'Optimal',
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={'rounded-md p-5 border flex flex-col min-h-full'}
|
|
41
|
+
style={{
|
|
42
|
+
backgroundColor: 'var(--content-card-background)',
|
|
43
|
+
borderColor: 'var(--icon-button-secondary)',
|
|
44
|
+
backgroundImage: `linear-gradient(${headerTint}, ${headerTint})`,
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<div className="mb-3 flex items-start justify-between gap-2">
|
|
48
|
+
<div>
|
|
49
|
+
<div className={'font-semibold'} style={{ color: 'var(--text-main)' }}>{title}</div>
|
|
50
|
+
{roleName ? (
|
|
51
|
+
<div className={'text-xs mt-1'} style={{ color: 'var(--text-secondary)' }}>{roleName}</div>
|
|
52
|
+
) : null}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div className="flex-grow flex flex-col items-center justify-center" style={{ minHeight: 200 }}>
|
|
56
|
+
<div className="relative" style={{ width: '100%', aspectRatio: '2 / 1', maxWidth: 360 }}>
|
|
57
|
+
<GaugeComponent
|
|
58
|
+
type="semicircle"
|
|
59
|
+
style={{ width: '100%', height: '100%' }}
|
|
60
|
+
value={pct}
|
|
61
|
+
minValue={0}
|
|
62
|
+
maxValue={100}
|
|
63
|
+
labels={{
|
|
64
|
+
valueLabel: {
|
|
65
|
+
formatTextValue: () => displayLabel,
|
|
66
|
+
matchColorWithArc: true,
|
|
67
|
+
},
|
|
68
|
+
}}
|
|
69
|
+
arc={{
|
|
70
|
+
padding: 0.02,
|
|
71
|
+
gradient: true,
|
|
72
|
+
colorArray: [red, yellow, green],
|
|
73
|
+
}}
|
|
74
|
+
pointer={{ type: 'arrow', elastic: true, animationDelay: 0 }}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
<div className="mt-3 w-full">
|
|
78
|
+
<div className="grid grid-cols-5 text-[10px] sm:text-xs" style={{ color: 'var(--text-secondary)' }}>
|
|
79
|
+
{segmentLabels.map((label, idx) => (
|
|
80
|
+
<div key={idx} className="flex flex-col items-center">
|
|
81
|
+
<div className="h-2 w-px" style={{ background: 'var(--icon-button-secondary)' }} />
|
|
82
|
+
<div className="mt-1 whitespace-nowrap">{label}</div>
|
|
83
|
+
</div>
|
|
84
|
+
))}
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|