({
face,
state,
hasReadToday,
selected = false,
goalProgress,
motion = null,
motionKey = '',
emote = null,
emoteCount = 1,
emoteKey = 0,
showStreak = true,
}: PatchyRailIconProps)
| 241 | // little, like an avatar would. Inside the circle he's never quite still: |
| 242 | // blinks, glances, yawns (see patchyIdle). |
| 243 | export const PatchyRailIcon = ({ |
| 244 | face, |
| 245 | state, |
| 246 | hasReadToday, |
| 247 | selected = false, |
| 248 | goalProgress, |
| 249 | motion = null, |
| 250 | motionKey = '', |
| 251 | emote = null, |
| 252 | emoteCount = 1, |
| 253 | emoteKey = 0, |
| 254 | showStreak = true, |
| 255 | }: PatchyRailIconProps): ReactElement => { |
| 256 | let ringClass: string; |
| 257 | if (!showStreak) { |
| 258 | ringClass = selected |
| 259 | ? 'border-accent-bacon-default' |
| 260 | : 'border-border-subtlest-secondary group-hover/patchytab:border-text-primary'; |
| 261 | } else { |
| 262 | ringClass = classNames( |
| 263 | selected && (state === 'none' || state === 'pending') |
| 264 | ? 'border-accent-bacon-default' |
| 265 | : ringByState[state], |
| 266 | state === 'celebration' && 'animate-streak-earn-border', |
| 267 | HOVER_STATES.has(state) && |
| 268 | !(selected && state !== 'safe') && |
| 269 | 'group-hover/streaktab:border-text-primary', |
| 270 | ); |
| 271 | } |
| 272 | return ( |
| 273 | <span className="relative flex size-6 items-center justify-center"> |
| 274 | <span |
| 275 | aria-hidden |
| 276 | className={classNames( |
| 277 | 'absolute -inset-1 overflow-hidden rounded-full border-2 bg-surface-float transition-colors', |
| 278 | ringClass, |
| 279 | )} |
| 280 | > |
| 281 | <FaceImage face={face} motion={motion} motionKey={motionKey} /> |
| 282 | </span> |
| 283 | {/* The ring is the 32px box around the 24px glyph with a 2px border, so |
| 284 | the stroke centre sits at radius 16 - 1 = 15. */} |
| 285 | {showStreak && ( |
| 286 | <StreakGoalArc |
| 287 | state={state} |
| 288 | progress={goalProgress} |
| 289 | selected={selected} |
| 290 | size={32} |
| 291 | radius={15} |
| 292 | strokeWidth={2} |
| 293 | className="-left-1 -top-1 size-8" |
| 294 | /> |
| 295 | )} |
| 296 | {emote && <Emotes key={emoteKey} emote={emote} count={emoteCount} />} |
| 297 | {showStreak && ( |
| 298 | <span |
| 299 | aria-hidden |
| 300 | className="absolute -bottom-2 -right-2 flex size-4 items-center justify-center rounded-full bg-background-default" |
nothing calls this directly
no outgoing calls
no test coverage detected