@jjlmoya/utils-nature 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.
- package/package.json +60 -0
- package/src/category/i18n/en.ts +110 -0
- package/src/category/i18n/es.ts +127 -0
- package/src/category/i18n/fr.ts +110 -0
- package/src/category/index.ts +14 -0
- package/src/category/seo.astro +15 -0
- package/src/components/PreviewNavSidebar.astro +116 -0
- package/src/components/PreviewToolbar.astro +143 -0
- package/src/data.ts +11 -0
- package/src/env.d.ts +5 -0
- package/src/index.ts +30 -0
- package/src/layouts/PreviewLayout.astro +117 -0
- package/src/pages/[locale]/[slug].astro +146 -0
- package/src/pages/[locale].astro +251 -0
- package/src/pages/index.astro +4 -0
- package/src/tests/faq_count.test.ts +19 -0
- package/src/tests/locale_completeness.test.ts +42 -0
- package/src/tests/mocks/astro_mock.js +2 -0
- package/src/tests/no_h1_in_components.test.ts +48 -0
- package/src/tests/schemas_fulfillment.test.ts +23 -0
- package/src/tests/seo_length.test.ts +22 -0
- package/src/tests/title_quality.test.ts +55 -0
- package/src/tests/tool_validation.test.ts +17 -0
- package/src/tool/cricketThermometer/bibliography.astro +14 -0
- package/src/tool/cricketThermometer/component.astro +549 -0
- package/src/tool/cricketThermometer/i18n/en.ts +181 -0
- package/src/tool/cricketThermometer/i18n/es.ts +181 -0
- package/src/tool/cricketThermometer/i18n/fr.ts +181 -0
- package/src/tool/cricketThermometer/index.ts +34 -0
- package/src/tool/cricketThermometer/logic.ts +6 -0
- package/src/tool/cricketThermometer/seo.astro +15 -0
- package/src/tool/cricketThermometer/ui.ts +11 -0
- package/src/tool/digitalCarbon/bibliography.astro +9 -0
- package/src/tool/digitalCarbon/component.astro +582 -0
- package/src/tool/digitalCarbon/i18n/en.ts +235 -0
- package/src/tool/digitalCarbon/i18n/es.ts +235 -0
- package/src/tool/digitalCarbon/i18n/fr.ts +235 -0
- package/src/tool/digitalCarbon/index.ts +33 -0
- package/src/tool/digitalCarbon/logic.ts +107 -0
- package/src/tool/digitalCarbon/seo.astro +14 -0
- package/src/tool/digitalCarbon/ui.ts +38 -0
- package/src/tool/rainHarvester/bibliography.astro +9 -0
- package/src/tool/rainHarvester/component.astro +559 -0
- package/src/tool/rainHarvester/i18n/en.ts +185 -0
- package/src/tool/rainHarvester/i18n/es.ts +185 -0
- package/src/tool/rainHarvester/i18n/fr.ts +185 -0
- package/src/tool/rainHarvester/index.ts +33 -0
- package/src/tool/rainHarvester/logic.ts +12 -0
- package/src/tool/rainHarvester/seo.astro +14 -0
- package/src/tool/rainHarvester/ui.ts +23 -0
- package/src/tool/seedCalculator/bibliography.astro +8 -0
- package/src/tool/seedCalculator/component.astro +812 -0
- package/src/tool/seedCalculator/i18n/en.ts +213 -0
- package/src/tool/seedCalculator/i18n/es.ts +213 -0
- package/src/tool/seedCalculator/i18n/fr.ts +213 -0
- package/src/tool/seedCalculator/index.ts +34 -0
- package/src/tool/seedCalculator/logic.ts +19 -0
- package/src/tool/seedCalculator/seo.astro +9 -0
- package/src/tool/seedCalculator/ui.ts +39 -0
- package/src/tools.ts +12 -0
- package/src/types.ts +72 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function calculateSpacing(population: number, rowWidthCm: number): number {
|
|
2
|
+
return 10_000_000 / (population * rowWidthCm);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function calculateHz(speedKmh: number, spacingCm: number): number {
|
|
6
|
+
return (speedKmh * 27.778) / spacingCm;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const SPEED_OPTIONS = [4, 5, 6, 7, 8, 9, 10, 12];
|
|
10
|
+
|
|
11
|
+
export const CROPS = [
|
|
12
|
+
{ id: 'corn', icon: 'mdi:corn', pop: 85000, row: 70 },
|
|
13
|
+
{ id: 'silage', icon: 'mdi:grass', pop: 95000, row: 70 },
|
|
14
|
+
{ id: 'sunflower', icon: 'mdi:flower', pop: 60000, row: 70 },
|
|
15
|
+
{ id: 'sorghum', icon: 'mdi:grain', pop: 250000, row: 52 },
|
|
16
|
+
{ id: 'soy', icon: 'mdi:sprout', pop: 350000, row: 52 },
|
|
17
|
+
{ id: 'beet', icon: 'mdi:carrot', pop: 110000, row: 50 },
|
|
18
|
+
{ id: 'rapeseed', icon: 'mdi:flower-pollen', pop: 500000, row: 45 },
|
|
19
|
+
] as const;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { SEORenderer } from '@jjlmoya/utils-shared';
|
|
3
|
+
import { seedCalculator } from './index';
|
|
4
|
+
|
|
5
|
+
const { locale = 'es' } = Astro.props;
|
|
6
|
+
const content = await seedCalculator.i18n[locale as keyof typeof seedCalculator.i18n]?.();
|
|
7
|
+
if (!content) return null;
|
|
8
|
+
---
|
|
9
|
+
<SEORenderer content={{ locale: locale as string, sections: content.seo }} />
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface SeedCalculatorUI extends Record<string, string> {
|
|
2
|
+
headCrop: string;
|
|
3
|
+
headParams: string;
|
|
4
|
+
headAnalysis: string;
|
|
5
|
+
labelPopulation: string;
|
|
6
|
+
unitSeedsHa: string;
|
|
7
|
+
labelRowWidth: string;
|
|
8
|
+
unitCm: string;
|
|
9
|
+
labelWorkSpeed: string;
|
|
10
|
+
unitKmh: string;
|
|
11
|
+
labelCalibration: string;
|
|
12
|
+
labelSpacingDesc: string;
|
|
13
|
+
labelMachineStress: string;
|
|
14
|
+
labelSeedsM: string;
|
|
15
|
+
labelPlantsM2: string;
|
|
16
|
+
labelSpeedMs: string;
|
|
17
|
+
labelHaBag: string;
|
|
18
|
+
statusStandby: string;
|
|
19
|
+
statusVolumetric: string;
|
|
20
|
+
statusOptimal: string;
|
|
21
|
+
statusHighSpeed: string;
|
|
22
|
+
statusPlateLimiter: string;
|
|
23
|
+
cropCorn: string;
|
|
24
|
+
cropSilage: string;
|
|
25
|
+
cropSunflower: string;
|
|
26
|
+
cropSorghum: string;
|
|
27
|
+
cropSoy: string;
|
|
28
|
+
cropBeet: string;
|
|
29
|
+
cropRapeseed: string;
|
|
30
|
+
noteCorn: string;
|
|
31
|
+
noteSilage: string;
|
|
32
|
+
noteSunflower: string;
|
|
33
|
+
noteSorghum: string;
|
|
34
|
+
noteSoy: string;
|
|
35
|
+
noteBeet: string;
|
|
36
|
+
noteRapeseed: string;
|
|
37
|
+
faqTitle: string;
|
|
38
|
+
bibliographyTitle: string;
|
|
39
|
+
}
|
package/src/tools.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolDefinition } from './types';
|
|
2
|
+
import { CRICKET_THERMOMETER_TOOL } from './tool/cricketThermometer/index';
|
|
3
|
+
import { SEED_CALCULATOR_TOOL } from './tool/seedCalculator/index';
|
|
4
|
+
import { RAIN_HARVESTER_TOOL } from './tool/rainHarvester/index';
|
|
5
|
+
import { DIGITAL_CARBON_TOOL } from './tool/digitalCarbon/index';
|
|
6
|
+
|
|
7
|
+
export const ALL_TOOLS: ToolDefinition[] = [
|
|
8
|
+
CRICKET_THERMOMETER_TOOL,
|
|
9
|
+
SEED_CALCULATOR_TOOL,
|
|
10
|
+
RAIN_HARVESTER_TOOL,
|
|
11
|
+
DIGITAL_CARBON_TOOL
|
|
12
|
+
];
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { SEOSection } from '@jjlmoya/utils-shared';
|
|
2
|
+
import type { WithContext, Thing } from 'schema-dts';
|
|
3
|
+
|
|
4
|
+
export type { SEOSection };
|
|
5
|
+
|
|
6
|
+
export type KnownLocale =
|
|
7
|
+
| 'ar' | 'da' | 'de' | 'en' | 'es' | 'fi'
|
|
8
|
+
| 'fr' | 'it' | 'ja' | 'ko' | 'nb' | 'nl'
|
|
9
|
+
| 'pl' | 'pt' | 'ru' | 'sv' | 'tr' | 'zh';
|
|
10
|
+
|
|
11
|
+
export interface FAQItem {
|
|
12
|
+
question: string;
|
|
13
|
+
answer: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface BibliographyEntry {
|
|
17
|
+
name: string;
|
|
18
|
+
url: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HowToStep {
|
|
22
|
+
name: string;
|
|
23
|
+
text: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ToolLocaleContent<TUI extends Record<string, string> = Record<string, string>> {
|
|
27
|
+
slug: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
ui: TUI;
|
|
31
|
+
seo: SEOSection[];
|
|
32
|
+
faqTitle?: string;
|
|
33
|
+
faq: FAQItem[];
|
|
34
|
+
bibliographyTitle?: string;
|
|
35
|
+
bibliography: BibliographyEntry[];
|
|
36
|
+
howTo: HowToStep[];
|
|
37
|
+
schemas: WithContext<Thing>[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CategoryLocaleContent {
|
|
41
|
+
slug: string;
|
|
42
|
+
title: string;
|
|
43
|
+
description: string;
|
|
44
|
+
seo: SEOSection[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type LocaleLoader<T> = () => Promise<T>;
|
|
48
|
+
|
|
49
|
+
export type LocaleMap<T> = Partial<Record<KnownLocale, LocaleLoader<T>>>;
|
|
50
|
+
|
|
51
|
+
export interface NatureToolEntry<TUI extends Record<string, string> = Record<string, string>> {
|
|
52
|
+
id: string;
|
|
53
|
+
icons: {
|
|
54
|
+
bg: string;
|
|
55
|
+
fg: string;
|
|
56
|
+
};
|
|
57
|
+
i18n: LocaleMap<ToolLocaleContent<TUI>>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface NatureCategoryEntry {
|
|
61
|
+
icon: string;
|
|
62
|
+
tools: NatureToolEntry[];
|
|
63
|
+
i18n: LocaleMap<CategoryLocaleContent>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface ToolDefinition {
|
|
67
|
+
entry: NatureToolEntry;
|
|
68
|
+
Component: unknown;
|
|
69
|
+
SEOComponent: unknown;
|
|
70
|
+
BibliographyComponent: unknown;
|
|
71
|
+
}
|
|
72
|
+
|