eletrotupi / tcc/ frontend/constants/care-action-categories.ts0c53ce12780375681fbfe522a63114d3a835f630
2.0 KB | 54 lines Raw
1
import type { CareAction } from "@/lib/api/types";
2

3
export type CareActionMeta = {
4
  icon: string;
5
  color: string;
6
  iconBackground: string;
7
  label: string;
8
};
9

10
export const ACTIVITY_CATEGORIES: Record<string, CareActionMeta> = {
11
  WALK:       { icon: "directions-walk",  color: "#059669", iconBackground: "#D1FAE5", label: "Caminhada" },
12
  YOGA:       { icon: "self-improvement", color: "#7C3AED", iconBackground: "#EDE9FE", label: "Yoga" },
13
  GYM:        { icon: "fitness-center",   color: "#DC2626", iconBackground: "#FEE2E2", label: "Academia" },
14
  MEDITATION: { icon: "self-improvement", color: "#0891B2", iconBackground: "#CFFAFE", label: "Meditação" },
15
  SOCIAL:     { icon: "people",           color: "#D97706", iconBackground: "#FEF3C7", label: "Social" },
16
  CREATIVE:   { icon: "brush",            color: "#DB2777", iconBackground: "#FCE7F3", label: "Criativo" },
17
  OTHER:      { icon: "star",             color: "#6B7280", iconBackground: "#F3F4F6", label: "Atividade" },
18
};
19

20
export function getActivityCategory(type?: string): CareActionMeta {
21
  return ACTIVITY_CATEGORIES[type ?? "OTHER"] ?? ACTIVITY_CATEGORIES.OTHER;
22
}
23

24
const APPOINTMENT_LABELS: Record<string, string> = {
25
  ANALYST:       'Analista',
26
  PSYCHIATRIST:  'Psiquiatra',
27
  GP:            'Clínico',
28
  NUTRITIONIST:  'Nutricionista',
29
  PHYSIOTHERAPIST: 'Fisioterapeuta',
30
  OTHER:         'Consulta',
31
};
32

33
export function getCareActionMeta(ca: CareAction): CareActionMeta {
34
  switch (ca.type) {
35
    case 'APPOINTMENT':
36
      return {
37
        icon: 'psychology',
38
        color: '#1D4ED8',
39
        iconBackground: '#DBEAFE',
40
        label: APPOINTMENT_LABELS[ca.appointment?.type ?? ''] ?? 'Consulta',
41
      };
42
    case 'MEDICINE':
43
      return {
44
        icon: 'medication',
45
        color: '#7C3AED',
46
        iconBackground: '#EDE9FE',
47
        label: ca.medicineLog?.regimen?.name ?? 'Medicação',
48
      };
49
    case 'ACTIVITY':
50
      return getActivityCategory(ca.activity?.type);
51
    default:
52
      return { icon: 'star', color: '#6B7280', iconBackground: '#F3F4F6', label: 'Cuidado' };
53
  }
54
}