All files / web/src/lib profile-variants.ts

0% Statements 0/28
0% Branches 0/1
0% Functions 0/1
0% Lines 0/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                                         
/**
 * Shared types and utilities for profile image sizeƗtheme variants.
 *
 * Lives outside both `character/` and `tasks/` to avoid circular dependencies
 * (the task handler imports from character, and character needs these types).
 */

export type ProfileSize = 'default' | 'sm' | 'lg'
export type ProfileTheme = 'default' | 'light' | 'dark'
export type ProfileState = 'idle' | 'speaking'

/**
 * Build the filename suffix for a size+theme+state combination.
 * Order: {size}-{state}-{theme}
 * Examples: '' (base idle), '-sm', '-light', '-sm-light', '-speaking', '-sm-speaking-light', '-lg-speaking-dark'
 * The 'idle' state produces no suffix addition, preserving all existing paths.
 */
export function getVariantSuffix(
  size: ProfileSize,
  theme: ProfileTheme,
  state: ProfileState = 'idle'
): string {
  const parts: string[] = []
  if (size !== 'default') parts.push(size)
  if (state !== 'idle') parts.push(state)
  if (theme !== 'default') parts.push(theme)
  return parts.length > 0 ? `-${parts.join('-')}` : ''
}