kyd-shared-badge 0.3.30 → 0.3.32

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.32",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -263,7 +263,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
263
263
 
264
264
  {/* Enterprise Use Cases (directly under the three summary cards) */}
265
265
  {assessmentResult?.enterprise_use_cases?.items && assessmentResult.enterprise_use_cases.items.length > 0 && (
266
- <UseCases useCases={assessmentResult.enterprise_use_cases} headless={isHeadless} />
266
+ <UseCases useCases={assessmentResult.enterprise_use_cases} headless={isHeadless} badgeId={badgeId} />
267
267
  )}
268
268
 
269
269
  {/* Technical Scores */}
@@ -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">
@@ -2,20 +2,50 @@
2
2
 
3
3
  import Reveal from './Reveal';
4
4
  import { EnterpriseUseCases, UseCaseItem } from '../types';
5
+ import Image from 'next/image';
5
6
 
6
- export default function UseCases({ useCases, headless }: { useCases?: EnterpriseUseCases | null; headless?: boolean }) {
7
+ export default function UseCases({ useCases, headless, badgeId }: { useCases?: EnterpriseUseCases | null; headless?: boolean; badgeId?: string }) {
7
8
  if (!useCases || !Array.isArray(useCases.items) || useCases.items.length === 0) return null;
8
9
 
9
10
  const items: UseCaseItem[] = useCases.items.slice(0, 4);
10
11
  const note = (useCases.note || '').trim();
11
12
 
13
+ // Generate unique indices (1-9) for each use case, ensuring no repeats
14
+ const usedIndices = new Set<number>();
15
+ const getUniqueIndex = (idx: number) => {
16
+ const seed = `${badgeId || ''}|${idx}`;
17
+ let hash = 0;
18
+ for (let i = 0; i < seed.length; i++) {
19
+ hash = (hash * 31 + seed.charCodeAt(i)) >>> 0;
20
+ }
21
+ let baseIndex = (hash % 9) + 1;
22
+
23
+ // If base index is already used, find next available
24
+ let finalIndex = baseIndex;
25
+ let attempts = 0;
26
+ while (usedIndices.has(finalIndex) && attempts < 9) {
27
+ finalIndex = ((finalIndex) % 9) + 1;
28
+ attempts++;
29
+ }
30
+
31
+ usedIndices.add(finalIndex);
32
+ return finalIndex;
33
+ };
34
+
12
35
  return (
13
36
  <Reveal headless={!!headless}>
14
37
  <div className={'pt-8 kyd-avoid-break'}>
15
38
  <h3 className={'text-2xl font-semibold mb-3'} style={{ color: 'var(--text-main)' }}>Potential Use Cases</h3>
16
39
  <div className={'grid grid-cols-1 md:grid-cols-2 gap-4'}>
17
- {items.map((uc, idx) => (
40
+ {items.map((uc, idx) => {
41
+ const imgIndex = getUniqueIndex(idx);
42
+ const imgSrc = `/badge/puzzle${imgIndex}.svg`;
43
+ return (
18
44
  <div key={idx} className={'rounded-md p-5 border'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' }}>
45
+ <div className={'flex items-center gap-3 pb-2'}>
46
+ <Image src={imgSrc} alt={''} width={36} height={36} style={{ flexShrink: 0 }} />
47
+ <div className={'font-semibold'} style={{ color: 'var(--text-main)' }}>{uc.title}</div>
48
+ </div>
19
49
  <div className={'font-semibold'} style={{ color: 'var(--text-main)' }}>{uc.title}</div>
20
50
  {uc.potential_impact ? (
21
51
  <div className={'text-sm mt-2'} style={{ color: 'var(--text-secondary)' }}>
@@ -36,7 +66,7 @@ export default function UseCases({ useCases, headless }: { useCases?: Enterprise
36
66
  </div>
37
67
  ) : null}
38
68
  </div>
39
- ))}
69
+ );})}
40
70
  </div>
41
71
  {note ? (
42
72
  <div className={'text-xs mt-3'} style={{ color: 'var(--text-secondary)' }}>{note}</div>