@jjlmoya/utils-sports 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 +62 -0
- package/src/category/i18n/en.ts +108 -0
- package/src/category/i18n/es.ts +108 -0
- package/src/category/i18n/fr.ts +95 -0
- package/src/category/index.ts +21 -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 +55 -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/gymTracker/bibliography.astro +15 -0
- package/src/tool/gymTracker/component.astro +835 -0
- package/src/tool/gymTracker/exercises.ts +28 -0
- package/src/tool/gymTracker/i18n/en.ts +225 -0
- package/src/tool/gymTracker/i18n/es.ts +225 -0
- package/src/tool/gymTracker/i18n/fr.ts +225 -0
- package/src/tool/gymTracker/index.ts +34 -0
- package/src/tool/gymTracker/logic.ts +169 -0
- package/src/tool/gymTracker/seo.astro +15 -0
- package/src/tool/gymTracker/storage.ts +43 -0
- package/src/tool/gymTracker/timer.ts +126 -0
- package/src/tool/gymTracker/types.ts +11 -0
- package/src/tool/gymTracker/ui-utils.ts +59 -0
- package/src/tool/gymTracker/ui.ts +27 -0
- package/src/tool/reactionTester/bibliography.astro +2 -0
- package/src/tool/reactionTester/component.astro +1074 -0
- package/src/tool/reactionTester/i18n/en.ts +144 -0
- package/src/tool/reactionTester/i18n/es.ts +144 -0
- package/src/tool/reactionTester/i18n/fr.ts +144 -0
- package/src/tool/reactionTester/index.ts +34 -0
- package/src/tool/reactionTester/seo.astro +12 -0
- package/src/tool/reactionTester/ui.ts +43 -0
- package/src/tool/scoreKeeper/bibliography.astro +14 -0
- package/src/tool/scoreKeeper/component.astro +858 -0
- package/src/tool/scoreKeeper/i18n/en.ts +207 -0
- package/src/tool/scoreKeeper/i18n/es.ts +207 -0
- package/src/tool/scoreKeeper/i18n/fr.ts +207 -0
- package/src/tool/scoreKeeper/index.ts +35 -0
- package/src/tool/scoreKeeper/logic.ts +275 -0
- package/src/tool/scoreKeeper/seo.astro +15 -0
- package/src/tool/scoreKeeper/sports.ts +70 -0
- package/src/tool/scoreKeeper/ui.ts +19 -0
- package/src/tool/tournamentBracket/bibliography.astro +10 -0
- package/src/tool/tournamentBracket/component.astro +1092 -0
- package/src/tool/tournamentBracket/i18n/en.ts +160 -0
- package/src/tool/tournamentBracket/i18n/es.ts +178 -0
- package/src/tool/tournamentBracket/i18n/fr.ts +160 -0
- package/src/tool/tournamentBracket/index.ts +34 -0
- package/src/tool/tournamentBracket/logic/active.controller.ts +106 -0
- package/src/tool/tournamentBracket/logic/generator.ts +71 -0
- package/src/tool/tournamentBracket/logic/manager.ts +165 -0
- package/src/tool/tournamentBracket/logic/setup.controller.ts +84 -0
- package/src/tool/tournamentBracket/logic/sharing.ts +81 -0
- package/src/tool/tournamentBracket/logic/storage.ts +56 -0
- package/src/tool/tournamentBracket/models.ts +34 -0
- package/src/tool/tournamentBracket/seo.astro +12 -0
- package/src/tool/tournamentBracket/tournament.controller.ts +65 -0
- package/src/tool/tournamentBracket/tournament.renderer.ts +45 -0
- package/src/tool/tournamentBracket/ui/bracket-desktop.ts +143 -0
- package/src/tool/tournamentBracket/ui/bracket-mobile.ts +82 -0
- package/src/tool/tournamentBracket/ui/mediator.ts +96 -0
- package/src/tool/tournamentBracket/ui/navigator.ts +84 -0
- package/src/tool/tournamentBracket/ui/setup.ts +120 -0
- package/src/tool/tournamentBracket/ui.ts +42 -0
- package/src/tools.ts +13 -0
- package/src/types.ts +72 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { LogEntry } from "./types";
|
|
2
|
+
import { defaultExercises } from "./exercises";
|
|
3
|
+
import { getCustomExercises } from "./storage";
|
|
4
|
+
|
|
5
|
+
export function updateExerciseOptions(select: HTMLSelectElement, history: Record<string, LogEntry[]>, ui: Record<string, string>) {
|
|
6
|
+
const customEx = getCustomExercises();
|
|
7
|
+
const options = Array.from(select.options) as HTMLOptionElement[];
|
|
8
|
+
options.forEach(option => {
|
|
9
|
+
const id = option.value;
|
|
10
|
+
const exerciseLogs = history[id] || [];
|
|
11
|
+
const exerciseDef = defaultExercises.find(ex => ex.id === id);
|
|
12
|
+
const name = exerciseDef ? ui[exerciseDef.nameKey] : (customEx.find(ex => ex.id === id)?.name || id);
|
|
13
|
+
|
|
14
|
+
if (exerciseLogs.length > 0) {
|
|
15
|
+
const lastWeight = exerciseLogs[exerciseLogs.length - 1].weight;
|
|
16
|
+
option.textContent = `${name} (${lastWeight}${ui.units})`;
|
|
17
|
+
option.classList.add('gt-option-highlight');
|
|
18
|
+
} else {
|
|
19
|
+
option.textContent = name;
|
|
20
|
+
option.classList.remove('gt-option-highlight');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function renderHistoryTable(container: HTMLElement, logs: LogEntry[], ui: Record<string, string>, onDelete: (idx: number) => void) {
|
|
26
|
+
container.innerHTML = '';
|
|
27
|
+
[...logs].reverse().slice(0, 5).forEach((log, rIndex) => {
|
|
28
|
+
const originalIndex = logs.length - 1 - rIndex;
|
|
29
|
+
const date = new Date(log.date).toLocaleDateString(undefined, { day: '2-digit', month: 'short' });
|
|
30
|
+
const item = document.createElement('div');
|
|
31
|
+
item.className = 'gt-history-item';
|
|
32
|
+
item.innerHTML = `<span>${date}</span><div class="gt-history-row"><span class="gt-history-weight">${log.weight} ${ui.units}</span><button class="gt-btn-delete-log" data-index="${originalIndex}">X</button></div>`;
|
|
33
|
+
container.appendChild(item);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
container.querySelectorAll('.gt-btn-delete-log').forEach((btn: Element) => {
|
|
37
|
+
(btn as HTMLElement).onclick = () => onDelete(parseInt((btn as HTMLElement).dataset.index || '0'));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function drawProgressChart(path: SVGPathElement | null, pointsContainer: HTMLElement | null, logs: LogEntry[]) {
|
|
42
|
+
if (!path || !pointsContainer) return;
|
|
43
|
+
if (logs.length === 0) {
|
|
44
|
+
path.setAttribute('d', '');
|
|
45
|
+
pointsContainer.innerHTML = '';
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const w = 400, h = 200, pad = 30;
|
|
49
|
+
const cw = w - pad * 2, ch = h - pad * 2;
|
|
50
|
+
const weights = logs.map((l: LogEntry) => l.weight);
|
|
51
|
+
const minW = Math.min(...weights) * 0.95, maxW = Math.max(...weights) * 1.05;
|
|
52
|
+
const range = maxW - minW || 1;
|
|
53
|
+
const points = logs.map((log: LogEntry, i: number) => ({
|
|
54
|
+
x: logs.length === 1 ? w / 2 : pad + (i / (logs.length - 1)) * cw,
|
|
55
|
+
y: h - pad - ((log.weight - minW) / range) * ch
|
|
56
|
+
}));
|
|
57
|
+
path.setAttribute('d', logs.length >= 2 ? `M ${points.map(p => `${p.x} ${p.y}`).join(' L ')}` : '');
|
|
58
|
+
pointsContainer.innerHTML = points.map(p => `<circle cx="${p.x}" cy="${p.y}" r="6" class="gt-chart-dot" />`).join('');
|
|
59
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface GymTrackerUI {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
exerciseLabel: string;
|
|
4
|
+
pushCategory: string;
|
|
5
|
+
pullCategory: string;
|
|
6
|
+
gluteCategory: string;
|
|
7
|
+
customExerciseCategory: string;
|
|
8
|
+
addCustomExerciseTitle: string;
|
|
9
|
+
newExerciseLabel: string;
|
|
10
|
+
exercisePlaceholder: string;
|
|
11
|
+
addBtn: string;
|
|
12
|
+
registerWeightLabel: string;
|
|
13
|
+
weightPlaceholder: string;
|
|
14
|
+
startBtn: string;
|
|
15
|
+
resetBtn: string;
|
|
16
|
+
okBtn: string;
|
|
17
|
+
noData: string;
|
|
18
|
+
recordLabel: string;
|
|
19
|
+
lastLabel: string;
|
|
20
|
+
historyTitle: string;
|
|
21
|
+
exportBtn: string;
|
|
22
|
+
confirmDeleteTitle: string;
|
|
23
|
+
confirmDeleteText: string;
|
|
24
|
+
deleteBtn: string;
|
|
25
|
+
cancelBtn: string;
|
|
26
|
+
units: string;
|
|
27
|
+
}
|