kyd-shared-badge 0.3.123 → 0.3.124
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
|
@@ -147,6 +147,10 @@ export function ConnectProgress(props: ConnectProgressProps) {
|
|
|
147
147
|
|
|
148
148
|
const isPreviewing = previewPercent !== null && previewPercent !== undefined
|
|
149
149
|
const valueToShow = previewPercent ?? progressPercent
|
|
150
|
+
const centerIndicator = useMemo(() => {
|
|
151
|
+
if (previewPercent == null) return null as 'up' | 'down' | null
|
|
152
|
+
return previewPercent > progressPercent ? 'up' : previewPercent < progressPercent ? 'down' : null
|
|
153
|
+
}, [previewPercent, progressPercent])
|
|
150
154
|
|
|
151
155
|
const content = (
|
|
152
156
|
<Card className={`border-[var(--icon-button-secondary)] ${className || ''}`} style={{ backgroundColor: 'var(--content-card-background)'}}>
|
|
@@ -159,9 +163,11 @@ export function ConnectProgress(props: ConnectProgressProps) {
|
|
|
159
163
|
highlightFrom={isPreviewing ? undefined : selectedPulse.from}
|
|
160
164
|
highlightTo={isPreviewing ? undefined : selectedPulse.to}
|
|
161
165
|
highlightPulse={Boolean(selectedPulse.to) && !isPreviewing}
|
|
166
|
+
centerIndicator={centerIndicator}
|
|
167
|
+
indicatorPulse={Boolean(centerIndicator)}
|
|
162
168
|
/>
|
|
163
169
|
<div className="min-w-0 max-w-xs flex flex-col gap-2 items-start justify-start">
|
|
164
|
-
<div className="text-base font-semibold truncate text-[var(--text-main)]">{progressCopy.headline}</div>
|
|
170
|
+
<div className="text-base font-semibold truncate text-[var(--text-main)]">Profile Depth: {progressCopy.headline}</div>
|
|
165
171
|
<div className="text-sm text-[var(--text-secondary)]">
|
|
166
172
|
{progressCopy.body}
|
|
167
173
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { scoreToCssVar } from '../colors'
|
|
3
|
+
import { scoreToCssVar, red as redHex, green as greenHex } from '../colors'
|
|
4
|
+
import { ArrowUpIcon } from 'lucide-react'
|
|
4
5
|
|
|
5
6
|
export type ProgressCircleProps = {
|
|
6
7
|
value: number
|
|
@@ -13,10 +14,13 @@ export type ProgressCircleProps = {
|
|
|
13
14
|
highlightFrom?: number
|
|
14
15
|
highlightTo?: number
|
|
15
16
|
highlightPulse?: boolean
|
|
17
|
+
// Optional center indicator arrow: 'up' (green) or 'down' (red)
|
|
18
|
+
centerIndicator?: 'up' | 'down' | null
|
|
19
|
+
indicatorPulse?: boolean
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export function ProgressCircle(props: ProgressCircleProps) {
|
|
19
|
-
const { value, size = 72, thickness = 6, className, showLabel = true, label, highlightFrom, highlightTo, highlightPulse } = props
|
|
23
|
+
const { value, size = 72, thickness = 6, className, showLabel = true, label, highlightFrom, highlightTo, highlightPulse, centerIndicator, indicatorPulse } = props
|
|
20
24
|
|
|
21
25
|
const rawId = React.useId()
|
|
22
26
|
const gradientId = React.useMemo(() => `kyd-pc-${String(rawId).replace(/:/g, '')}` , [rawId])
|
|
@@ -33,6 +37,10 @@ export function ProgressCircle(props: ProgressCircleProps) {
|
|
|
33
37
|
const highlightOffset = hasHighlight ? circumference * (1 - toClamped / 100) : 0
|
|
34
38
|
|
|
35
39
|
const strokeColor = React.useMemo(() => scoreToCssVar(clamped), [clamped])
|
|
40
|
+
const indicatorColor = React.useMemo(() => {
|
|
41
|
+
if (!centerIndicator) return undefined
|
|
42
|
+
return centerIndicator === 'up' ? `var(--status-positive, ${greenHex})` : `var(--status-negative, ${redHex})`
|
|
43
|
+
}, [centerIndicator])
|
|
36
44
|
|
|
37
45
|
return (
|
|
38
46
|
<div className={`relative inline-flex items-center justify-center ${className || ''}`} style={{ width: size, height: size }}>
|
|
@@ -90,11 +98,15 @@ export function ProgressCircle(props: ProgressCircleProps) {
|
|
|
90
98
|
stroke={strokeColor}
|
|
91
99
|
strokeOpacity={0.15}
|
|
92
100
|
strokeWidth={2}
|
|
93
|
-
className="animate-pulse"
|
|
94
|
-
style={{ transition: 'stroke
|
|
101
|
+
// className="animate-pulse"
|
|
102
|
+
// style={{ transition: 'stroke 200ms ease, stroke-opacity 200ms ease' }}
|
|
95
103
|
/>
|
|
96
104
|
</svg>
|
|
97
|
-
|
|
105
|
+
{centerIndicator ? (
|
|
106
|
+
<div className={`absolute inset-0 flex items-center justify-center`} aria-hidden>
|
|
107
|
+
<ArrowUpIcon className="w-4 h-4 text-[var(--icon-accent)]" />
|
|
108
|
+
</div>
|
|
109
|
+
) : null}
|
|
98
110
|
</div>
|
|
99
111
|
)
|
|
100
112
|
}
|