| 1 | import { MaterialIcons } from "@expo/vector-icons";
|
| 2 | import type { CareAction } from "@/lib/api/types";
|
| 3 |
|
| 4 | export type CareActionMeta = {
|
| 5 | icon: keyof typeof MaterialIcons.glyphMap;
|
| 6 | color: string;
|
| 7 | iconBackground: string;
|
| 8 | label: string;
|
| 9 | };
|
| 10 |
|
| 11 | export const ACTIVITY_CATEGORIES: Record<string, CareActionMeta> = {
|
| 12 | WALK: { icon: "directions-walk", color: "#059669", iconBackground: "#D1FAE5", label: "Caminhada" },
|
| 13 | YOGA: { icon: "self-improvement", color: "#7C3AED", iconBackground: "#EDE9FE", label: "Yoga" },
|
| 14 | GYM: { icon: "fitness-center", color: "#DC2626", iconBackground: "#FEE2E2", label: "Academia" },
|
| 15 | MEDITATION: { icon: "self-improvement", color: "#0891B2", iconBackground: "#CFFAFE", label: "Meditação" },
|
| 16 | SOCIAL: { icon: "people", color: "#D97706", iconBackground: "#FEF3C7", label: "Social" },
|
| 17 | CREATIVE: { icon: "brush", color: "#DB2777", iconBackground: "#FCE7F3", label: "Criativo" },
|
| 18 | OTHER: { icon: "star", color: "#6B7280", iconBackground: "#F3F4F6", label: "Atividade" },
|
| 19 | };
|
| 20 |
|
| 21 | export function getActivityCategory(type?: string): CareActionMeta {
|
| 22 | return ACTIVITY_CATEGORIES[type ?? "OTHER"] ?? ACTIVITY_CATEGORIES.OTHER;
|
| 23 | }
|
| 24 |
|
| 25 | const APPOINTMENT_LABELS: Record<string, string> = {
|
| 26 | ANALYST: 'Analista',
|
| 27 | PSYCHIATRIST: 'Psiquiatra',
|
| 28 | GP: 'Clínico',
|
| 29 | NUTRITIONIST: 'Nutricionista',
|
| 30 | PHYSIOTHERAPIST: 'Fisioterapeuta',
|
| 31 | OTHER: 'Consulta',
|
| 32 | };
|
| 33 |
|
| 34 | export function getCareActionMeta(ca: CareAction): CareActionMeta {
|
| 35 | switch (ca.type) {
|
| 36 | case 'APPOINTMENT':
|
| 37 | return {
|
| 38 | icon: 'psychology',
|
| 39 | color: '#1D4ED8',
|
| 40 | iconBackground: '#DBEAFE',
|
| 41 | label: APPOINTMENT_LABELS[ca.appointment?.type ?? ''] ?? 'Consulta',
|
| 42 | };
|
| 43 | case 'MEDICINE':
|
| 44 | return {
|
| 45 | icon: 'medication',
|
| 46 | color: '#7C3AED',
|
| 47 | iconBackground: '#EDE9FE',
|
| 48 | label: ca.medicineLog?.regimen?.name ?? 'Medicação',
|
| 49 | };
|
| 50 | case 'ACTIVITY':
|
| 51 | return getActivityCategory(ca.activity?.type);
|
| 52 | default:
|
| 53 | return { icon: 'star', color: '#6B7280', iconBackground: '#F3F4F6', label: 'Cuidado' };
|
| 54 | }
|
| 55 | }
|