File size: 2,958 Bytes
bf04727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Utility functions for InnerVoice

export function cn(...classes: (string | undefined | null | false)[]): string {
  return classes.filter(Boolean).join(" ");
}

export function getMoodEmoji(moodScore: number): string {
  if (moodScore >= 80) return "🌞";
  if (moodScore >= 65) return "🌤️";
  if (moodScore >= 50) return "⛅";
  if (moodScore >= 35) return "🌧️";
  return "⛈️";
}

export function getMoodLabel(moodScore: number): string {
  if (moodScore >= 80) return "Radiant";
  if (moodScore >= 65) return "Good";
  if (moodScore >= 50) return "Okay";
  if (moodScore >= 35) return "Low";
  return "Struggling";
}

export function getEmotionColor(emotion: string): string {
  const colors: Record<string, string> = {
    happy: "text-yellow-400",
    neutral: "text-blue-400",
    sad: "text-blue-300",
    angry: "text-red-400",
    fearful: "text-purple-300",
    anxious: "text-orange-400",
    disgust: "text-green-400",
    surprised: "text-pink-400",
  };
  return colors[emotion] ?? "text-gray-400";
}

export function getEmotionBg(emotion: string): string {
  const colors: Record<string, string> = {
    happy: "bg-yellow-500/20 border-yellow-500/40",
    neutral: "bg-blue-500/20 border-blue-500/40",
    sad: "bg-blue-300/20 border-blue-300/40",
    angry: "bg-red-500/20 border-red-500/40",
    fearful: "bg-purple-300/20 border-purple-300/40",
    anxious: "bg-orange-500/20 border-orange-500/40",
  };
  return colors[emotion] ?? "bg-gray-500/20 border-gray-500/40";
}

export function getSeverityColor(severity: string): string {
  const map: Record<string, string> = {
    info: "border-blue-500/40 bg-blue-500/10",
    warning: "border-yellow-500/40 bg-yellow-500/10",
    concern: "border-orange-500/40 bg-orange-500/10",
    urgent: "border-red-500/40 bg-red-500/10",
  };
  return map[severity] ?? "border-gray-500/40 bg-gray-500/10";
}

export function getSeverityIcon(severity: string): string {
  const map: Record<string, string> = {
    info: "💙",
    warning: "⚠️",
    concern: "🟠",
    urgent: "🔴",
  };
  return map[severity] ?? "ℹ️";
}

export function getScoreColor(score: number): string {
  if (score >= 70) return "#22c55e"; // green
  if (score >= 50) return "#eab308"; // yellow
  if (score >= 30) return "#f97316"; // orange
  return "#ef4444"; // red
}

export function formatDate(dateStr: string): string {
  const d = new Date(dateStr);
  return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
}

export function formatTime(dateStr: string): string {
  const d = new Date(dateStr);
  return d.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" });
}

export function getGreeting(): string {
  const hour = new Date().getHours();
  if (hour < 12) return "Good morning";
  if (hour < 17) return "Good afternoon";
  return "Good evening";
}

export function capitalise(str: string): string {
  return str.charAt(0).toUpperCase() + str.slice(1);
}