99 lines
3.4 KiB
TypeScript
99 lines
3.4 KiB
TypeScript
import type { Plan, PlanDay, Session, SocialMediaPlatform, TraineeFlag } from '../api/types';
|
|
import type { BadgeColor } from '../components/ui';
|
|
import i18n from '../i18n';
|
|
|
|
const t = (key: string, options?: Record<string, unknown>) => i18n.t(key, options);
|
|
|
|
/** ID partii mięśniowych (kolejność = kolejność na listach i filtrach). */
|
|
export const MUSCLE_IDS = [
|
|
'chest',
|
|
'back',
|
|
'legs',
|
|
'shoulders',
|
|
'biceps',
|
|
'triceps',
|
|
'core',
|
|
'glutes',
|
|
'forearms',
|
|
'calves',
|
|
] as const;
|
|
|
|
/** Tłumaczona nazwa partii mięśniowej z fallbackiem (domyślnie surowe ID). */
|
|
export function muscleName(muscle: string, fallback?: string): string {
|
|
return t(`muscles.${muscle}`, { defaultValue: fallback ?? muscle });
|
|
}
|
|
|
|
/** Polska liczba mnoga: „1 ćwiczenie”, „2 ćwiczenia”, „5 ćwiczeń”. */
|
|
export function exerciseCountLabel(n: number): string {
|
|
return t('counters.exercises', { count: n });
|
|
}
|
|
|
|
export function dayCountLabel(n: number): string {
|
|
return t('counters.daysCount', { count: n });
|
|
}
|
|
|
|
export function setCountLabel(n: number): string {
|
|
return t('counters.setCount', { count: n });
|
|
}
|
|
|
|
export function weekCountLabel(n: number): string {
|
|
return t('counters.weeks', { count: n });
|
|
}
|
|
|
|
/** 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'], { labelKey: string; color: BadgeColor }> = {
|
|
DRAFT: { labelKey: 'statuses.plan.DRAFT', color: 'gray' },
|
|
ACTIVE: { labelKey: 'statuses.plan.ACTIVE', color: 'green' },
|
|
COMPLETED: { labelKey: 'statuses.plan.COMPLETED', color: 'blue' },
|
|
ABANDONED: { labelKey: 'statuses.plan.ABANDONED', color: 'red' },
|
|
};
|
|
|
|
export const DAY_STATUS: Record<PlanDay['status'], { labelKey: string; color: BadgeColor }> = {
|
|
PLANNED: { labelKey: 'statuses.day.PLANNED', color: 'yellow' },
|
|
COMPLETED: { labelKey: 'statuses.day.COMPLETED', color: 'green' },
|
|
SKIPPED: { labelKey: 'statuses.day.SKIPPED', color: 'red' },
|
|
};
|
|
|
|
export const SESSION_STATUS: Record<Session['status'], { labelKey: string; color: BadgeColor }> = {
|
|
IN_PROGRESS: { labelKey: 'statuses.session.IN_PROGRESS', color: 'yellow' },
|
|
COMPLETED: { labelKey: 'statuses.session.COMPLETED', color: 'green' },
|
|
ABANDONED: { labelKey: 'statuses.session.ABANDONED', color: 'red' },
|
|
};
|
|
|
|
export const GYM_ROLE: Record<
|
|
'OWNER' | 'TRAINER' | 'MEMBER',
|
|
{ labelKey: string; color: BadgeColor }
|
|
> = {
|
|
OWNER: { labelKey: 'statuses.gymRole.OWNER', color: 'blue' },
|
|
TRAINER: { labelKey: 'statuses.gymRole.TRAINER', color: 'green' },
|
|
MEMBER: { labelKey: 'statuses.gymRole.MEMBER', color: 'gray' },
|
|
};
|
|
|
|
export const TRAINEE_FLAGS: Record<TraineeFlag, { labelKey: string; color: BadgeColor }> = {
|
|
streak_reset: { labelKey: 'statuses.traineeFlag.streak_reset', color: 'red' },
|
|
no_session_7d: { labelKey: 'statuses.traineeFlag.no_session_7d', color: 'yellow' },
|
|
high_deficit: { labelKey: 'statuses.traineeFlag.high_deficit', color: 'yellow' },
|
|
};
|
|
|
|
/** Nazwy własne marek — nie tłumaczone; OTHER ma klucz `socialMedia.OTHER`. */
|
|
export const SOCIAL_MEDIA_LABELS: Record<SocialMediaPlatform, string> = {
|
|
INSTAGRAM: 'Instagram',
|
|
TIKTOK: 'TikTok',
|
|
YOUTUBE: 'YouTube',
|
|
FACEBOOK: 'Facebook',
|
|
X: 'X',
|
|
OTHER: 'Inne',
|
|
};
|