kyd-shared-badge 0.3.30 → 0.3.31

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.30",
3
+ "version": "0.3.31",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -37,7 +37,7 @@ export default function EnterpriseCoaching({
37
37
  <div className={'text-sm font-semibold'} style={{ color: 'var(--text-main)' }}>
38
38
  {roleName ? `Role Alignment — ${roleName}` : 'Role Alignment'}
39
39
  </div>
40
- <span className={'relative inline-flex items-center group'} style={{ color: 'var(--text-secondary)' }}>
40
+ {/* <span className={'relative inline-flex items-center group'} style={{ color: 'var(--text-secondary)' }}>
41
41
  <FiInfo size={14} />
42
42
  <div className="hidden group-hover:block absolute z-30 left-1/2 -translate-x-1/2 top-full mt-2 w-80">
43
43
  <div style={{ background: 'var(--content-card-background)', border: '1px solid var(--icon-button-secondary)', color: 'var(--text-main)', padding: 10, borderRadius: 6 }}>
@@ -45,7 +45,7 @@ export default function EnterpriseCoaching({
45
45
  <div style={{ marginTop: 6, fontSize: 12, color: 'var(--text-secondary)' }}>These items reflect alignment evidence and coaching opportunities based on the role requirements.</div>
46
46
  </div>
47
47
  </div>
48
- </span>
48
+ </span> */}
49
49
  </div>
50
50
  </div>
51
51
  <ul className={'space-y-3'}>
@@ -61,7 +61,7 @@ export default function EnterpriseCoaching({
61
61
  <div className={'text-sm'}>{it.rationale}</div>
62
62
  {it.action ? (
63
63
  <div className={'text-sm'}>
64
- <span className={'font-semibold'} style={{ color: 'var(--text-main)' }}>Action:</span> {it.action}
64
+ <span className={'font-semibold'} style={{ color: 'var(--text-main)' }}>Coaching Opportunity:</span> {it.action}
65
65
  </div>
66
66
  ) : null}
67
67
  </div>
@@ -103,7 +103,7 @@ const ReportHeader = ({ badgeId, developerName, updatedAt, score = 0, badgeImage
103
103
  <div className={'hidden md:block text-sm space-y-2 pt-4'} style={{ borderTop: '1px solid var(--icon-button-secondary)' }}>
104
104
  <div className="flex items-center justify-between">
105
105
  <div className="flex items-center gap-2">
106
- <p className={'font-semibold'} style={{ color: 'var(--text-secondary)' }}>Role Match{enterpriseMatch?.roleName ? ` — ${enterpriseMatch.roleName}` : ''}</p>
106
+ <p className={'font-semibold'} style={{ color: 'var(--text-secondary)' }}>Role Alignment{enterpriseMatch?.roleName ? ` — ${enterpriseMatch.roleName}` : ''}</p>
107
107
  <span className={'relative inline-flex items-center group'} style={{ color: 'var(--text-secondary)' }}>
108
108
  <FiInfo size={16} />
109
109
  <div className="hidden group-hover:block absolute z-30 left-1/2 -translate-x-1/2 top-full mt-2 w-80">
@@ -9,13 +9,31 @@ export default function UseCases({ useCases, headless }: { useCases?: Enterprise
9
9
  const items: UseCaseItem[] = useCases.items.slice(0, 4);
10
10
  const note = (useCases.note || '').trim();
11
11
 
12
+ // Fallback: derive a stable pseudo-random index (1-9) if backend hasn't set one
13
+ const fallbackIndex = (uc: UseCaseItem, idx: number) => {
14
+ if (typeof uc.image_index === 'number' && uc.image_index >= 1 && uc.image_index <= 9) return uc.image_index;
15
+ const seed = `${uc.title}|${uc.demonstrated_capability}|${idx}`;
16
+ let hash = 0;
17
+ for (let i = 0; i < seed.length; i++) {
18
+ hash = (hash * 31 + seed.charCodeAt(i)) >>> 0;
19
+ }
20
+ return (hash % 9) + 1;
21
+ };
22
+
12
23
  return (
13
24
  <Reveal headless={!!headless}>
14
25
  <div className={'pt-8 kyd-avoid-break'}>
15
26
  <h3 className={'text-2xl font-semibold mb-3'} style={{ color: 'var(--text-main)' }}>Potential Use Cases</h3>
16
27
  <div className={'grid grid-cols-1 md:grid-cols-2 gap-4'}>
17
- {items.map((uc, idx) => (
28
+ {items.map((uc, idx) => {
29
+ const imgIndex = fallbackIndex(uc, idx);
30
+ const imgSrc = `/badge/puzzle${imgIndex}.svg`;
31
+ return (
18
32
  <div key={idx} className={'rounded-md p-5 border'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' }}>
33
+ <div className={'flex items-start gap-3'}>
34
+ <img src={imgSrc} alt={''} width={36} height={36} style={{ flexShrink: 0 }} />
35
+ <div className={'font-semibold'} style={{ color: 'var(--text-main)' }}>{uc.title}</div>
36
+ </div>
19
37
  <div className={'font-semibold'} style={{ color: 'var(--text-main)' }}>{uc.title}</div>
20
38
  {uc.potential_impact ? (
21
39
  <div className={'text-sm mt-2'} style={{ color: 'var(--text-secondary)' }}>
@@ -36,7 +54,7 @@ export default function UseCases({ useCases, headless }: { useCases?: Enterprise
36
54
  </div>
37
55
  ) : null}
38
56
  </div>
39
- ))}
57
+ );})}
40
58
  </div>
41
59
  {note ? (
42
60
  <div className={'text-xs mt-3'} style={{ color: 'var(--text-secondary)' }}>{note}</div>
package/src/types.ts CHANGED
@@ -181,6 +181,8 @@ export interface UseCaseItem {
181
181
  potential_impact: string;
182
182
  demonstrated_capability: string;
183
183
  justification: string;
184
+ // Optional deterministic image index (1-9) assigned by backend
185
+ image_index?: number;
184
186
  }
185
187
 
186
188
  export interface EnterpriseUseCases {