All files / lib/verification colors.ts

86.66% Statements 91/105
100% Branches 4/4
50% Functions 2/4
86.66% Lines 91/105

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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159                                1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x         1x 7x 7x         1x 7x 7x                               1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x   1x 1x 1x 1x 1x   1x 1x 1x 1x 1x         1x                                 1x      
/**
 * Verification Badge Color Configuration
 *
 * Defines colors for different verification levels and types
 */
 
export type VerificationLevel = 'account' | 'government' | 'professional' | 'reputation';
 
export interface LevelColorScheme {
  bg: string;
  text: string;
  border: string;
  icon: string;
  headerBg: string;
}
 
export const LEVEL_COLORS: Record<VerificationLevel, LevelColorScheme> = {
  account: {
    bg: 'bg-blue-50 dark:bg-blue-950/30',
    text: 'text-blue-700 dark:text-blue-300',
    border: 'border-blue-200 dark:border-blue-800',
    icon: 'text-blue-600 dark:text-blue-400',
    headerBg: 'bg-blue-100/50 dark:bg-blue-900/30',
  },
  government: {
    bg: 'bg-emerald-50 dark:bg-emerald-950/30',
    text: 'text-emerald-700 dark:text-emerald-300',
    border: 'border-emerald-200 dark:border-emerald-800',
    icon: 'text-emerald-600 dark:text-emerald-400',
    headerBg: 'bg-emerald-100/50 dark:bg-emerald-900/30',
  },
  professional: {
    bg: 'bg-purple-50 dark:bg-purple-950/30',
    text: 'text-purple-700 dark:text-purple-300',
    border: 'border-purple-200 dark:border-purple-800',
    icon: 'text-purple-600 dark:text-purple-400',
    headerBg: 'bg-purple-100/50 dark:bg-purple-900/30',
  },
  reputation: {
    bg: 'bg-amber-50 dark:bg-amber-950/30',
    text: 'text-amber-700 dark:text-amber-300',
    border: 'border-amber-200 dark:border-amber-800',
    icon: 'text-amber-600 dark:text-amber-400',
    headerBg: 'bg-amber-100/50 dark:bg-amber-900/30',
  },
};
 
export const LEVEL_NAMES: Record<VerificationLevel, string> = {
  account: 'Account',
  government: 'Government ID',
  professional: 'Professional',
  reputation: 'Reputation',
};
 
export const LEVEL_DESCRIPTIONS: Record<VerificationLevel, string> = {
  account: 'Basic account verification',
  government: 'Government-issued ID verified',
  professional: 'Professional credentials verified',
  reputation: 'Reputation and endorsements',
};
 
export const LEVEL_ORDER: VerificationLevel[] = [
  'account',
  'government',
  'professional',
  'reputation',
];
 
/**
 * Get color scheme for a verification level
 */
export function getLevelColors(level: string): LevelColorScheme {
  return LEVEL_COLORS[level as VerificationLevel] || LEVEL_COLORS.account;
}
 
/**
 * Get display name for a verification level
 */
export function getLevelName(level: string): string {
  return LEVEL_NAMES[level as VerificationLevel] || level;
}
 
// ============================================================
// 3-Tier Display System
// Maps 4 DB levels into 3 visual tiers for public-facing UI
// ============================================================
 
export type DisplayTier = 'account_verified' | 'identity_verified' | 'proof_of_work_verified';
 
export interface DisplayTierColorScheme {
  bg: string;
  text: string;
  border: string;
  icon: string;
}
 
export const DISPLAY_TIER_COLORS: Record<DisplayTier, DisplayTierColorScheme> = {
  account_verified: {
    bg: 'bg-blue-50 dark:bg-blue-950/30',
    text: 'text-blue-700 dark:text-blue-300',
    border: 'border-blue-200 dark:border-blue-800',
    icon: 'text-blue-600 dark:text-blue-400',
  },
  identity_verified: {
    bg: 'bg-amber-50 dark:bg-amber-950/30',
    text: 'text-amber-700 dark:text-amber-300',
    border: 'border-amber-200 dark:border-amber-800',
    icon: 'text-amber-600 dark:text-amber-400',
  },
  proof_of_work_verified: {
    bg: 'bg-lime-50 dark:bg-lime-950/30',
    text: 'text-lime-700 dark:text-lime-300',
    border: 'border-lime-200 dark:border-lime-800',
    icon: 'text-lime-500 dark:text-lime-400',
  },
};
 
export const DISPLAY_TIER_NAMES: Record<DisplayTier, string> = {
  account_verified: 'Account Verified',
  identity_verified: 'Identity Verified',
  proof_of_work_verified: 'Proof-of-Work Verified',
};
 
export const DISPLAY_TIER_DESCRIPTIONS: Record<DisplayTier, string> = {
  account_verified: 'Email, phone, or social login confirmed',
  identity_verified: 'Real-person identity validated via government ID',
  proof_of_work_verified: 'Work and credentials verified by ProofID',
};
 
export const DISPLAY_TIER_ORDER: DisplayTier[] = [
  'account_verified',
  'identity_verified',
  'proof_of_work_verified',
];
 
/**
 * Map a DB verification level to a display tier
 */
export function mapLevelToDisplayTier(level: VerificationLevel): DisplayTier {
  switch (level) {
    case 'account':
      return 'account_verified';
    case 'government':
      return 'identity_verified';
    case 'professional':
    case 'reputation':
      return 'proof_of_work_verified';
    default:
      return 'account_verified';
  }
}
 
/**
 * Get color scheme for a display tier
 */
export function getDisplayTierColors(tier: DisplayTier): DisplayTierColorScheme {
  return DISPLAY_TIER_COLORS[tier] || DISPLAY_TIER_COLORS.account_verified;
}