109 lines
3.2 KiB
TypeScript
109 lines
3.2 KiB
TypeScript
import type { Plan, PlanDay, Session, SocialMediaPlatform, TraineeFlag } from '../api/types';
|
|
import type { BadgeColor } from '../components/ui';
|
|
|
|
export const MUSCLE_NAMES: Record<string, string> = {
|
|
chest: 'Klatka',
|
|
back: 'Plecy',
|
|
legs: 'Nogi',
|
|
shoulders: 'Barki',
|
|
biceps: 'Biceps',
|
|
triceps: 'Triceps',
|
|
core: 'Core',
|
|
glutes: 'Pośladki',
|
|
forearms: 'Przedramię',
|
|
calves: 'Łydki',
|
|
};
|
|
|
|
// Indexed by API dayOfWeek convention: 1 = Monday ... 7 = Sunday (index 0 unused).
|
|
export const DAY_NAMES = [
|
|
'',
|
|
'Poniedziałek',
|
|
'Wtorek',
|
|
'Środa',
|
|
'Czwartek',
|
|
'Piątek',
|
|
'Sobota',
|
|
'Niedziela',
|
|
];
|
|
|
|
/** Polska liczba mnoga: „1 ćwiczenie”, „2 ćwiczenia”, „5 ćwiczeń”. */
|
|
export function exerciseCountLabel(n: number): string {
|
|
if (n === 1) return '1 ćwiczenie';
|
|
const mod10 = n % 10;
|
|
const mod100 = n % 100;
|
|
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return `${n} ćwiczenia`;
|
|
return `${n} ćwiczeń`;
|
|
}
|
|
|
|
export function dayCountLabel(n: number): string {
|
|
return n === 1 ? '1 dzień' : `${n} dni`;
|
|
}
|
|
|
|
export function setCountLabel(n: number): string {
|
|
return n === 1 ? '1 seria' : `${n} serii`;
|
|
}
|
|
|
|
export function weekCountLabel(n: number): string {
|
|
if (n === 1) return '1 tydzień';
|
|
const mod10 = n % 10;
|
|
const mod100 = n % 100;
|
|
if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return `${n} tygodnie`;
|
|
return `${n} tygodni`;
|
|
}
|
|
|
|
/** Kolor badge'a grupy mięśniowej (wg primaryMuscle). */
|
|
export const MUSCLE_COLORS: Record<string, BadgeColor> = {
|
|
chest: 'red',
|
|
back: 'blue',
|
|
legs: 'green',
|
|
shoulders: 'yellow',
|
|
biceps: 'blue',
|
|
triceps: 'yellow',
|
|
core: 'gray',
|
|
glutes: 'red',
|
|
forearms: 'gray',
|
|
};
|
|
|
|
export const PLAN_STATUS: Record<Plan['status'], { label: string; color: BadgeColor }> = {
|
|
DRAFT: { label: 'Szkic', color: 'gray' },
|
|
ACTIVE: { label: 'Aktywny', color: 'green' },
|
|
COMPLETED: { label: 'Ukończony', color: 'blue' },
|
|
ABANDONED: { label: 'Porzucony', color: 'red' },
|
|
};
|
|
|
|
export const DAY_STATUS: Record<PlanDay['status'], { label: string; color: BadgeColor }> = {
|
|
PLANNED: { label: 'Zaplanowany', color: 'yellow' },
|
|
COMPLETED: { label: 'Ukończony', color: 'green' },
|
|
SKIPPED: { label: 'Pominięty', color: 'red' },
|
|
};
|
|
|
|
export const SESSION_STATUS: Record<Session['status'], { label: string; color: BadgeColor }> = {
|
|
IN_PROGRESS: { label: 'W trakcie', color: 'yellow' },
|
|
COMPLETED: { label: 'Ukończona', color: 'green' },
|
|
ABANDONED: { label: 'Porzucona', color: 'red' },
|
|
};
|
|
|
|
export const GYM_ROLE: Record<
|
|
'OWNER' | 'TRAINER' | 'MEMBER',
|
|
{ label: string; color: BadgeColor }
|
|
> = {
|
|
OWNER: { label: 'Właściciel', color: 'blue' },
|
|
TRAINER: { label: 'Trener', color: 'green' },
|
|
MEMBER: { label: 'Członek', color: 'gray' },
|
|
};
|
|
|
|
export const TRAINEE_FLAGS: Record<TraineeFlag, { label: string; color: BadgeColor }> = {
|
|
streak_reset: { label: 'Zerowany streak', color: 'red' },
|
|
no_session_7d: { label: 'Brak sesji 7 dni', color: 'yellow' },
|
|
high_deficit: { label: 'Wysoki deficyt', color: 'yellow' },
|
|
};
|
|
|
|
export const SOCIAL_MEDIA_LABELS: Record<SocialMediaPlatform, string> = {
|
|
INSTAGRAM: 'Instagram',
|
|
TIKTOK: 'TikTok',
|
|
YOUTUBE: 'YouTube',
|
|
FACEBOOK: 'Facebook',
|
|
X: 'X',
|
|
OTHER: 'Inne',
|
|
};
|