@jjlmoya/utils-babies 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tool/baby-feeding-calculator/component.astro +40 -40
- package/src/tool/baby-percentile-calculator/component.astro +38 -38
- package/src/tool/baby-size-converter/component.astro +42 -42
- package/src/tool/fertile-days-estimator/component.astro +14 -9
- package/src/tool/pregnancy-calculator/component.astro +55 -48
- package/src/tool/pregnancy-calculator/i18n/en.ts +140 -0
- package/src/tool/pregnancy-calculator/i18n/es.ts +143 -3
- package/src/tool/pregnancy-calculator/i18n/fr.ts +143 -3
- package/src/tool/pregnancy-calculator/index.ts +24 -0
- package/src/tool/pregnancy-calculator/milestones.ts +2 -146
- package/src/tool/vaccination-calendar/component.astro +26 -24
- package/src/tool/vaccination-calendar/i18n/en.ts +20 -0
- package/src/tool/vaccination-calendar/i18n/es.ts +20 -0
- package/src/tool/vaccination-calendar/i18n/fr.ts +20 -0
- package/src/tool/vaccination-calendar/index.ts +20 -0
- package/src/tool/vaccination-calendar/logic.ts +39 -13
|
@@ -1,150 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
analogies: { fruits: string; geek: string; sweets: string };
|
|
3
|
-
size: string;
|
|
4
|
-
biolook: string;
|
|
5
|
-
mom: string;
|
|
6
|
-
partner: string;
|
|
7
|
-
symptoms: string[];
|
|
8
|
-
alerts: string[];
|
|
9
|
-
wonder: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const milestones: Record<number, Milestone> = {
|
|
13
|
-
4: {
|
|
14
|
-
analogies: { fruits: 'Semilla de amapola', geek: 'Píxel solitario', sweets: 'Granito de azúcar' },
|
|
15
|
-
size: '~1 mm',
|
|
16
|
-
biolook: 'El blastocisto se implanta en el endometrio. Aparecen las tres capas embrionarias que formarán todos tus órganos.',
|
|
17
|
-
mom: 'Tu cuerpo aún no sabe que está embarazada, pero ya produce hCG. Quizá sientas un leve sangrado de implantación.',
|
|
18
|
-
partner: 'Puede que ella esté más cansada de lo habitual sin saber por qué. Es buen momento para cocinar su cena favorita.',
|
|
19
|
-
symptoms: ['Fatiga temprana', 'Tensión en el pecho', 'Ligero sangrado de implantación'],
|
|
20
|
-
alerts: ['Sangrado abundante rojo', 'Dolor pélvico agudo', 'Fiebre mayor de 38 grados'],
|
|
21
|
-
wonder: 'En este momento se decide si habrá uno o dos bebés.'
|
|
22
|
-
},
|
|
23
|
-
6: {
|
|
24
|
-
analogies: { fruits: 'Lenteja', geek: 'LED parpadeante', sweets: 'Lacasito' },
|
|
25
|
-
size: '~6 mm',
|
|
26
|
-
biolook: 'El corazón empieza a latir de forma irregular pero visible en ecografía. El tubo neural se cierra.',
|
|
27
|
-
mom: 'Las náuseas matutinas pueden comenzar ahora.',
|
|
28
|
-
partner: 'El olfato de ella se vuelve sobrehumano. Evita perfumes fuertes y cocinar pescado en casa.',
|
|
29
|
-
symptoms: ['Náuseas', 'Hipersensibilidad al olfato', 'Somnolencia extrema'],
|
|
30
|
-
alerts: ['Ausencia de latido en eco vaginal', 'Manchado oscuro persistente', 'Vómitos sin retención'],
|
|
31
|
-
wonder: 'Ya tiene la misma estructura cerebral básica que tendrá de adulto.'
|
|
32
|
-
},
|
|
33
|
-
8: {
|
|
34
|
-
analogies: { fruits: 'Frambuesa', geek: 'Memoria USB nano', sweets: 'Gominola de oso' },
|
|
35
|
-
size: '~18 mm',
|
|
36
|
-
biolook: 'Los dedos de manos y pies se separan. Los párpados cubren los ojos. El corazón late 150-170 veces por minuto.',
|
|
37
|
-
mom: 'Tu útero tiene el tamaño de un pomelo. Las náuseas están en su punto álgido.',
|
|
38
|
-
partner: 'Ella puede necesitar dormir 10-12 horas. Asume las tareas del hogar.',
|
|
39
|
-
symptoms: ['Náuseas intensas', 'Aumento de saliva', 'Micción muy frecuente'],
|
|
40
|
-
alerts: ['Vómitos incoercibles', 'Manchado oscuro', 'Dolor lumbar intenso'],
|
|
41
|
-
wonder: 'Si tocas la barriga de ella, él ya reacciona y se mueve.'
|
|
42
|
-
},
|
|
43
|
-
10: {
|
|
44
|
-
analogies: { fruits: 'Kumquat', geek: 'AirPod', sweets: 'Macarón' },
|
|
45
|
-
size: '~31 mm',
|
|
46
|
-
biolook: 'Técnicamente ya es un feto. Todos los órganos existen en forma rudimentaria. Las uñas empiezan a crecer.',
|
|
47
|
-
mom: 'Tu cintura empieza a ensancharse.',
|
|
48
|
-
partner: 'Acompáñala a la primera consulta del primer trimestre.',
|
|
49
|
-
symptoms: ['Hinchazón abdominal', 'Cambios bruscos de humor', 'Piel más sensible al sol'],
|
|
50
|
-
alerts: ['Pérdida de líquido claro', 'Calambres uterinos intensos', 'Fiebre sin causa aparente'],
|
|
51
|
-
wonder: 'Ya tiene su propio tipo de sangre, diferente al de su madre.'
|
|
52
|
-
},
|
|
53
|
-
12: {
|
|
54
|
-
analogies: { fruits: 'Ciruela', geek: 'Ratón inalámbrico', sweets: 'Mochi de fresa' },
|
|
55
|
-
size: '~55 mm',
|
|
56
|
-
biolook: 'Los órganos principales están formados. El bebé empieza a practicar movimientos de deglución.',
|
|
57
|
-
mom: 'El riesgo de aborto espontáneo cae drásticamente.',
|
|
58
|
-
partner: 'El segundo trimestre se acerca. El cansancio de ella mejorará pronto.',
|
|
59
|
-
symptoms: ['Reducción de las náuseas', 'Piel más luminosa o con manchas', 'Dolores de cabeza'],
|
|
60
|
-
alerts: ['Pérdida de líquido', 'Calambres fuertes', 'Fiebre persistente'],
|
|
61
|
-
wonder: 'Sus reflejos ya funcionan: si le tocas la palma de la mano, cierra el puño.'
|
|
62
|
-
},
|
|
63
|
-
16: {
|
|
64
|
-
analogies: { fruits: 'Aguacate', geek: 'Mando de PS5', sweets: 'Berlina de chocolate' },
|
|
65
|
-
size: '~12 cm',
|
|
66
|
-
biolook: 'Las orejas están en su posición final. El esqueleto de cartílago se convierte en hueso.',
|
|
67
|
-
mom: 'Muchas mamás sienten los primeros movimientos. La energía vuelve.',
|
|
68
|
-
partner: 'Puede que empiece a sentir pequeños movimientos.',
|
|
69
|
-
symptoms: ['Ardor de estómago leve', 'Congestión nasal', 'Sueños muy vividos'],
|
|
70
|
-
alerts: ['Ausencia total de movimientos fetales', 'Tensión alta', 'Sangrado vaginal'],
|
|
71
|
-
wonder: 'Si es niña, ya tiene 6 millones de óvulos en sus ovarios.'
|
|
72
|
-
},
|
|
73
|
-
20: {
|
|
74
|
-
analogies: { fruits: 'Plátano', geek: 'Consola de juegos portátil', sweets: 'Tarta de queso entera' },
|
|
75
|
-
size: '~25 cm',
|
|
76
|
-
biolook: 'El bebé ya oye tu voz con claridad. Se chupa el dedo.',
|
|
77
|
-
mom: 'Semana 20, ecuador. Es el momento de la ecografía morfológica.',
|
|
78
|
-
partner: 'Habla al bebé. Ya te oye.',
|
|
79
|
-
symptoms: ['Ardor de estómago frecuente', 'Hinchazón de pies al final del día', 'Picor en la piel del abdomen'],
|
|
80
|
-
alerts: ['Falta de movimientos fetales', 'Tensión arterial alta sostenida', 'Visión borrosa o con destellos'],
|
|
81
|
-
wonder: 'Sus huellas dactilares ya están completas y son únicas en el universo.'
|
|
82
|
-
},
|
|
83
|
-
24: {
|
|
84
|
-
analogies: { fruits: 'Mazorca de maíz', geek: 'Teclado mecánico', sweets: 'Donut gigante' },
|
|
85
|
-
size: '~30 cm',
|
|
86
|
-
biolook: 'Los pulmones producen surfactante. Los ojos empiezan a abrirse.',
|
|
87
|
-
mom: 'Tu útero llega al ombligo. La espalda puede empezar a resentirse.',
|
|
88
|
-
partner: 'Aprende los signos de parto pretérmino.',
|
|
89
|
-
symptoms: ['Dolor de espalda baja', 'Calambres en las piernas por la noche', 'Línea negra en el abdomen'],
|
|
90
|
-
alerts: ['Contracciones regulares antes de la semana 37', 'Pérdida de líquido amniótico', 'Sangrado vaginal'],
|
|
91
|
-
wonder: 'Si nace ahora, con cuidados intensivos, tiene posibilidades de sobrevivir.'
|
|
92
|
-
},
|
|
93
|
-
28: {
|
|
94
|
-
analogies: { fruits: 'Berenjena', geek: 'Tableta gráfica', sweets: 'Tarta de tres pisos' },
|
|
95
|
-
size: '~37 cm',
|
|
96
|
-
biolook: 'El bebé abre y cierra los ojos. Tiene ciclos de sueño y vigilia.',
|
|
97
|
-
mom: 'Empieza el tercer trimestre. La prueba de glucosa es ahora.',
|
|
98
|
-
partner: 'El insomnio puede agotarla. Acompáñala.',
|
|
99
|
-
symptoms: ['Insomnio y dificultad para encontrar postura', 'Hinchazón de manos y pies', 'Contracciones Braxton Hicks esporádicas'],
|
|
100
|
-
alerts: ['Reducción marcada de movimientos fetales', 'Dolor de cabeza intenso que no cede', 'Visión con luces o moscas'],
|
|
101
|
-
wonder: 'Ya tiene un sabor favorito.'
|
|
102
|
-
},
|
|
103
|
-
32: {
|
|
104
|
-
analogies: { fruits: 'Calabaza mediana', geek: 'Teclado de 60%', sweets: 'Caja de bombones entera' },
|
|
105
|
-
size: '~42 cm',
|
|
106
|
-
biolook: 'Practica la respiración. Sus pulmones están casi listos para el mundo exterior.',
|
|
107
|
-
mom: 'Recuperar el aliento es difícil. El bebé presiona el diafragma.',
|
|
108
|
-
partner: 'Prepara la bolsa del hospital.',
|
|
109
|
-
symptoms: ['Falta de aliento al esfuerzo mínimo', 'Hemorroides', 'Pérdida de orina al reír o toser'],
|
|
110
|
-
alerts: ['Picor intenso en palmas de manos y plantas de pies', 'Contracciones regulares', 'Dolor en boca del estómago con náuseas'],
|
|
111
|
-
wonder: 'Ya gira la cabeza hacia la luz que atraviesa la barriga de su madre.'
|
|
112
|
-
},
|
|
113
|
-
36: {
|
|
114
|
-
analogies: { fruits: 'Melón cantalupo', geek: 'Portátil de 15 pulgadas', sweets: 'Tarta de cumpleaños' },
|
|
115
|
-
size: '~47 cm',
|
|
116
|
-
biolook: 'El bebé suele encajarse cabeza abajo. Sus pulmones están casi maduros.',
|
|
117
|
-
mom: 'Sientes presión en la pelvis al encajarse el bebé.',
|
|
118
|
-
partner: 'El plan de parto debería estar listo.',
|
|
119
|
-
symptoms: ['Presión pélvica intensa', 'Vuelta del ardor de estómago', 'Ansiedad anticipatoria'],
|
|
120
|
-
alerts: ['Rotura de bolsa', 'Sangrado vaginal rojo', 'Ausencia de movimientos fetales'],
|
|
121
|
-
wonder: 'Ya tiene las uñas tan largas que podría arañarse al nacer.'
|
|
122
|
-
},
|
|
123
|
-
40: {
|
|
124
|
-
analogies: { fruits: 'Sandía', geek: 'PC de sobremesa completo', sweets: 'Tarta nupcial de 3 pisos' },
|
|
125
|
-
size: '~50 cm',
|
|
126
|
-
biolook: 'Todo está listo. Sus reflejos están coordinados, sus pulmones maduros, su cerebro activo.',
|
|
127
|
-
mom: 'El cansancio es máximo. Eres increíble.',
|
|
128
|
-
partner: 'Hoy puede que sea el día. Mantén el teléfono cargado y la calma que ella necesita de ti.',
|
|
129
|
-
symptoms: ['Presión pélvica muy intensa', 'Pérdida del tapón mucoso', 'Contracciones irregulares'],
|
|
130
|
-
alerts: ['Contracciones regulares cada 5 minutos durante 1 hora', 'Rotura de bolsa', 'Ausencia de movimientos'],
|
|
131
|
-
wonder: 'Su cerebro ha creado 100 mil millones de neuronas durante estos 9 meses.'
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export const timelineLabels: Record<number, string> = {
|
|
136
|
-
4: 'Implantación', 5: 'Latido', 6: 'Corazón late', 7: 'Ojos y oídos',
|
|
137
|
-
8: 'Dedos', 9: 'Uñas', 10: 'Ya es feto', 11: 'Movimientos',
|
|
138
|
-
12: 'Triple Screening', 13: '2º Trimestre', 14: 'Cuello de útero', 15: 'Patadas',
|
|
139
|
-
16: 'Oye voces', 17: 'Grasa corporal', 18: 'Genitales visibles', 19: 'Vérnix',
|
|
140
|
-
20: 'Eco morfológica', 21: 'Huellas dactilares', 22: 'Labios formados', 23: 'Párpados',
|
|
141
|
-
24: 'Ojos se abren', 25: 'Capilares', 26: 'Reflejos', 27: 'Cerebro activo',
|
|
142
|
-
28: '3er Trimestre', 29: 'Huesos fuertes', 30: 'Médula ósea', 31: 'Surfactante',
|
|
143
|
-
32: 'Practica respirar', 33: 'Inmunidad', 34: 'Sistema nervioso', 35: 'Encajamiento',
|
|
144
|
-
36: 'Pulmones maduros', 37: 'A término', 38: 'Preparado', 39: 'Esperando', 40: 'Llegó el día'
|
|
145
|
-
};
|
|
1
|
+
import type { MilestoneI18n } from './index';
|
|
146
2
|
|
|
147
|
-
export function getMilestone(week: number):
|
|
3
|
+
export function getMilestone(week: number, milestones: Record<number, MilestoneI18n>): MilestoneI18n {
|
|
148
4
|
const keys = Object.keys(milestones).map(Number).sort((a, b) => b - a);
|
|
149
5
|
for (const k of keys) {
|
|
150
6
|
if (week >= k) return milestones[k]!;
|
|
@@ -63,7 +63,7 @@ const { ui } = Astro.props;
|
|
|
63
63
|
import type { DoseGroup } from './logic';
|
|
64
64
|
|
|
65
65
|
const root = document.getElementById('vc-root') as HTMLElement;
|
|
66
|
-
const ui = JSON.parse(root.dataset.ui
|
|
66
|
+
const ui = root.dataset.ui ? JSON.parse(root.dataset.ui) : {} as Record<string, string>;
|
|
67
67
|
|
|
68
68
|
const ddInput = document.getElementById('vc-dd') as HTMLInputElement;
|
|
69
69
|
const mmInput = document.getElementById('vc-mm') as HTMLInputElement;
|
|
@@ -80,7 +80,7 @@ const { ui } = Astro.props;
|
|
|
80
80
|
const btnReminder = document.getElementById('vc-btn-reminder') as HTMLButtonElement;
|
|
81
81
|
const shareLink = document.getElementById('vc-share-link') as HTMLAnchorElement;
|
|
82
82
|
|
|
83
|
-
const doseGroups = buildDoseGroups();
|
|
83
|
+
const doseGroups = buildDoseGroups(ui);
|
|
84
84
|
let currentBirthDate: Date | null = null;
|
|
85
85
|
|
|
86
86
|
function parseInputDate(): Date | null {
|
|
@@ -99,7 +99,8 @@ const { ui } = Astro.props;
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
function formatDate(date: Date): string {
|
|
102
|
-
|
|
102
|
+
const locale = document.documentElement.lang || 'es-ES';
|
|
103
|
+
return new Intl.DateTimeFormat(locale, { day: '2-digit', month: 'long', year: 'numeric' }).format(date);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
function buildTimelineRow(group: DoseGroup, _birthDate: Date, isPast: boolean): HTMLElement {
|
|
@@ -108,7 +109,7 @@ const { ui } = Astro.props;
|
|
|
108
109
|
|
|
109
110
|
const ageEl = document.createElement('span');
|
|
110
111
|
ageEl.className = 'vc-timeline-age';
|
|
111
|
-
ageEl.textContent = getAgeLabel(group.months);
|
|
112
|
+
ageEl.textContent = getAgeLabel(group.months, ui);
|
|
112
113
|
|
|
113
114
|
const vacEl = document.createElement('div');
|
|
114
115
|
vacEl.className = 'vc-timeline-vac';
|
|
@@ -173,7 +174,7 @@ const { ui } = Astro.props;
|
|
|
173
174
|
root.classList.toggle('vc-is-today', isToday);
|
|
174
175
|
nextDateEl.textContent = isToday
|
|
175
176
|
? (ui['btnToday'] ?? '¡Hoy!')
|
|
176
|
-
: `${getAgeLabel(next.months)} — ${formatDate(target)}`;
|
|
177
|
+
: `${getAgeLabel(next.months, ui)} — ${formatDate(target)}`;
|
|
177
178
|
|
|
178
179
|
next.vaccines.forEach((name, idx) => {
|
|
179
180
|
const item = document.createElement('div');
|
|
@@ -192,7 +193,7 @@ const { ui } = Astro.props;
|
|
|
192
193
|
function updateDisplay(birthDate: Date): void {
|
|
193
194
|
const today = new Date();
|
|
194
195
|
today.setHours(0, 0, 0, 0);
|
|
195
|
-
ageBadge.textContent = calculateAge(birthDate, today);
|
|
196
|
+
ageBadge.textContent = calculateAge(birthDate, today, ui);
|
|
196
197
|
ageBadge.classList.add('vc-age-visible');
|
|
197
198
|
root.classList.add('vc-active');
|
|
198
199
|
emptyEl.style.display = 'none';
|
|
@@ -248,7 +249,7 @@ const { ui } = Astro.props;
|
|
|
248
249
|
|
|
249
250
|
btnReminder?.addEventListener('click', () => {
|
|
250
251
|
if (!currentBirthDate) return;
|
|
251
|
-
const ics = buildIcsContent(currentBirthDate, doseGroups);
|
|
252
|
+
const ics = buildIcsContent(currentBirthDate, doseGroups, ui);
|
|
252
253
|
const blob = new Blob([ics], { type: 'text/calendar' });
|
|
253
254
|
const url = URL.createObjectURL(blob);
|
|
254
255
|
const a = document.createElement('a');
|
|
@@ -308,7 +309,8 @@ const { ui } = Astro.props;
|
|
|
308
309
|
--border: rgba(255, 255, 255, 0.1);
|
|
309
310
|
--text-main: #f1f5f9;
|
|
310
311
|
--text-muted: #94a3b8;
|
|
311
|
-
--primary
|
|
312
|
+
--primary: #a5b4fc;
|
|
313
|
+
--primary-soft: rgba(79, 70, 229, 0.15);
|
|
312
314
|
}
|
|
313
315
|
|
|
314
316
|
.vc-header {
|
|
@@ -480,7 +482,7 @@ const { ui } = Astro.props;
|
|
|
480
482
|
margin-bottom: 2rem;
|
|
481
483
|
}
|
|
482
484
|
|
|
483
|
-
.vc-vac-item {
|
|
485
|
+
:global(.vc-vac-item) {
|
|
484
486
|
display: flex;
|
|
485
487
|
align-items: center;
|
|
486
488
|
gap: 1rem;
|
|
@@ -492,7 +494,7 @@ const { ui } = Astro.props;
|
|
|
492
494
|
transition: 0.2s;
|
|
493
495
|
}
|
|
494
496
|
|
|
495
|
-
.vc-vac-icon {
|
|
497
|
+
:global(.vc-vac-icon) {
|
|
496
498
|
width: 48px;
|
|
497
499
|
height: 48px;
|
|
498
500
|
display: flex;
|
|
@@ -506,15 +508,15 @@ const { ui } = Astro.props;
|
|
|
506
508
|
flex-shrink: 0;
|
|
507
509
|
}
|
|
508
510
|
|
|
509
|
-
:global(.theme-dark) .vc-vac-icon {
|
|
511
|
+
:global(.theme-dark) :global(.vc-vac-icon) {
|
|
510
512
|
background: #0f172a;
|
|
511
513
|
}
|
|
512
514
|
|
|
513
|
-
.vc-vac-info {
|
|
515
|
+
:global(.vc-vac-info) {
|
|
514
516
|
flex: 1;
|
|
515
517
|
}
|
|
516
518
|
|
|
517
|
-
.vc-vac-name {
|
|
519
|
+
:global(.vc-vac-name) {
|
|
518
520
|
display: block;
|
|
519
521
|
font-weight: 700;
|
|
520
522
|
font-size: 1rem;
|
|
@@ -586,7 +588,7 @@ const { ui } = Astro.props;
|
|
|
586
588
|
gap: 0.5rem;
|
|
587
589
|
}
|
|
588
590
|
|
|
589
|
-
.vc-timeline-row {
|
|
591
|
+
:global(.vc-timeline-row) {
|
|
590
592
|
display: flex;
|
|
591
593
|
justify-content: space-between;
|
|
592
594
|
align-items: center;
|
|
@@ -595,11 +597,11 @@ const { ui } = Astro.props;
|
|
|
595
597
|
font-size: 0.9rem;
|
|
596
598
|
}
|
|
597
599
|
|
|
598
|
-
.vc-timeline-row:last-child {
|
|
600
|
+
:global(.vc-timeline-row:last-child) {
|
|
599
601
|
border-bottom: none;
|
|
600
602
|
}
|
|
601
603
|
|
|
602
|
-
.vc-timeline-age {
|
|
604
|
+
:global(.vc-timeline-age) {
|
|
603
605
|
font-weight: 800;
|
|
604
606
|
color: var(--primary);
|
|
605
607
|
width: 6.5rem;
|
|
@@ -609,7 +611,7 @@ const { ui } = Astro.props;
|
|
|
609
611
|
letter-spacing: 0.02em;
|
|
610
612
|
}
|
|
611
613
|
|
|
612
|
-
.vc-timeline-vac {
|
|
614
|
+
:global(.vc-timeline-vac) {
|
|
613
615
|
flex: 1;
|
|
614
616
|
font-weight: 600;
|
|
615
617
|
color: var(--text-main);
|
|
@@ -619,7 +621,7 @@ const { ui } = Astro.props;
|
|
|
619
621
|
padding: 0 0.5rem;
|
|
620
622
|
}
|
|
621
623
|
|
|
622
|
-
.vc-vac-pill {
|
|
624
|
+
:global(.vc-vac-pill) {
|
|
623
625
|
padding: 0.15rem 0.5rem;
|
|
624
626
|
background: var(--primary-soft);
|
|
625
627
|
border-radius: 6px;
|
|
@@ -629,12 +631,12 @@ const { ui } = Astro.props;
|
|
|
629
631
|
}
|
|
630
632
|
|
|
631
633
|
:global(.theme-dark) .vc-vac-pill {
|
|
632
|
-
background:
|
|
633
|
-
color: var(--
|
|
634
|
-
border
|
|
634
|
+
background: var(--primary-soft);
|
|
635
|
+
color: var(--primary);
|
|
636
|
+
border: 1px solid var(--primary-soft);
|
|
635
637
|
}
|
|
636
638
|
|
|
637
|
-
.vc-timeline-status {
|
|
639
|
+
:global(.vc-timeline-status) {
|
|
638
640
|
font-size: 0.65rem;
|
|
639
641
|
font-weight: 900;
|
|
640
642
|
text-transform: uppercase;
|
|
@@ -644,11 +646,11 @@ const { ui } = Astro.props;
|
|
|
644
646
|
letter-spacing: 0.05em;
|
|
645
647
|
}
|
|
646
648
|
|
|
647
|
-
.vc-check {
|
|
649
|
+
:global(.vc-check) {
|
|
648
650
|
color: var(--success);
|
|
649
651
|
}
|
|
650
652
|
|
|
651
|
-
.vc-clock {
|
|
653
|
+
:global(.vc-clock) {
|
|
652
654
|
color: var(--warning);
|
|
653
655
|
}
|
|
654
656
|
|
|
@@ -95,6 +95,26 @@ export const content: VaccinationCalendarLocaleContent = {
|
|
|
95
95
|
labelShare: 'Share these dates',
|
|
96
96
|
faqTitle: 'Frequently asked questions',
|
|
97
97
|
bibliographyTitle: 'References',
|
|
98
|
+
labelMonth: 'month',
|
|
99
|
+
labelMonths: 'months',
|
|
100
|
+
labelYear: 'year',
|
|
101
|
+
labelYears: 'years',
|
|
102
|
+
labelDay: 'day',
|
|
103
|
+
labelDays: 'days',
|
|
104
|
+
labelAnd: 'and',
|
|
105
|
+
labelVaccination: 'Vaccination',
|
|
106
|
+
labelAppointment: 'Vaccination appointment',
|
|
107
|
+
vac_hexavalente: 'Hexavalent',
|
|
108
|
+
vac_neumococo: 'Pneumococcal (PCV15/20)',
|
|
109
|
+
vac_meningococo_b: 'Meningococcal B (Bexsero)',
|
|
110
|
+
vac_rotavirus: 'Rotavirus',
|
|
111
|
+
vac_meningococo_acwy: 'Meningococcal ACWY',
|
|
112
|
+
vac_triple_virica: 'MMR (Measles, Mumps, Rubella)',
|
|
113
|
+
vac_varicela: 'Varicella (Chickenpox)',
|
|
114
|
+
vac_gripe: 'Flu (Seasonal)',
|
|
115
|
+
vac_vph: 'HPV (Papillomavirus)',
|
|
116
|
+
vac_tdpa: 'Tdap (Tetanus, Diphtheria, Pertussis)',
|
|
117
|
+
vac_polio_booster: 'Polio (Booster)',
|
|
98
118
|
},
|
|
99
119
|
seo: [
|
|
100
120
|
{ type: 'title', text: "Baby Vaccination Calculator: When Is My Child's Next Dose?", level: 2 },
|
|
@@ -99,6 +99,26 @@ export const content: VaccinationCalendarLocaleContent = {
|
|
|
99
99
|
labelShare: 'Compartir estas fechas',
|
|
100
100
|
faqTitle: 'Preguntas frecuentes',
|
|
101
101
|
bibliographyTitle: 'Referencias',
|
|
102
|
+
labelMonth: 'mes',
|
|
103
|
+
labelMonths: 'meses',
|
|
104
|
+
labelYear: 'año',
|
|
105
|
+
labelYears: 'años',
|
|
106
|
+
labelDay: 'día',
|
|
107
|
+
labelDays: 'días',
|
|
108
|
+
labelAnd: 'y',
|
|
109
|
+
labelVaccination: 'Vacunación',
|
|
110
|
+
labelAppointment: 'Cita de vacunación',
|
|
111
|
+
vac_hexavalente: 'Hexavalente',
|
|
112
|
+
vac_neumococo: 'Neumococo (VCN15/20)',
|
|
113
|
+
vac_meningococo_b: 'Meningococo B (Bexsero)',
|
|
114
|
+
vac_rotavirus: 'Rotavirus',
|
|
115
|
+
vac_meningococo_acwy: 'Meningococo ACWY',
|
|
116
|
+
vac_triple_virica: 'Triple Vírica (SRP)',
|
|
117
|
+
vac_varicela: 'Varicela',
|
|
118
|
+
vac_gripe: 'Gripe (Estacional)',
|
|
119
|
+
vac_vph: 'VPH (Papiloma)',
|
|
120
|
+
vac_tdpa: 'Tdpa (Tétanos, Difteria, Tosferina)',
|
|
121
|
+
vac_polio_booster: 'Polio (Refuerzo)',
|
|
102
122
|
},
|
|
103
123
|
seo: [
|
|
104
124
|
{ type: 'title', text: 'Calculadora de Vacunas: ¿Cuándo le toca la próxima a mi hijo?', level: 2 },
|
|
@@ -95,6 +95,26 @@ export const content: VaccinationCalendarLocaleContent = {
|
|
|
95
95
|
labelShare: "Partager ces dates",
|
|
96
96
|
faqTitle: "Questions fréquentes",
|
|
97
97
|
bibliographyTitle: "Références",
|
|
98
|
+
labelMonth: "mois",
|
|
99
|
+
labelMonths: "mois",
|
|
100
|
+
labelYear: "an",
|
|
101
|
+
labelYears: "ans",
|
|
102
|
+
labelDay: "jour",
|
|
103
|
+
labelDays: "jours",
|
|
104
|
+
labelAnd: "et",
|
|
105
|
+
labelVaccination: "Vaccination",
|
|
106
|
+
labelAppointment: "Rendez-vous de vaccination",
|
|
107
|
+
vac_hexavalente: "Hexavalent",
|
|
108
|
+
vac_neumococo: "Pneumocoque (VCN15/20)",
|
|
109
|
+
vac_meningococo_b: "Méningocoque B (Bexsero)",
|
|
110
|
+
vac_rotavirus: "Rotavirus",
|
|
111
|
+
vac_meningococo_acwy: "Méningocoque ACWY",
|
|
112
|
+
vac_triple_virica: "ROR (Rougeole, Oreillons, Rubéole)",
|
|
113
|
+
vac_varicela: "Varicelle",
|
|
114
|
+
vac_gripe: "Grippe (Saisonnière)",
|
|
115
|
+
vac_vph: "HPV (Papillomavirus)",
|
|
116
|
+
vac_tdpa: "dTca (Diphthérie, Tétanos, Coqueluche)",
|
|
117
|
+
vac_polio_booster: "Polio (Rappel)",
|
|
98
118
|
},
|
|
99
119
|
seo: [
|
|
100
120
|
{ type: 'title', text: "Calculateur de vaccins : quand est le prochain rendez-vous de mon enfant ?", level: 2 },
|
|
@@ -23,6 +23,26 @@ export interface VaccinationCalendarUI {
|
|
|
23
23
|
labelShare: string;
|
|
24
24
|
faqTitle: string;
|
|
25
25
|
bibliographyTitle: string;
|
|
26
|
+
labelMonth: string;
|
|
27
|
+
labelMonths: string;
|
|
28
|
+
labelYear: string;
|
|
29
|
+
labelYears: string;
|
|
30
|
+
labelDay: string;
|
|
31
|
+
labelDays: string;
|
|
32
|
+
labelAnd: string;
|
|
33
|
+
labelVaccination: string;
|
|
34
|
+
labelAppointment: string;
|
|
35
|
+
vac_hexavalente: string;
|
|
36
|
+
vac_neumococo: string;
|
|
37
|
+
vac_meningococo_b: string;
|
|
38
|
+
vac_rotavirus: string;
|
|
39
|
+
vac_meningococo_acwy: string;
|
|
40
|
+
vac_triple_virica: string;
|
|
41
|
+
vac_varicela: string;
|
|
42
|
+
vac_gripe: string;
|
|
43
|
+
vac_vph: string;
|
|
44
|
+
vac_tdpa: string;
|
|
45
|
+
vac_polio_booster: string;
|
|
26
46
|
}
|
|
27
47
|
|
|
28
48
|
export type VaccinationCalendarLocaleContent = ToolLocaleContent<VaccinationCalendarUI>;
|
|
@@ -5,12 +5,13 @@ export interface DoseGroup {
|
|
|
5
5
|
vaccines: string[];
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export function buildDoseGroups(): DoseGroup[] {
|
|
8
|
+
export function buildDoseGroups(ui: Record<string, string>): DoseGroup[] {
|
|
9
9
|
const groups: Record<number, string[]> = {};
|
|
10
10
|
VACCINES.forEach((vac) => {
|
|
11
|
+
const name = ui[`vac_${vac.id}`]!;
|
|
11
12
|
vac.doses.forEach((d) => {
|
|
12
13
|
if (!groups[d]) groups[d] = [];
|
|
13
|
-
groups[d].push(
|
|
14
|
+
groups[d].push(name);
|
|
14
15
|
});
|
|
15
16
|
});
|
|
16
17
|
return Object.entries(groups)
|
|
@@ -18,16 +19,29 @@ export function buildDoseGroups(): DoseGroup[] {
|
|
|
18
19
|
.sort((a, b) => a.months - b.months);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export function getAgeLabel(months: number): string {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
export function getAgeLabel(months: number, ui: Record<string, string>): string {
|
|
23
|
+
const labelMonth = ui['labelMonth'];
|
|
24
|
+
const labelMonths = ui['labelMonths'];
|
|
25
|
+
const labelYear = ui['labelYear'];
|
|
26
|
+
const labelYears = ui['labelYears'];
|
|
27
|
+
|
|
28
|
+
if (months < 12) return `${months} ${months === 1 ? labelMonth : labelMonths}`;
|
|
29
|
+
if (months === 12) return `12 ${labelMonths} (1 ${labelYear})`;
|
|
24
30
|
const yrs = Math.floor(months / 12);
|
|
25
31
|
const rem = months % 12;
|
|
26
|
-
if (rem === 0) return `${yrs} ${yrs === 1 ?
|
|
27
|
-
return `${months}
|
|
32
|
+
if (rem === 0) return `${yrs} ${yrs === 1 ? labelYear : labelYears}`;
|
|
33
|
+
return `${months} ${labelMonths}`;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
|
-
export function calculateAge(birthDate: Date, today: Date): string {
|
|
36
|
+
export function calculateAge(birthDate: Date, today: Date, ui: Record<string, string>): string {
|
|
37
|
+
const labelMonth = ui['labelMonth'];
|
|
38
|
+
const labelMonths = ui['labelMonths'];
|
|
39
|
+
const labelYear = ui['labelYear'];
|
|
40
|
+
const labelYears = ui['labelYears'];
|
|
41
|
+
const labelDay = ui['labelDay'];
|
|
42
|
+
const labelDays = ui['labelDays'];
|
|
43
|
+
const labelAnd = ui['labelAnd'];
|
|
44
|
+
|
|
31
45
|
let years = today.getFullYear() - birthDate.getFullYear();
|
|
32
46
|
let months = today.getMonth() - birthDate.getMonth();
|
|
33
47
|
let days = today.getDate() - birthDate.getDate();
|
|
@@ -40,19 +54,31 @@ export function calculateAge(birthDate: Date, today: Date): string {
|
|
|
40
54
|
years -= 1;
|
|
41
55
|
months += 12;
|
|
42
56
|
}
|
|
43
|
-
|
|
44
|
-
|
|
57
|
+
const mStr = `${months} ${months === 1 ? labelMonth : labelMonths}`;
|
|
58
|
+
const dStr = `${days} ${days === 1 ? labelDay : labelDays}`;
|
|
59
|
+
if (years === 0) return `${mStr} ${labelAnd} ${dStr}`;
|
|
60
|
+
const yStr = `${years} ${years === 1 ? labelYear : labelYears}`;
|
|
61
|
+
return `${yStr}, ${mStr} ${labelAnd} ${dStr}`;
|
|
45
62
|
}
|
|
46
63
|
|
|
47
|
-
export function buildIcsContent(birthDate: Date, doseGroups: DoseGroup[]): string {
|
|
64
|
+
export function buildIcsContent(birthDate: Date, doseGroups: DoseGroup[], ui: Record<string, string>): string {
|
|
65
|
+
const labelVaccination = ui['labelVaccination'];
|
|
66
|
+
const labelAppointment = ui['labelAppointment'];
|
|
67
|
+
const labelMonth = ui['labelMonth'];
|
|
68
|
+
const labelMonths = ui['labelMonths'];
|
|
69
|
+
const labelYear = ui['labelYear'];
|
|
70
|
+
const labelYears = ui['labelYears'];
|
|
71
|
+
|
|
48
72
|
let ics = 'BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:-//jjlmoya//VaxCal//ES\n';
|
|
49
73
|
doseGroups.forEach(({ months, vaccines }) => {
|
|
50
74
|
const target = new Date(birthDate);
|
|
51
75
|
target.setMonth(target.getMonth() + months);
|
|
52
76
|
if (target <= new Date()) return;
|
|
53
77
|
const dateStr = target.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
|
|
54
|
-
const label = months >= 12
|
|
55
|
-
|
|
78
|
+
const label = months >= 12
|
|
79
|
+
? `${Math.floor(months / 12)} ${Math.floor(months / 12) === 1 ? labelYear : labelYears}`
|
|
80
|
+
: `${months} ${months === 1 ? labelMonth : labelMonths}`;
|
|
81
|
+
ics += `BEGIN:VEVENT\nDTSTART:${dateStr}\nSUMMARY:${labelVaccination} ${label}: ${vaccines.join(', ')}\nDESCRIPTION:${labelAppointment}\nEND:VEVENT\n`;
|
|
56
82
|
});
|
|
57
83
|
ics += 'END:VCALENDAR';
|
|
58
84
|
return ics;
|