File size: 2,290 Bytes
b6c632c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6d3681
b6c632c
 
 
 
 
 
 
 
 
 
f6d3681
b6c632c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f6d3681
 
b6c632c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

/**
 * Merge Tailwind classes with proper precedence
 * @param  {...any} inputs 
 * @returns {string}
 */
export function cn(...inputs) {
  return twMerge(clsx(inputs));
}

/**
 * Format a score to one decimal place
 * @param {number} score 
 * @returns {string}
 */
export function formatScore(score) {
  return (score || 0).toFixed(1);
}

/**
 * Get score badge variant based on score value
 * @param {number} score 
 * @returns {'high' | 'mid' | 'low'}
 */
export function getScoreVariant(score) {
  if (score >= 7.5) return 'high';
  if (score >= 5.5) return 'mid';
  return 'low';
}

/**
 * Get color class for score
 * @param {number} score 
 * @returns {string}
 */
export function getScoreColor(score) {
  if (score >= 7.5) return 'text-ascent-blue';
  if (score >= 5.5) return 'text-semantic-warning';
  return 'text-semantic-error';
}

/**
 * Get background color class for score
 * @param {number} score 
 * @returns {string}
 */
export function getScoreBg(score) {
  if (score >= 7.5) return 'bg-ascent-blue-subtle';
  if (score >= 5.5) return 'bg-semantic-warning-bg';
  return 'bg-semantic-error-bg';
}

/**
 * Get verdict text based on score
 * @param {number} score 
 * @returns {string}
 */
export function getVerdict(score) {
  if (score >= 8) return 'EXCELLENT';
  if (score >= 6.5) return 'SOLID';
  if (score >= 5) return 'BORDERLINE';
  return 'NEEDS WORK';
}

/**
 * Get verdict color based on score
 * @param {number} score 
 * @returns {string}
 */
export function getVerdictColor(score) {
  if (score >= 8) return 'bg-ascent-blue-subtle text-ascent-blue';
  if (score >= 6.5) return 'bg-ascent-blue-subtle text-ascent-blue';
  if (score >= 5) return 'bg-semantic-warning-bg text-semantic-warning';
  return 'bg-semantic-error-bg text-semantic-error';
}

/**
 * Format duration in minutes to readable string
 * @param {number} minutes 
 * @returns {string}
 */
export function formatDuration(minutes) {
  return `${minutes} minute${minutes !== 1 ? 's' : ''}`;
}

/**
 * Stagger animation delay helper
 * @param {number} index 
 * @param {number} baseDelay 
 * @returns {object}
 */
export function staggerDelay(index, baseDelay = 80) {
  return { animationDelay: `${index * baseDelay}ms` };
}