@jjlmoya/utils-alcohol 1.1.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.
Files changed (62) hide show
  1. package/package.json +60 -0
  2. package/src/category/i18n/en.ts +19 -0
  3. package/src/category/i18n/es.ts +28 -0
  4. package/src/category/i18n/fr.ts +19 -0
  5. package/src/category/index.ts +12 -0
  6. package/src/category/seo.astro +15 -0
  7. package/src/components/PreviewNavSidebar.astro +116 -0
  8. package/src/components/PreviewToolbar.astro +143 -0
  9. package/src/data.ts +11 -0
  10. package/src/env.d.ts +5 -0
  11. package/src/index.ts +19 -0
  12. package/src/layouts/PreviewLayout.astro +117 -0
  13. package/src/pages/[locale]/[slug].astro +155 -0
  14. package/src/pages/[locale].astro +271 -0
  15. package/src/pages/index.astro +4 -0
  16. package/src/tests/content_mandatory.test.ts +32 -0
  17. package/src/tests/faq_count.test.ts +17 -0
  18. package/src/tests/mocks/astro_mock.js +2 -0
  19. package/src/tests/seo_length.test.ts +39 -0
  20. package/src/tests/tool_validation.test.ts +17 -0
  21. package/src/tool/alcoholClearance/component.astro +219 -0
  22. package/src/tool/alcoholClearance/component.css +369 -0
  23. package/src/tool/alcoholClearance/i18n/en.ts +172 -0
  24. package/src/tool/alcoholClearance/i18n/es.ts +181 -0
  25. package/src/tool/alcoholClearance/i18n/fr.ts +163 -0
  26. package/src/tool/alcoholClearance/index.ts +50 -0
  27. package/src/tool/alcoholClearance/logic.ts +59 -0
  28. package/src/tool/beerCooler/component.astro +236 -0
  29. package/src/tool/beerCooler/component.css +381 -0
  30. package/src/tool/beerCooler/i18n/en.ts +168 -0
  31. package/src/tool/beerCooler/i18n/es.ts +181 -0
  32. package/src/tool/beerCooler/i18n/fr.ts +168 -0
  33. package/src/tool/beerCooler/index.ts +49 -0
  34. package/src/tool/beerCooler/logic.ts +34 -0
  35. package/src/tool/carbonationCalculator/component.astro +225 -0
  36. package/src/tool/carbonationCalculator/component.css +483 -0
  37. package/src/tool/carbonationCalculator/i18n/en.ts +175 -0
  38. package/src/tool/carbonationCalculator/i18n/es.ts +179 -0
  39. package/src/tool/carbonationCalculator/i18n/fr.ts +175 -0
  40. package/src/tool/carbonationCalculator/index.ts +48 -0
  41. package/src/tool/carbonationCalculator/logic.ts +40 -0
  42. package/src/tool/cocktailBalancer/bibliography.astro +14 -0
  43. package/src/tool/cocktailBalancer/component.astro +396 -0
  44. package/src/tool/cocktailBalancer/component.css +1218 -0
  45. package/src/tool/cocktailBalancer/data/IngredientRepository.ts +83 -0
  46. package/src/tool/cocktailBalancer/data/Presets.ts +122 -0
  47. package/src/tool/cocktailBalancer/domain/Ingredient.ts +29 -0
  48. package/src/tool/cocktailBalancer/i18n/en.ts +193 -0
  49. package/src/tool/cocktailBalancer/i18n/es.ts +193 -0
  50. package/src/tool/cocktailBalancer/i18n/fr.ts +193 -0
  51. package/src/tool/cocktailBalancer/index.ts +68 -0
  52. package/src/tool/cocktailBalancer/logic.ts +118 -0
  53. package/src/tool/cocktailBalancer/seo.astro +53 -0
  54. package/src/tool/partyKeg/component.astro +269 -0
  55. package/src/tool/partyKeg/component.css +660 -0
  56. package/src/tool/partyKeg/i18n/en.ts +162 -0
  57. package/src/tool/partyKeg/i18n/es.ts +166 -0
  58. package/src/tool/partyKeg/i18n/fr.ts +162 -0
  59. package/src/tool/partyKeg/index.ts +46 -0
  60. package/src/tool/partyKeg/logic.ts +36 -0
  61. package/src/tools.ts +14 -0
  62. package/src/types.ts +72 -0
@@ -0,0 +1,168 @@
1
+ import type { WithContext, SoftwareApplication } from 'schema-dts';
2
+ import type { BeerCoolerUI, BeerCoolerLocaleContent } from '../index';
3
+
4
+ const slug = 'beer-cooler';
5
+ const title = 'Beer Cooling Calculator';
6
+ const description = 'Calculate how long it takes for your beer to cool down in the fridge or freezer based on its container.';
7
+
8
+ const ui: BeerCoolerUI = {
9
+ step1Title: 'What are you cooling?',
10
+ canLabel: 'Can',
11
+ aluminumLabel: 'Aluminum',
12
+ bottleLabel: 'Bottle',
13
+ glassLabel: 'Glass',
14
+ step2Title: 'Where do you put it?',
15
+ fridgeLabel: 'Fridge',
16
+ freezerLabel: 'Freezer',
17
+ step3Title: 'Fine-tune Temperatures',
18
+ initialTempLabel: 'Initial Temp',
19
+ targetTempLabel: 'Cold Goal',
20
+ glacialLabel: 'Glacial',
21
+ perfectLabel: 'Perfect',
22
+ bodegaLabel: 'Bodega',
23
+ readyTitle: 'Ready',
24
+ readyDescription: 'Select container and location to calculate.',
25
+ estimatedTimeLabel: 'Estimated time',
26
+ methodLabel: 'Method',
27
+ containerLabel: 'Container',
28
+ alreadyColdLabel: 'Already cold!',
29
+ neverColdLabel: 'Never cold'
30
+ };
31
+
32
+ const faqTitle = 'Frequently Asked Questions';
33
+ const bibliographyTitle = 'Bibliography & Sources';
34
+
35
+ const faq: BeerCoolerLocaleContent['faq'] = [
36
+ {
37
+ question: "Does beer 'burn' if cooled too fast?",
38
+ answer: "No. The myth of beer 'burning' from heat shock is false. What can affect it is repeated freezing and thawing, which breaks proteins and clouds the liquid, or leaving it in the sun (UV rays).",
39
+ },
40
+ {
41
+ question: "Why does foam spray out if the beer is warm?",
42
+ answer: "Henry's Law. The solubility of CO2 decreases as temperature increases. In a warm beer, the gas is 'desperate' to escape. When opened, the pressure drops and the gas expands violently.",
43
+ },
44
+ {
45
+ question: "What is the ideal serving temperature for different beer styles?",
46
+ answer: "It depends on the style. Lagers and Pilsners are best served between 3°C and 7°C. IPAs and Pale Ales shine at 7°C to 10°C. Stouts, Porters and complex ales should be served warmer, around 10°C to 13°C, so their aromatic compounds can fully open up.",
47
+ },
48
+ ];
49
+
50
+ const howTo: BeerCoolerLocaleContent['howTo'] = [
51
+ {
52
+ name: "Select the container",
53
+ text: "Choose between an aluminum can or a glass bottle. The material drastically affects the heat transfer speed.",
54
+ },
55
+ {
56
+ name: "Choose the cooling method",
57
+ text: "Indicate whether you're using a conventional fridge (4°C) or a freezer (-18°C) for an ultra-fast process.",
58
+ },
59
+ {
60
+ name: "Adjust temperatures",
61
+ text: "Define the current temperature of the drink (room temp) and your desired target cold temperature.",
62
+ },
63
+ ];
64
+
65
+ const bibliography: BeerCoolerLocaleContent['bibliography'] = [
66
+ {
67
+ name: "Newton's Law of Cooling - Physics Hypertextbook",
68
+ url: "https://physics.info/newton-cooling/",
69
+ },
70
+ {
71
+ name: "The Science of Better Beer - American Chemical Society",
72
+ url: "https://www.acs.org/content/acs/en/pressroom/reactions/videos/2016/the-science-of-better-beer.html",
73
+ },
74
+ ];
75
+
76
+ const seo: BeerCoolerLocaleContent['seo'] = [
77
+ {
78
+ type: 'title',
79
+ text: 'The Science of Cold and Thermodynamics',
80
+ level: 2
81
+ },
82
+ {
83
+ type: 'paragraph',
84
+ html: 'Why does that can cool down before the bottle? Is it magic? No, it is <strong>Newton\'s Law of Cooling</strong> in action. This tool mathematically calculates the exact moment your drink reaches thermodynamic perfection. Every material, every environment, every starting temperature feeds into the same differential equation that physicists and engineers use to model heat transfer in industrial systems.'
85
+ },
86
+ {
87
+ type: 'diagnostic',
88
+ title: 'The Master Formula',
89
+ icon: 'mdi:function-variant',
90
+ variant: 'info',
91
+ badge: 'Physics',
92
+ html: 'T(t) = T_env + (T_0 - T_env) * e^(-kt). This differential equation describes how an object\'s temperature changes proportionally to the difference between its temperature and that of the environment. The constant k depends on the material and geometry of the container, which is why a can cools faster than a bottle of the same volume.'
93
+ },
94
+ {
95
+ type: 'title',
96
+ text: 'Material Wars: Aluminum vs. Glass',
97
+ level: 2
98
+ },
99
+ {
100
+ type: 'paragraph',
101
+ html: '<strong>Aluminum</strong> has a thermal conductivity of ~205 W/(m·K), while <strong>glass</strong> barely reaches 0.8 W/(m·K). Metal transfers cold violently fast, making it the ideal container for emergencies. However, glass provides better insulation once cold, maintaining the ideal temperature for longer during consumption. This trade-off is why different beer cultures have evolved preferences for each material.'
102
+ },
103
+ {
104
+ type: 'stats',
105
+ items: [
106
+ { label: 'Pilsner & Lager', value: '3°C - 7°C', icon: 'mdi:snowflake' },
107
+ { label: 'IPA & Pale Ale', value: '7°C - 10°C', icon: 'mdi:hops' },
108
+ { label: 'Stout & Porter', value: '10°C - 13°C', icon: 'mdi:beer' }
109
+ ],
110
+ columns: 3
111
+ },
112
+ {
113
+ type: 'card',
114
+ title: 'The Freezer Danger Zone',
115
+ icon: 'mdi:snowflake-alert',
116
+ html: 'Due to alcohol and dissolved sugars, beer freezes below 0°C — a standard 5% lager freezes around -3°C. As water crystallizes it expands, while CO2 pressure rises simultaneously. The result is a container that can rupture violently. Never leave a beer in the freezer for more than 45 minutes without setting a timer.'
117
+ },
118
+ {
119
+ type: 'proscons',
120
+ title: 'Emergency Chilling Hacks',
121
+ items: [
122
+ { pro: 'Wet Paper Trick: Wrap the can in wet paper towel, then freeze — evaporation accelerates cooling.', con: '' },
123
+ { pro: 'Arctic Brine: Fill a bucket with water, ice and 2 tablespoons of salt to reach -5°C brine.', con: '' },
124
+ { pro: 'Spinning Method: Rotate the bottle in iced water to force convection and shorten cooling time.', con: '' },
125
+ { pro: '', con: 'Do not place a can directly on a freezer shelf without a timer — ruptured cans are messy and dangerous.' }
126
+ ]
127
+ },
128
+ {
129
+ type: 'tip',
130
+ title: 'Pro Tip: Pre-chill the Glass',
131
+ html: 'The glass you serve beer into has a significant thermal mass. A warm glass can raise the temperature of a perfectly cold beer by 2-3°C instantly on contact. Place your serving glass in the freezer for 5 minutes before pouring, or rinse it with cold water. This simple step extends the window where your beer tastes exactly as intended.'
132
+ },
133
+ {
134
+ type: 'title',
135
+ text: 'Understanding the Cooling Constant',
136
+ level: 2
137
+ },
138
+ {
139
+ type: 'paragraph',
140
+ html: 'The cooling constant k in Newton\'s equation is not a fixed universal value — it is an empirical property of each specific container and medium. A thin aluminum can in ice water has a dramatically different k than a thick glass bottle in still refrigerator air. Our calculator uses measured values calibrated against real-world experiments for each container type, giving you predictions accurate to within a few minutes for typical household cooling scenarios.'
141
+ }
142
+ ];
143
+
144
+ const schemas: BeerCoolerLocaleContent['schemas'] = [
145
+ {
146
+ '@context': 'https://schema.org',
147
+ '@type': 'SoftwareApplication',
148
+ name: title,
149
+ description: description,
150
+ applicationCategory: 'UtilityApplication',
151
+ operatingSystem: 'Web',
152
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
153
+ } as WithContext<SoftwareApplication>,
154
+ ];
155
+
156
+ export const content: BeerCoolerLocaleContent = {
157
+ slug,
158
+ title,
159
+ description,
160
+ ui,
161
+ seo,
162
+ faqTitle,
163
+ faq,
164
+ bibliographyTitle,
165
+ bibliography,
166
+ howTo,
167
+ schemas,
168
+ };
@@ -0,0 +1,181 @@
1
+ import type { WithContext, SoftwareApplication } from 'schema-dts';
2
+ import type { BeerCoolerUI, BeerCoolerLocaleContent } from '../index';
3
+
4
+ const slug = 'enfriador-cerveza';
5
+ const title = 'Calculadora de Enfriamiento de Cerveza';
6
+ const description = 'Calcula cuánto tiempo tarda tu cerveza en enfriarse en la nevera o el congelador según el envase.';
7
+
8
+ const ui: BeerCoolerUI = {
9
+ step1Title: '¿Qué vas a enfriar?',
10
+ canLabel: 'Lata',
11
+ aluminumLabel: 'Aluminio',
12
+ bottleLabel: 'Botella',
13
+ glassLabel: 'Vidrio',
14
+ step2Title: '¿Dónde la pones?',
15
+ fridgeLabel: 'Nevera',
16
+ freezerLabel: 'Congelador',
17
+ step3Title: 'Afinar Temperaturas',
18
+ initialTempLabel: 'Temperatura Inicial',
19
+ targetTempLabel: 'Meta Fría',
20
+ glacialLabel: 'Glacial',
21
+ perfectLabel: 'Perfecta',
22
+ bodegaLabel: 'Bodega',
23
+ readyTitle: 'Todo listo',
24
+ readyDescription: 'Selecciona envase y lugar para calcular.',
25
+ estimatedTimeLabel: 'Hora estimada',
26
+ methodLabel: 'Método',
27
+ containerLabel: 'Envase',
28
+ alreadyColdLabel: '¡Ya está fría!',
29
+ neverColdLabel: 'Nunca llegará'
30
+ };
31
+
32
+ const faqTitle = 'Preguntas Frecuentes';
33
+ const bibliographyTitle = 'Bibliografía y Fuentes';
34
+
35
+ const faq: BeerCoolerLocaleContent['faq'] = [
36
+ {
37
+ question: "¿La cerveza se 'quema' si se enfría muy rápido?",
38
+ answer: "No. El mito de 'quemar' la cerveza por choque térmico es falso. Lo que sí puede afectarla es congelarla y descongelarla repetidamente, lo que rompe las proteínas y enturbia el líquido, o dejarla al sol (UV).",
39
+ },
40
+ {
41
+ question: "¿Por qué la espuma sale disparada si está caliente?",
42
+ answer: "Ley de Henry. La solubilidad del CO2 disminuye al aumentar la temperatura. En una cerveza caliente, el gas está 'desesperado' por escapar. Al abrirla, la presión baja y el gas se expande violentamente.",
43
+ },
44
+ {
45
+ question: "¿Cuál es la temperatura de servicio ideal según el estilo de cerveza?",
46
+ answer: "Depende del estilo. Las Lagers y Pilsners están mejor entre 3°C y 7°C. Las IPAs y Pale Ales brillan entre 7°C y 10°C. Las Stouts, Porters y ales complejas deben servirse más cálidas, entre 10°C y 13°C, para que sus compuestos aromáticos se abran completamente.",
47
+ },
48
+ ];
49
+
50
+ const howTo: BeerCoolerLocaleContent['howTo'] = [
51
+ {
52
+ name: "Seleccionar el envase",
53
+ text: "Elige entre lata de aluminio o botella de vidrio. El material afecta drásticamente la velocidad de transferencia de calor.",
54
+ },
55
+ {
56
+ name: "Elegir el método de enfriamiento",
57
+ text: "Indica si vas a usar una nevera convencional (4°C) o un congelador (-18°C) para un proceso ultra rápido.",
58
+ },
59
+ {
60
+ name: "Ajustar temperaturas",
61
+ text: "Define la temperatura actual de la bebida (ambiente) y la temperatura objetivo deseada para el consumo.",
62
+ },
63
+ ];
64
+
65
+ const bibliography: BeerCoolerLocaleContent['bibliography'] = [
66
+ {
67
+ name: "Newton's Law of Cooling - Physics Hypertextbook",
68
+ url: "https://physics.info/newton-cooling/",
69
+ },
70
+ {
71
+ name: "The Science of Better Beer - American Chemical Society",
72
+ url: "https://www.acs.org/content/acs/en/pressroom/reactions/videos/2016/the-science-of-better-beer.html",
73
+ },
74
+ ];
75
+
76
+ const seo: BeerCoolerLocaleContent['seo'] = [
77
+ {
78
+ type: 'title',
79
+ text: 'La Ciencia del Frío y la Termodinámica',
80
+ level: 2
81
+ },
82
+ {
83
+ type: 'paragraph',
84
+ html: '¿Por qué esa lata se enfría antes que la botella? ¿Es magia? No, es la <strong>Ley del Enfriamiento de Newton</strong> en acción. Esta herramienta calcula matemáticamente el momento exacto en que tu bebida alcanza la perfección termodinámica.'
85
+ },
86
+ {
87
+ type: 'diagnostic',
88
+ title: 'La Fórmula Maestra',
89
+ icon: 'mdi:function-variant',
90
+ variant: 'info',
91
+ badge: 'Física',
92
+ html: 'T(t) = T_env + (T_0 - T_env) * e^(-kt). Esta ecuación diferencial describe cómo la temperatura de un objeto cambia proporcionalmente a la diferencia entre su temperatura y la del ambiente.'
93
+ },
94
+ {
95
+ type: 'title',
96
+ text: 'Guerra de Materiales: Aluminio vs Vidrio',
97
+ level: 2
98
+ },
99
+ {
100
+ type: 'paragraph',
101
+ html: 'El <strong>aluminio</strong> tiene una conductividad térmica de ~205 W/(m·K), mientras que el <strong>vidrio</strong> apenas llega a 0.8 W/(m·K). El metal transfiere el frío violentamente rápido, lo que lo convierte en el envase ideal para emergencias.'
102
+ },
103
+ {
104
+ type: 'stats',
105
+ items: [
106
+ { label: 'Pilsner & Lager', value: '3°C - 7°C', icon: 'mdi:snowflake' },
107
+ { label: 'IPA & Pale Ale', value: '7°C - 10°C', icon: 'mdi:hops' },
108
+ { label: 'Stout & Porter', value: '10°C - 13°C', icon: 'mdi:beer' }
109
+ ],
110
+ columns: 3
111
+ },
112
+ {
113
+ type: 'card',
114
+ title: '¿A qué temperatura explota?',
115
+ icon: 'mdi:snowflake-alert',
116
+ html: 'Debido al alcohol y los azúcares, el punto de congelación desciende. Una Lager al 5% se congela a unos -3°C. Al cristalizarse, el agua se expande y el CO2 aumenta la presión interna hasta que el envase cede.'
117
+ },
118
+ {
119
+ type: 'proscons',
120
+ title: 'Hacks de Enfriamiento Rápido',
121
+ items: [
122
+ { pro: 'La Momia Húmeda: Envuelve la botella en papel mojado con sal.', con: '' },
123
+ { pro: 'Salmuera del Ártico: Agua + Hielo + Sal para bajar a -21°C.', con: '' },
124
+ { pro: 'El Giroscopio: Haz girar la botella en agua con hielo para forzar la convección.', con: '' },
125
+ { pro: '', con: 'No olvides la cerveza en el congelador más de 60 minutos.' }
126
+ ]
127
+ },
128
+ {
129
+ type: 'tip',
130
+ title: 'Consejo Pro: Pre-enfría el Vaso',
131
+ html: 'El vaso en el que sirves la cerveza tiene una masa térmica significativa. Un vaso caliente puede subir la temperatura de una cerveza perfectamente fría en 2-3°C al instante. Mete el vaso de servicio en el congelador 5 minutos antes de servir, o enjuágalo con agua fría. Este simple paso prolonga la ventana en que tu cerveza sabe exactamente como debe.'
132
+ },
133
+ {
134
+ type: 'summary',
135
+ title: '¿Para quién es esta herramienta?',
136
+ items: [
137
+ 'Cerveceros caseros: Para saber exactamente cuándo su lote estará listo para el consumo.',
138
+ 'Anfitriones de eventos: Para planificar el tiempo de enfriado antes de que lleguen los invitados.',
139
+ 'Curiosos de la ciencia: Para entender la física detrás de algo tan cotidiano como enfriar una cerveza.'
140
+ ]
141
+ },
142
+ {
143
+ type: 'title',
144
+ text: 'Entendiendo la Constante de Enfriamiento',
145
+ level: 2
146
+ },
147
+ {
148
+ type: 'paragraph',
149
+ html: 'La constante de enfriamiento k en la ecuación de Newton no es un valor universal fijo — es una propiedad empírica de cada envase y medio específico. Una delgada lata de aluminio en agua con hielo tiene un k radicalmente diferente al de una gruesa botella de vidrio en el aire quieto de un frigorífico. Nuestra calculadora utiliza valores medidos y calibrados con experimentos reales para cada tipo de envase, dándote predicciones precisas al minuto en escenarios domésticos típicos.'
150
+ },
151
+ {
152
+ type: 'paragraph',
153
+ html: 'El movimiento del fluido también juega un papel crucial. En un frigorífico convencional, el aire casi estático ralentiza la transferencia de calor. En cambio, cuando introduces una lata en agua con hielo, la convección forzada actúa como un amplificador térmico que puede multiplicar la velocidad de enfriamiento por un factor de 10 o más. Por eso el truco de girar la botella en agua fría es tan efectivo: cada rotación renueva la capa límite de agua caliente que se forma alrededor del envase.'
154
+ }
155
+ ];
156
+
157
+ const schemas: BeerCoolerLocaleContent['schemas'] = [
158
+ {
159
+ '@context': 'https://schema.org',
160
+ '@type': 'SoftwareApplication',
161
+ name: title,
162
+ description: description,
163
+ applicationCategory: 'UtilityApplication',
164
+ operatingSystem: 'Web',
165
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
166
+ } as WithContext<SoftwareApplication>,
167
+ ];
168
+
169
+ export const content: BeerCoolerLocaleContent = {
170
+ slug,
171
+ title,
172
+ description,
173
+ ui,
174
+ seo,
175
+ faqTitle,
176
+ faq,
177
+ bibliographyTitle,
178
+ bibliography,
179
+ howTo,
180
+ schemas,
181
+ };
@@ -0,0 +1,168 @@
1
+ import type { WithContext, SoftwareApplication } from 'schema-dts';
2
+ import type { BeerCoolerUI, BeerCoolerLocaleContent } from '../index';
3
+
4
+ const slug = 'refroidisseur-biere';
5
+ const title = 'Calculateur de Refroidissement de Bière';
6
+ const description = 'Calculez combien de temps il faut pour que votre bière refroidisse dans le frigo ou le congélateur selon son contenant.';
7
+
8
+ const ui: BeerCoolerUI = {
9
+ step1Title: 'Que voulez-vous refroidir ?',
10
+ canLabel: 'Canette',
11
+ aluminumLabel: 'Aluminium',
12
+ bottleLabel: 'Bouteille',
13
+ glassLabel: 'Verre',
14
+ step2Title: 'Où la mettez-vous ?',
15
+ fridgeLabel: 'Réfrigérateur',
16
+ freezerLabel: 'Congélateur',
17
+ step3Title: 'Ajustez les Températures',
18
+ initialTempLabel: 'Temp. Initiale',
19
+ targetTempLabel: 'Cible Froide',
20
+ glacialLabel: 'Glacial',
21
+ perfectLabel: 'Parfaite',
22
+ bodegaLabel: 'Cave',
23
+ readyTitle: 'Tout prêt',
24
+ readyDescription: 'Sélectionnez le contenant et le lieu pour calculer.',
25
+ estimatedTimeLabel: 'Heure estimée',
26
+ methodLabel: 'Méthode',
27
+ containerLabel: 'Contenant',
28
+ alreadyColdLabel: 'Déjà froide !',
29
+ neverColdLabel: 'Jamais froide'
30
+ };
31
+
32
+ const faqTitle = 'Foire Aux Questions';
33
+ const bibliographyTitle = 'Bibliographie & Sources';
34
+
35
+ const faq: BeerCoolerLocaleContent['faq'] = [
36
+ {
37
+ question: "La bière 'brûle'-t-elle si elle est refroidie trop vite ?",
38
+ answer: "Non. Le mythe de la bière 'brûlée' par choc thermique est faux. Ce qui peut l'affecter, c'est la congélation et la décongélation répétées, ce qui brise les protéines et trouble le liquide, ou l'exposition au soleil (UV).",
39
+ },
40
+ {
41
+ question: "Pourquoi la mousse jaillit-elle si la bière est chaude ?",
42
+ answer: "Loi de Henry. La solubilité du CO2 diminue à mesure que la température augmente. Dans une bière chaude, le gaz est 'désespéré' de s'échapper. À l'ouverture, la pression chute et le gaz se dilate violemment.",
43
+ },
44
+ {
45
+ question: "Quelle est la température de service idéale selon le style de bière ?",
46
+ answer: "Cela dépend du style. Les Lagers et Pilsners sont meilleures entre 3°C et 7°C. Les IPAs et Pale Ales s'épanouissent entre 7°C et 10°C. Les Stouts, Porters et ales complexes doivent être servis plus chauds, autour de 10°C à 13°C, pour que leurs composés aromatiques s'ouvrent pleinement.",
47
+ },
48
+ ];
49
+
50
+ const howTo: BeerCoolerLocaleContent['howTo'] = [
51
+ {
52
+ name: "Sélectionner le contenant",
53
+ text: "Choisissez entre une canette en aluminium ou une bouteille en verre. Le matériau affecte considérablement la vitesse de transfert de chaleur.",
54
+ },
55
+ {
56
+ name: "Choisir la méthode de refroidissement",
57
+ text: "Indiquez si vous utilisez un réfrigérateur conventionnel (4°C) ou un congélateur (-18°C) pour un processus ultra-rapide.",
58
+ },
59
+ {
60
+ name: "Ajuster les températures",
61
+ text: "Définissez la température actuelle de la boisson (ambiante) et votre température cible froide souhaitée.",
62
+ },
63
+ ];
64
+
65
+ const bibliography: BeerCoolerLocaleContent['bibliography'] = [
66
+ {
67
+ name: "Newton's Law of Cooling - Physics Hypertextbook",
68
+ url: "https://physics.info/newton-cooling/",
69
+ },
70
+ {
71
+ name: "The Science of Better Beer - American Chemical Society",
72
+ url: "https://www.acs.org/content/acs/en/pressroom/reactions/videos/2016/the-science-of-better-beer.html",
73
+ },
74
+ ];
75
+
76
+ const seo: BeerCoolerLocaleContent['seo'] = [
77
+ {
78
+ type: 'title',
79
+ text: 'La Science du Froid et la Thermodynamique',
80
+ level: 2
81
+ },
82
+ {
83
+ type: 'paragraph',
84
+ html: 'Pourquoi cette canette refroidit-elle avant la bouteille ? Est-ce de la magie ? Non, c\'est la <strong>Loi du Refroidissement de Newton</strong> en action. Cet outil calcule mathématiquement le moment exact où votre boisson atteint la perfection thermodynamique. Chaque matériau, chaque environnement, chaque température initiale alimente la même équation différentielle que les physiciens et ingénieurs utilisent pour modéliser les transferts de chaleur dans les systèmes industriels.'
85
+ },
86
+ {
87
+ type: 'diagnostic',
88
+ title: 'La Formule Maîtresse',
89
+ icon: 'mdi:function-variant',
90
+ variant: 'info',
91
+ badge: 'Physique',
92
+ html: 'T(t) = T_env + (T_0 - T_env) * e^(-kt). Cette équation différentielle décrit comment la température d\'un objet change proportionnellement à la différence entre sa température et celle de l\'environnement. La constante k dépend du matériau et de la géométrie du contenant, ce qui explique pourquoi une canette refroidit plus vite qu\'une bouteille de même volume.'
93
+ },
94
+ {
95
+ type: 'title',
96
+ text: 'Guerre des Matériaux : Aluminium vs Verre',
97
+ level: 2
98
+ },
99
+ {
100
+ type: 'paragraph',
101
+ html: 'L\'<strong>aluminium</strong> a une conductivité thermique de ~205 W/(m·K), tandis que le <strong>verre</strong> atteint à peine 0.8 W/(m·K). Le métal transfère le froid violemment vite, ce qui en fait le contenant idéal pour les urgences. Cependant, le verre offre une meilleure isolation une fois froid, maintenant la température idéale plus longtemps pendant la consommation.'
102
+ },
103
+ {
104
+ type: 'stats',
105
+ items: [
106
+ { label: 'Pilsner & Lager', value: '3°C - 7°C', icon: 'mdi:snowflake' },
107
+ { label: 'IPA & Pale Ale', value: '7°C - 10°C', icon: 'mdi:hops' },
108
+ { label: 'Stout & Porter', value: '10°C - 13°C', icon: 'mdi:beer' }
109
+ ],
110
+ columns: 3
111
+ },
112
+ {
113
+ type: 'card',
114
+ title: 'La Zone de Danger du Congélateur',
115
+ icon: 'mdi:snowflake-alert',
116
+ html: 'En raison de l\'alcool et des sucres dissous, la bière gèle en dessous de 0°C — une lager standard à 5% gèle vers -3°C. Lorsque l\'eau se cristallise, elle se dilate tandis que la pression du CO2 augmente simultanément. Le résultat est un contenant qui peut se rompre violemment. Ne laissez jamais une bière au congélateur plus de 45 minutes sans minuterie.'
117
+ },
118
+ {
119
+ type: 'proscons',
120
+ title: 'Astuces de Refroidissement d\'Urgence',
121
+ items: [
122
+ { pro: 'Astuce du Papier Mouillé : Enveloppez la canette dans du papier mouillé, l\'évaporation accélère le refroidissement.', con: '' },
123
+ { pro: 'Saumure Arctique : Remplissez un seau d\'eau, de glace et de 2 cuillères de sel pour atteindre -5°C.', con: '' },
124
+ { pro: 'Méthode Rotation : Faites tourner la bouteille dans l\'eau glacée pour forcer la convection.', con: '' },
125
+ { pro: '', con: 'Ne laissez pas une canette au congélateur sans minuterie — une canette qui explose est dangereuse.' }
126
+ ]
127
+ },
128
+ {
129
+ type: 'tip',
130
+ title: 'Conseil Pro : Pré-refroidir le Verre',
131
+ html: 'Le verre dans lequel vous servez la bière possède une masse thermique significative. Un verre chaud peut augmenter la température d\'une bière parfaitement froide de 2 à 3°C instantanément au contact. Placez votre verre de service au congélateur 5 minutes avant de verser, ou rincez-le à l\'eau froide. Cette simple étape prolonge la fenêtre où votre bière a exactement le goût voulu.'
132
+ },
133
+ {
134
+ type: 'title',
135
+ text: 'Comprendre la Constante de Refroidissement',
136
+ level: 2
137
+ },
138
+ {
139
+ type: 'paragraph',
140
+ html: 'La constante de refroidissement k dans l\'équation de Newton n\'est pas une valeur universelle fixe — c\'est une propriété empirique de chaque contenant et milieu spécifique. Une fine canette en aluminium dans de l\'eau glacée a un k radicalement différent d\'une épaisse bouteille en verre dans l\'air immobile d\'un réfrigérateur. Notre calculateur utilise des valeurs mesurées et calibrées sur des expériences réelles pour chaque type de contenant, vous offrant des prédictions précises à quelques minutes près dans des scénarios de refroidissement domestiques typiques.'
141
+ }
142
+ ];
143
+
144
+ const schemas: BeerCoolerLocaleContent['schemas'] = [
145
+ {
146
+ '@context': 'https://schema.org',
147
+ '@type': 'SoftwareApplication',
148
+ name: title,
149
+ description: description,
150
+ applicationCategory: 'UtilityApplication',
151
+ operatingSystem: 'Web',
152
+ offers: { '@type': 'Offer', price: '0', priceCurrency: 'EUR' },
153
+ } as WithContext<SoftwareApplication>,
154
+ ];
155
+
156
+ export const content: BeerCoolerLocaleContent = {
157
+ slug,
158
+ title,
159
+ description,
160
+ ui,
161
+ seo,
162
+ faqTitle,
163
+ faq,
164
+ bibliographyTitle,
165
+ bibliography,
166
+ howTo,
167
+ schemas,
168
+ };
@@ -0,0 +1,49 @@
1
+ import type { AlcoholToolEntry, ToolLocaleContent, ToolDefinition } from '../../types';
2
+ import BeerCoolerCalculator from './component.astro';
3
+
4
+ export interface BeerCoolerUI {
5
+ [key: string]: string;
6
+ step1Title: string;
7
+ canLabel: string;
8
+ aluminumLabel: string;
9
+ bottleLabel: string;
10
+ glassLabel: string;
11
+ step2Title: string;
12
+ fridgeLabel: string;
13
+ freezerLabel: string;
14
+ step3Title: string;
15
+ initialTempLabel: string;
16
+ targetTempLabel: string;
17
+ glacialLabel: string;
18
+ perfectLabel: string;
19
+ bodegaLabel: string;
20
+ readyTitle: string;
21
+ readyDescription: string;
22
+ estimatedTimeLabel: string;
23
+ methodLabel: string;
24
+ containerLabel: string;
25
+ alreadyColdLabel: string;
26
+ neverColdLabel: string;
27
+ }
28
+
29
+ export type BeerCoolerLocaleContent = ToolLocaleContent<BeerCoolerUI>;
30
+
31
+ export const beerCooler: AlcoholToolEntry<BeerCoolerUI> = {
32
+ id: 'beer-cooling',
33
+ icons: {
34
+ bg: 'mdi:snowflake-thermometer',
35
+ fg: 'mdi:beer',
36
+ },
37
+ i18n: {
38
+ es: () => import('./i18n/es').then((m) => m.content),
39
+ en: () => import('./i18n/en').then((m) => m.content),
40
+ fr: () => import('./i18n/fr').then((m) => m.content),
41
+ },
42
+ };
43
+
44
+ export { BeerCoolerCalculator };
45
+
46
+ export const BEER_COOLER_TOOL: ToolDefinition = {
47
+ entry: beerCooler as AlcoholToolEntry<Record<string, string>>,
48
+ Component: BeerCoolerCalculator,
49
+ };
@@ -0,0 +1,34 @@
1
+ export type ContainerType = 'can' | 'bottle';
2
+ export type LocationType = 'fridge' | 'freezer';
3
+
4
+ export interface CoolingState {
5
+ container: ContainerType | null;
6
+ location: LocationType | null;
7
+ tempStart: number;
8
+ tempTarget: number;
9
+ }
10
+
11
+ export const CONSTANTS = {
12
+ fridge: 4,
13
+ freezer: -18,
14
+ can: 0.15,
15
+ bottle: 0.08,
16
+ };
17
+
18
+ export function calculateCoolingTime(state: CoolingState): number {
19
+ if (!state.container || !state.location) return 0;
20
+
21
+ const tempAmbient = state.location === 'fridge' ? CONSTANTS.fridge : CONSTANTS.freezer;
22
+ const k = state.container === 'can' ? CONSTANTS.can : CONSTANTS.bottle;
23
+
24
+ const t = Math.log((state.tempTarget - tempAmbient) / (state.tempStart - tempAmbient)) / -k;
25
+
26
+ if (isNaN(t) || t < 0) return 0;
27
+ return Math.ceil(t);
28
+ }
29
+
30
+ export function getFinishTime(minutes: number): string {
31
+ const d = new Date();
32
+ d.setMinutes(d.getMinutes() + minutes);
33
+ return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
34
+ }