File size: 1,493 Bytes
5a264f5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
export const LEVEL_COLORS = {
  Minimal:  '#2dd4a5',
  Mild:     '#86efac',
  Moderate: '#fbbf24',
  Severe:   '#fb923c',
  Critical: '#f87171',
}

export const LEVEL_BG = {
  Minimal:  'rgba(45,212,165,.15)',
  Mild:     'rgba(134,239,172,.15)',
  Moderate: 'rgba(251,191,36,.15)',
  Severe:   'rgba(251,146,60,.15)',
  Critical: 'rgba(248,113,113,.15)',
}

export const STRESS_ICONS = {
  Minimal:  '🟢',
  Mild:     '🟡',
  Moderate: '🟠',
  Severe:   '🔴',
  Critical: '🚨',
}

export const ADVICE = {
  Minimal:  'Great job! Your stress levels are minimal. Keep up your healthy routines and sleep schedule.',
  Mild:     'Mild stress detected. Consider a short walk or 5-minute breathing exercise today.',
  Moderate: 'Moderate stress detected. Try scheduling a proper break, reduce screen time and stay hydrated.',
  Severe:   'High stress detected. Please prioritise rest, reach out to someone you trust, and consider reducing workload.',
  Critical: 'Critical stress indicators found. We strongly recommend speaking with a mental health professional. You are not alone.',
}

export const levelColor = l => LEVEL_COLORS[l] || '#5b9cf6'
export const levelBg    = l => LEVEL_BG[l]     || 'rgba(91,156,246,.15)'
export const stressIcon = l => STRESS_ICONS[l] || '⚪'

export function formatDate(iso) {
  if (!iso) return '—'
  return new Date(iso).toLocaleString(undefined, {
    year: 'numeric', month: 'short', day: 'numeric',
    hour: '2-digit', minute: '2-digit',
  })
}