kyd-shared-badge 0.1.21 → 0.1.22
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 +1 -1
- package/src/SharedBadgeDisplay.tsx +12 -24
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { FiAlertTriangle, FiCpu, FiShield, FiThumbsUp } from 'react-icons/fi';
|
|
4
|
+
import { FiAlertTriangle } from 'react-icons/fi';
|
|
6
5
|
import { PublicBadgeData } from './types';
|
|
7
6
|
import ShareButton from './components/ShareButton';
|
|
8
7
|
import ReportHeader from './components/ReportHeader';
|
|
@@ -12,17 +11,6 @@ import IpRiskAnalysisDisplay from './components/IpRiskAnalysisDisplay';
|
|
|
12
11
|
import Image from 'next/image';
|
|
13
12
|
import { red, yellow, green } from './colors';
|
|
14
13
|
|
|
15
|
-
// Icon images from this package's public folder (will be bundled as assets)
|
|
16
|
-
import RiskGreen from './public/riskgreen.png';
|
|
17
|
-
import RiskYellow from './public/riskyellow.png';
|
|
18
|
-
import RiskRed from './public/riskred.png';
|
|
19
|
-
import CodeGreen from './public/codegreen.png';
|
|
20
|
-
import CodeYellow from './public/codeyellow.png';
|
|
21
|
-
import CodeRed from './public/codered.png';
|
|
22
|
-
import AiGreen from './public/aigreen.png';
|
|
23
|
-
import AiYellow from './public/aiyellow.png';
|
|
24
|
-
import AiRed from './public/aired.png';
|
|
25
|
-
|
|
26
14
|
const getScoreColor = (score: number) => {
|
|
27
15
|
if (score >= 80) return green;
|
|
28
16
|
if (score >= 65) return yellow;
|
|
@@ -38,27 +26,27 @@ const getRiskText = (risk: number) => {
|
|
|
38
26
|
|
|
39
27
|
// Helpers to map thresholds to icon images
|
|
40
28
|
const getTechnicalIconSrc = (score: number): string => {
|
|
41
|
-
if (score >= 80) return
|
|
42
|
-
if (score >= 65) return
|
|
43
|
-
return
|
|
29
|
+
if (score >= 80) return '/badge/codegreen.png';
|
|
30
|
+
if (score >= 65) return '/badge/codeyellow.png';
|
|
31
|
+
return '/badge/codered.png';
|
|
44
32
|
};
|
|
45
33
|
|
|
46
34
|
const getRiskIconSrc = (score: number): string => {
|
|
47
|
-
if (score >= 80) return
|
|
48
|
-
if (score >= 65) return
|
|
49
|
-
return
|
|
35
|
+
if (score >= 80) return '/badge/riskgreen.png';
|
|
36
|
+
if (score >= 65) return '/badge/riskyellow.png';
|
|
37
|
+
return '/badge/riskred.png';
|
|
50
38
|
};
|
|
51
39
|
|
|
52
40
|
const getAiIconSrc = (descriptor?: string): string => {
|
|
53
|
-
if (!descriptor) return
|
|
41
|
+
if (!descriptor) return '/badge/aiyellow.png';
|
|
54
42
|
const d = descriptor.toLowerCase();
|
|
55
43
|
if (d.indexOf('low') !== -1 || d.indexOf('transparent') !== -1 || d.indexOf('responsible') !== -1 || d.indexOf('conservative') !== -1) {
|
|
56
|
-
return
|
|
44
|
+
return '/badge/aigreen.png';
|
|
57
45
|
}
|
|
58
46
|
if (d.indexOf('medium') !== -1 || d.indexOf('moderate') !== -1 || d.indexOf('balanced') !== -1) {
|
|
59
|
-
return
|
|
47
|
+
return '/badge/aiyellow.png';
|
|
60
48
|
}
|
|
61
|
-
return
|
|
49
|
+
return '/badge/aired.png';
|
|
62
50
|
};
|
|
63
51
|
|
|
64
52
|
interface ScoreCardProps {
|
|
@@ -95,7 +83,7 @@ const ScoreCard = ({ title, score, description, descriptor, scoreType, isRecruit
|
|
|
95
83
|
style={isRecruiter ? { backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' } : undefined}
|
|
96
84
|
>
|
|
97
85
|
<div className={`text-3xl mb-4 ${scoreClass}`} style={scoreHex ? { color: scoreHex } : undefined}>
|
|
98
|
-
<Image src={iconImageSrc} alt="icon" className="h-8 w-8 object-contain" />
|
|
86
|
+
<Image src={iconImageSrc} alt="icon" width={32} height={32} className="h-8 w-8 object-contain" />
|
|
99
87
|
</div>
|
|
100
88
|
<h3 className={`font-semibold text-xl ${isDescriptor ? 'text-neutral-400' : ''}`} style={isRecruiter ? { color: 'var(--text-main)' } : undefined}>{title}</h3>
|
|
101
89
|
<p className={`text-4xl font-bold ${scoreClass}`} style={scoreHex ? { color: scoreHex } : undefined}>{displayScore}</p>
|