I18n: profil, podopieczni, dashboard i kalendarz (partia 5) - podstrony profilu (Profile, ProfileInfo, ProfileBodyParameters, ProfileClaims, ProfileHistory, ProfileProgress; namespace profile), lista i detal podopiecznego + zakladki (Przeglad/Rozmowa/Dyscyplina/Postepy/Kalendarz/Plany; rozbudowany namespace trainees), Dashboard (powitania, statystyki, feed; dashboard.json), Calendar + App (ladowanie); wspólne: AddressFields sformalizowany (gyms:address sownika + kraje), AvailabilityEditor aria, ExerciseProgressCards (common:progress), HistoryTable (common:history), usuniete ostanie literaly PL i 'pl-PL' w toLocaleString (locale wg jezyka)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useEffect, type ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { useAuth } from './store/auth';
|
||||
import { useMe } from './api/queries';
|
||||
@@ -39,6 +40,7 @@ function TrainerOnly({ children }: { children: ReactNode }) {
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
const { t } = useTranslation();
|
||||
const { user, ready, init } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -46,7 +48,9 @@ export default function App() {
|
||||
}, [init]);
|
||||
|
||||
if (!ready) {
|
||||
return <div className="flex items-center justify-center min-h-dvh text-dim">Ładowanie…</div>;
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-dvh text-dim">{t('loading')}</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Field, Input, Select } from './ui';
|
||||
|
||||
/**
|
||||
@@ -5,13 +6,13 @@ import { Field, Input, Select } from './ui';
|
||||
* kod pocztowy, miejscowość, kraj). Display string `location` składa serwer.
|
||||
*/
|
||||
|
||||
export const COUNTRIES: { code: string; label: string }[] = [
|
||||
{ code: 'PL', label: 'Polska' },
|
||||
{ code: 'DE', label: 'Niemcy' },
|
||||
{ code: 'CZ', label: 'Czechy' },
|
||||
{ code: 'SK', label: 'Słowacja' },
|
||||
{ code: 'LT', label: 'Litwa' },
|
||||
{ code: 'GB', label: 'Wielka Brytania' },
|
||||
export const COUNTRIES: { code: string; labelKey: string }[] = [
|
||||
{ code: 'PL', labelKey: 'PL' },
|
||||
{ code: 'DE', labelKey: 'DE' },
|
||||
{ code: 'CZ', labelKey: 'CZ' },
|
||||
{ code: 'SK', labelKey: 'SK' },
|
||||
{ code: 'LT', labelKey: 'LT' },
|
||||
{ code: 'GB', labelKey: 'GB' },
|
||||
];
|
||||
|
||||
/** Polskie kody pocztowe: 00-001. */
|
||||
@@ -58,25 +59,26 @@ export function AddressFields({
|
||||
onChange: (patch: Partial<AddressFormValues>) => void;
|
||||
required?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const postalInvalid = values.postalCode.length > 0 && !PL_POSTAL_CODE.test(values.postalCode);
|
||||
return (
|
||||
<>
|
||||
<Field label="Ulica i numer">
|
||||
<Field label={t('address.street')}>
|
||||
<Input
|
||||
value={values.addressLine1}
|
||||
onChange={(e) => onChange({ addressLine1: e.target.value })}
|
||||
placeholder="np. Mokotowska 12A"
|
||||
placeholder={t('address.streetPh')}
|
||||
required={required}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Lokal">
|
||||
<Field label={t('address.premises')}>
|
||||
<Input
|
||||
value={values.addressLine2}
|
||||
onChange={(e) => onChange({ addressLine2: e.target.value })}
|
||||
placeholder="np. piętro 2, lokal 5"
|
||||
placeholder={t('address.premisesPh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Kod pocztowy">
|
||||
<Field label={t('address.postalCode')}>
|
||||
<Input
|
||||
value={values.postalCode}
|
||||
onChange={(e) => onChange({ postalCode: formatPostalCodeInput(e.target.value) })}
|
||||
@@ -86,25 +88,27 @@ export function AddressFields({
|
||||
aria-invalid={postalInvalid || undefined}
|
||||
required={required}
|
||||
/>
|
||||
{postalInvalid && <p className="mt-1 text-[0.8rem] text-danger">Format kodu: 00-001</p>}
|
||||
{postalInvalid && (
|
||||
<p className="mt-1 text-[0.8rem] text-danger">{t('address.postalFormatError')}</p>
|
||||
)}
|
||||
</Field>
|
||||
<Field label="Miasto">
|
||||
<Field label={t('address.city')}>
|
||||
<Input
|
||||
value={values.city}
|
||||
onChange={(e) => onChange({ city: e.target.value })}
|
||||
placeholder="np. Warszawa"
|
||||
placeholder={t('address.cityPh')}
|
||||
autoComplete="address-level2"
|
||||
required={required}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Kraj">
|
||||
<Field label={t('address.country')}>
|
||||
<Select
|
||||
value={values.countryCode}
|
||||
onChange={(e) => onChange({ countryCode: e.target.value })}
|
||||
>
|
||||
{COUNTRIES.map((c) => (
|
||||
<option key={c.code} value={c.code}>
|
||||
{c.label}
|
||||
{t(`address.${c.labelKey}`)}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TIME_SLOTS, dayFull } from '../lib/availability';
|
||||
import { Select } from './ui';
|
||||
import type { Availability, DayAvailability } from '../api/types';
|
||||
@@ -12,6 +13,7 @@ export function AvailabilityEditor({
|
||||
value: Availability;
|
||||
onChange: (value: Availability) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const setDay = (i: number, day: DayAvailability | null) => {
|
||||
const next = [...value];
|
||||
next[i] = day;
|
||||
@@ -31,13 +33,13 @@ export function AvailabilityEditor({
|
||||
<span className="w-28 shrink-0 text-[0.875rem] text-dim">{name}</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
aria-label={`${name}: dostępny`}
|
||||
aria-label={`${name}: ${t('avail.available')}`}
|
||||
checked={enabled}
|
||||
onChange={(e) => setDay(i, e.target.checked ? { start, end } : null)}
|
||||
className="size-4 accent-[var(--accent)]"
|
||||
/>
|
||||
<Select
|
||||
aria-label={`${name}: od`}
|
||||
aria-label={`${name}: ${t('avail.from')}`}
|
||||
value={start}
|
||||
disabled={!enabled}
|
||||
onChange={(e) => setDay(i, { start: e.target.value, end })}
|
||||
@@ -51,7 +53,7 @@ export function AvailabilityEditor({
|
||||
</Select>
|
||||
<span className="text-dim">–</span>
|
||||
<Select
|
||||
aria-label={`${name}: do`}
|
||||
aria-label={`${name}: ${t('avail.to')}`}
|
||||
value={end}
|
||||
disabled={!enabled}
|
||||
onChange={(e) => setDay(i, { start, end: e.target.value })}
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
} from 'recharts';
|
||||
import type { ExerciseProgress } from '../api/types';
|
||||
import { fmtDate, fmtVolume } from '../lib/format';
|
||||
import i18n from '../i18n';
|
||||
import { resolveLocaleTag } from '../i18n/language';
|
||||
import { localizedName } from '../lib/localizedName';
|
||||
import { muscleName } from '../lib/labels';
|
||||
import { Badge, Tabs } from './ui';
|
||||
@@ -32,7 +34,7 @@ const TOOLTIP_STYLE = {
|
||||
* Współdzielone z detalem podopiecznego (spójnie).
|
||||
*/
|
||||
export default function ExerciseProgressCards({ exercises }: { exercises: ExerciseProgress[] }) {
|
||||
const { i18n } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
const [openId, setOpenId] = useState<string | null>(null);
|
||||
// aktywna zakładka per ćwiczenie (domyślnie 1RM)
|
||||
const [tabs, setTabs] = useState<Record<string, 'onerm' | 'volume'>>({});
|
||||
@@ -81,8 +83,8 @@ export default function ExerciseProgressCards({ exercises }: { exercises: Exerci
|
||||
</div>
|
||||
<div className="text-[0.75rem] text-dim">
|
||||
{last?.volumeKg != null
|
||||
? `objętość ${fmtVolume(last.volumeKg)}`
|
||||
: 'brak objętości'}
|
||||
? `${t('progress.volumePrefix')}${fmtVolume(last.volumeKg)}`
|
||||
: t('progress.noVolume')}
|
||||
</div>
|
||||
</div>
|
||||
{oneRmDelta != null && oneRmDelta !== 0 && (
|
||||
@@ -97,7 +99,7 @@ export default function ExerciseProgressCards({ exercises }: { exercises: Exerci
|
||||
<TrendingDown className="h-3.5 w-3.5" />
|
||||
)}
|
||||
{oneRmDelta > 0 ? '+' : '−'}
|
||||
{Math.abs(oneRmDelta).toLocaleString('pl-PL')} kg
|
||||
{Math.abs(oneRmDelta).toLocaleString(resolveLocaleTag(i18n.language))} kg
|
||||
</span>
|
||||
)}
|
||||
{open ? (
|
||||
@@ -114,7 +116,7 @@ export default function ExerciseProgressCards({ exercises }: { exercises: Exerci
|
||||
<Tabs
|
||||
tabs={[
|
||||
{ id: 'onerm', label: '1RM' },
|
||||
{ id: 'volume', label: 'Objętość' },
|
||||
{ id: 'volume', label: t('progress.tabVolume') },
|
||||
]}
|
||||
active={tab}
|
||||
onChange={(id) => setTab(id as 'onerm' | 'volume')}
|
||||
@@ -130,11 +132,10 @@ export default function ExerciseProgressCards({ exercises }: { exercises: Exerci
|
||||
}
|
||||
|
||||
function OneRmChart({ ex }: { ex: ExerciseProgress }) {
|
||||
const { t } = useTranslation();
|
||||
const oneRmPoints = ex.points.filter((p) => p.oneRm != null);
|
||||
if (oneRmPoints.length < 2) {
|
||||
return (
|
||||
<p className="mt-3 text-[0.875rem] text-dim">Za mało danych na wykres 1RM (min. 2 sesje).</p>
|
||||
);
|
||||
return <p className="mt-3 text-[0.875rem] text-dim">{t('progress.notEnough1rm')}</p>;
|
||||
}
|
||||
return (
|
||||
<div className="mt-3">
|
||||
@@ -159,13 +160,10 @@ function OneRmChart({ ex }: { ex: ExerciseProgress }) {
|
||||
}
|
||||
|
||||
function VolumeChart({ ex }: { ex: ExerciseProgress }) {
|
||||
const { t } = useTranslation();
|
||||
const volumePoints = ex.points.filter((p) => p.volumeKg != null);
|
||||
if (volumePoints.length < 1) {
|
||||
return (
|
||||
<p className="mt-3 text-[0.875rem] text-dim">
|
||||
Brak danych o objętości (serie bez obciążenia).
|
||||
</p>
|
||||
);
|
||||
return <p className="mt-3 text-[0.875rem] text-dim">{t('progress.noVolumeData')}</p>;
|
||||
}
|
||||
return (
|
||||
<div className="mt-3">
|
||||
@@ -175,7 +173,12 @@ function VolumeChart({ ex }: { ex: ExerciseProgress }) {
|
||||
<XAxis dataKey="date" stroke="var(--text-dim)" />
|
||||
<YAxis stroke="var(--text-dim)" />
|
||||
<Tooltip contentStyle={TOOLTIP_STYLE} />
|
||||
<Bar dataKey="volumeKg" name="Objętość (kg)" fill="var(--info)" radius={[4, 4, 0, 0]} />
|
||||
<Bar
|
||||
dataKey="volumeKg"
|
||||
name={t('progress.volumeKgName')}
|
||||
fill="var(--info)"
|
||||
radius={[4, 4, 0, 0]}
|
||||
/>
|
||||
</BarChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +129,7 @@ export default function HistoryTable({
|
||||
{open && (
|
||||
<div className="pb-1">
|
||||
{s.exercises.length === 0 && (
|
||||
<p className="py-3 text-dim text-[0.875rem]">Brak ćwiczeń.</p>
|
||||
<p className="py-3 text-dim text-[0.875rem]">{t('history.noExercises')}</p>
|
||||
)}
|
||||
{s.exercises.length > 0 && (
|
||||
<div className="divide-y divide-line">
|
||||
@@ -140,7 +140,7 @@ export default function HistoryTable({
|
||||
<strong className="text-[0.95rem]">
|
||||
{localizedName(ex, i18n.language)}
|
||||
</strong>
|
||||
{ex.isExtra && <Badge color="yellow">dodane</Badge>}
|
||||
{ex.isExtra && <Badge color="yellow">{t('history.added')}</Badge>}
|
||||
</div>
|
||||
<span className="text-dim text-[0.875rem]">{muscleName(ex.muscle)}</span>
|
||||
</div>
|
||||
@@ -156,13 +156,13 @@ export default function HistoryTable({
|
||||
</span>
|
||||
{set.planned && set.reps == null ? (
|
||||
<span className="rounded-full border border-danger/30 bg-danger/10 px-2 py-0.5 text-[0.75rem] font-semibold text-danger">
|
||||
niewykonane
|
||||
{t('history.notDone')}
|
||||
</span>
|
||||
) : (
|
||||
<span className="font-display text-[0.95rem] font-semibold tabular-nums">
|
||||
{set.reps ?? '—'}
|
||||
<span className="ml-0.5 text-[0.75em] font-semibold text-dim">
|
||||
powt.
|
||||
{t('plans:exec.repsUnit')}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
@@ -171,7 +171,8 @@ export default function HistoryTable({
|
||||
<div className="mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 pl-10 text-[0.75rem] text-dim tabular-nums">
|
||||
{set.planned && (
|
||||
<span>
|
||||
plan {set.planned.reps ?? '—'}
|
||||
{t('history.planPrefix')}
|
||||
{set.planned.reps ?? '—'}
|
||||
{set.planned.loadKg != null
|
||||
? `/${set.planned.loadKg} kg`
|
||||
: ''}
|
||||
@@ -181,7 +182,11 @@ export default function HistoryTable({
|
||||
</span>
|
||||
)}
|
||||
{set.rir != null && <span>RIR {set.rir}</span>}
|
||||
{set.difficulty != null && <span>trudność {set.difficulty}</span>}
|
||||
{set.difficulty != null && (
|
||||
<span>
|
||||
{t('history.difficultyWord', { n: set.difficulty })}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* Komentarz trenującego przy serii (wpisany w oknie uzupełniania). */}
|
||||
@@ -209,7 +214,9 @@ export default function HistoryTable({
|
||||
{myUserId && c.authorId === myUserId && onDeleteComment && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Usuń komentarz ${c.authorName}`}
|
||||
aria-label={t('history.deleteCommentAria', {
|
||||
author: c.authorName,
|
||||
})}
|
||||
onClick={() => void onDeleteComment(c.id)}
|
||||
className="-m-1 shrink-0 cursor-pointer p-1 text-dim hover:text-danger"
|
||||
>
|
||||
@@ -230,12 +237,14 @@ export default function HistoryTable({
|
||||
>
|
||||
<Textarea
|
||||
rows={2}
|
||||
placeholder="Dodaj komentarz"
|
||||
placeholder={t('history.addComment')}
|
||||
value={drafts[ex.id] ?? ''}
|
||||
onChange={(e) =>
|
||||
setDrafts((d) => ({ ...d, [ex.id]: e.target.value }))
|
||||
}
|
||||
aria-label={`Komentarz dla ćwiczenia ${localizedName(ex, i18n.language)}`}
|
||||
aria-label={t('history.commentForAria', {
|
||||
name: localizedName(ex, i18n.language),
|
||||
})}
|
||||
/>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
@@ -244,7 +253,7 @@ export default function HistoryTable({
|
||||
disabled={busyKey === ex.id || !(drafts[ex.id] ?? '').trim()}
|
||||
>
|
||||
<MessageSquarePlus className="h-4 w-4" />
|
||||
Dodaj komentarz
|
||||
{t('history.addComment')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -239,7 +239,10 @@ export default function Layout() {
|
||||
|
||||
const fullName =
|
||||
[user?.firstName, user?.lastName].filter(Boolean).join(' ') || user?.email || '?';
|
||||
const roles = [user?.isAdmin ? t('roleAdmin') : null, isTrainer ? t('roleTrainer') : t('roleUser')]
|
||||
const roles = [
|
||||
user?.isAdmin ? t('roleAdmin') : null,
|
||||
isTrainer ? t('roleTrainer') : t('roleUser'),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
|
||||
|
||||
@@ -365,7 +365,8 @@ export function SetEditDialog({
|
||||
{/* Opcjonalny komentarz trenującego — widoczny także trenerowi w historii sesji. */}
|
||||
<div className="mb-4">
|
||||
<span className="text-[0.9rem] font-semibold text-ink">
|
||||
{t('plans:set.comment')} <span className="font-normal text-dim">{t('plans:set.optional')}</span>
|
||||
{t('plans:set.comment')}{' '}
|
||||
<span className="font-normal text-dim">{t('plans:set.optional')}</span>
|
||||
</span>
|
||||
<textarea
|
||||
aria-label={t('plans:set.commentAria')}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
"toggleLanguage": "Change language",
|
||||
"ok": "OK",
|
||||
"remove": "Remove",
|
||||
"showMore": "Show more",
|
||||
"error": "Error",
|
||||
"yes": "yes",
|
||||
"no": "no",
|
||||
"loading": "Loading…",
|
||||
@@ -87,6 +89,10 @@
|
||||
"setCount_one": "{{count}} set",
|
||||
"setCount_other": "{{count}} sets",
|
||||
"weeksShort": "{{count}} wk",
|
||||
"sessions_one": "{{count}} session",
|
||||
"sessions_other": "{{count}} sessions",
|
||||
"measurements_one": "{{count}} measurement",
|
||||
"measurements_other": "{{count}} measurements",
|
||||
"devices_one": "{{count}} device",
|
||||
"devices_other": "{{count}} devices"
|
||||
},
|
||||
@@ -132,5 +138,28 @@
|
||||
},
|
||||
"socialMedia": {
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"progress": {
|
||||
"volumePrefix": "volume ",
|
||||
"noVolume": "no volume",
|
||||
"tabVolume": "Volume",
|
||||
"notEnough1rm": "Not enough data for the 1RM chart (min. 2 sessions).",
|
||||
"noVolumeData": "No volume data (sets without load).",
|
||||
"volumeKgName": "Volume (kg)"
|
||||
},
|
||||
"avail": {
|
||||
"available": "available",
|
||||
"from": "from",
|
||||
"to": "to"
|
||||
},
|
||||
"history": {
|
||||
"noExercises": "No exercises.",
|
||||
"added": "added",
|
||||
"notDone": "not done",
|
||||
"planPrefix": "plan ",
|
||||
"addComment": "Add a comment",
|
||||
"difficultyWord": "difficulty {{n}}",
|
||||
"deleteCommentAria": "Delete {{author}}'s comment",
|
||||
"commentForAria": "Comment for {{name}}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"calendar": {
|
||||
"pageTitle": "Calendar",
|
||||
"prevYear": "Previous year",
|
||||
"nextYear": "Next year",
|
||||
"dayChip": "{{label}}: {{n}} ex",
|
||||
@@ -7,6 +8,41 @@
|
||||
"legendSkipped": "skipped",
|
||||
"legendPlanned": "planned",
|
||||
"emptyTitle": "No workouts",
|
||||
"emptyDescription": "There are no planned training days this month."
|
||||
}
|
||||
"emptyDescription": "There are no planned training days this month.",
|
||||
"startTraining": "Start training",
|
||||
"showDetails": "Show details"
|
||||
},
|
||||
"greetingNight": "Sleep well",
|
||||
"greetingEvening": "Good evening",
|
||||
"greetingDay": "Good morning",
|
||||
"weekOfPlan": "week {{n}} of the plan",
|
||||
"trainingInProgress": "Training in progress",
|
||||
"sessionTime": "session time",
|
||||
"backToTraining": "Back to training",
|
||||
"sessionStart": "started {{time}}",
|
||||
"startOn": "Starts {{date}}",
|
||||
"viewPlan": "View plan",
|
||||
"planCompleted": "Plan completed",
|
||||
"doneOfDays": "{{completed}} of {{total}} days",
|
||||
"noActivePlanLower": "no active plan",
|
||||
"toEnd": "{{days}} to go",
|
||||
"weekTempo": "Tempo this week",
|
||||
"tempoDonePlanned": "completed / planned this week",
|
||||
"noTrainingThisWeek": "no workouts this week",
|
||||
"setsLabel": "Sets",
|
||||
"setsLastWeeks": "in the last 12 weeks",
|
||||
"bestResult": "best result: {{days}}",
|
||||
"completedPlans": "Completed plans",
|
||||
"completedWorkouts": "completed workouts",
|
||||
"nextTraining": "Next training",
|
||||
"createPlan": "Create plan",
|
||||
"doTraining": "Do workout",
|
||||
"noUpcoming": "No upcoming workouts",
|
||||
"noActivePlanTitle": "No active plan",
|
||||
"allDone": "All done — wait for the next planned day.",
|
||||
"createPlanDesc": "Create a plan to start working out.",
|
||||
"feedTitle": "News",
|
||||
"seeAll": "See all",
|
||||
"feedEmptyTitle": "No news",
|
||||
"feedEmptyDesc": "Plans from your trainer and gym announcements will appear here."
|
||||
}
|
||||
|
||||
@@ -236,5 +236,22 @@
|
||||
"emptyAll": "No gyms to join — you are already a member of all of them.",
|
||||
"submit": "Join",
|
||||
"busy": "Joining…"
|
||||
},
|
||||
"address": {
|
||||
"street": "Street and number",
|
||||
"streetPh": "e.g. Mokotowska 12A",
|
||||
"premises": "Unit",
|
||||
"premisesPh": "e.g. floor 2, unit 5",
|
||||
"postalCode": "Postal code",
|
||||
"postalFormatError": "Postal code format: 00-001",
|
||||
"city": "City",
|
||||
"cityPh": "e.g. Warsaw",
|
||||
"country": "Country",
|
||||
"PL": "Poland",
|
||||
"DE": "Germany",
|
||||
"CZ": "Czechia",
|
||||
"SK": "Slovakia",
|
||||
"LT": "Lithuania",
|
||||
"GB": "United Kingdom"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
"markComplete": "Mark as completed",
|
||||
"abandon": "Abandon",
|
||||
"reopen": "Resume",
|
||||
"completeLabel": "Complete",
|
||||
"share": "Share",
|
||||
"reopenBlockedHint": "The trainee already has an active plan — only one plan can be active. To resume this plan, complete or abandon the active one first."
|
||||
},
|
||||
@@ -202,7 +203,12 @@
|
||||
"confirmAbandonTitle": "Abandon plan?",
|
||||
"confirmAbandonDesc": "The plan will be marked as abandoned — no further workouts will be scheduled from it.",
|
||||
"confirmReopenTitle": "Resume plan?",
|
||||
"confirmReopenDesc": "The plan returns to active status — you can fix incorrect sessions in their weeks. Skipped days remain skipped."
|
||||
"confirmReopenDesc": "The plan returns to active status — you can fix incorrect sessions in their weeks. Skipped days remain skipped.",
|
||||
"confirmActivateTitle": "Activate the plan?",
|
||||
"confirmActivateDesc": "The plan will be activated from Monday of the selected week.",
|
||||
"confirmCompleteTitle": "Mark as completed?",
|
||||
"confirmCompleteDesc": "The plan will be marked as completed.",
|
||||
"traineeConflictActivate": "The trainee already has an active plan — only one plan can be active. To activate this plan, complete or abandon the active one first."
|
||||
},
|
||||
"exec": {
|
||||
"bonusBadge": "+{{n}} bonus",
|
||||
|
||||
@@ -1 +1,109 @@
|
||||
{}
|
||||
{
|
||||
"noMeasurements": "no measurements",
|
||||
"noSessions": "no sessions",
|
||||
"none": "none",
|
||||
"lastWord": "last",
|
||||
"claimsPending": "{{count}} pending",
|
||||
"claimsResolved": "{{count}} resolved",
|
||||
"noData": "no data",
|
||||
"ageYears": "{{count}} yrs",
|
||||
"killstreak": "Killstreak",
|
||||
"volume7d": "7-day volume",
|
||||
"sessionsLabel": "Sessions",
|
||||
"secPersonal": "Personal data",
|
||||
"secBody": "Body parameters",
|
||||
"secHistory": "Training history",
|
||||
"secProgress": "Progress",
|
||||
"secClaims": "Requests",
|
||||
"noProgressTitle": "No progress",
|
||||
"noProgressDesc": "Progress will appear after your first completed workout.",
|
||||
"commentAdded": "Comment added",
|
||||
"commentDeleted": "Comment deleted",
|
||||
"emptyMonthTitle": "No sessions in the selected month",
|
||||
"emptyNoSessions": "No sessions",
|
||||
"emptyMonthDesc": "Pick another month or “All” to see the full history.",
|
||||
"emptyAllDesc": "Complete your first workout to see the history.",
|
||||
"newClaimAction": "New gym request",
|
||||
"claimWithdrawn": "Request withdrawn",
|
||||
"claimsEmptyTitle": "No requests",
|
||||
"claimsEmptyDesc": "Submit a request for a new real gym or for verification of a virtual one and you will see it here.",
|
||||
"newClaimShort": "New request",
|
||||
"typeVerification": "Virtual verification",
|
||||
"typeNewGym": "New gym",
|
||||
"submittedWord": "submitted",
|
||||
"reasonPrefix": "Reason: ",
|
||||
"withdraw": "Withdraw",
|
||||
"resubmit": "Submit again",
|
||||
"pendingList": "Pending requests: {{count}}",
|
||||
"withdrawConfirmTitle": "Withdraw the request?",
|
||||
"withdrawConfirmDesc": "{{name}} — the request will be permanently withdrawn.",
|
||||
"statusPending": "Pending",
|
||||
"statusApproved": "Approved",
|
||||
"statusRejected": "Rejected",
|
||||
"progressTitle": "Progress",
|
||||
"progressFromFirst": "{{delta}} {{unit}} since first",
|
||||
"noChange": "no change",
|
||||
"secondHint": "a second measurement will show the change",
|
||||
"firstToLast": "first → last",
|
||||
"chartNoData": "Not enough data for the chart (min. 2 measurements).",
|
||||
"removeMeasurementAria": "Remove {{name}} measurement from {{date}}",
|
||||
"addMeasurement": "Add measurement",
|
||||
"tabWeight": "Weight",
|
||||
"tabCirc": "Circumference",
|
||||
"weightPlaceholder": "weight (kg)",
|
||||
"circPlaceholder": "value (cm)",
|
||||
"dateField": "Date",
|
||||
"weightDateAria": "Weight date",
|
||||
"circDateAria": "Circumference date",
|
||||
"measureTypeAria": "Measurement type",
|
||||
"sideField": "Side",
|
||||
"addWeight": "Add weight",
|
||||
"addCirc": "Add circumference",
|
||||
"weightGenitive": "weight",
|
||||
"weightAdded": "Weight added",
|
||||
"circAdded": "Circumference added",
|
||||
"measurementRemoved": "Measurement removed",
|
||||
"saveError": "Save error",
|
||||
"noMeasurementsTitle": "No measurements",
|
||||
"noMeasurementsDesc": "Add your first measurement to track progress.",
|
||||
"removeConfirmTitle": "Remove the measurement?",
|
||||
"removeConfirmDesc": "{{label}} will be permanently removed.",
|
||||
"toneDevelop": "To develop",
|
||||
"toneCanDo": "Can do",
|
||||
"toneDifficult": "Difficult",
|
||||
"toneAvoid": "To avoid",
|
||||
"chainPrefixDevelop": "to develop: ",
|
||||
"chainPrefixAvoid": "avoid: ",
|
||||
"chainTitle": "Cause-and-effect chain",
|
||||
"chainDesc": "Exercises from the active plan in the context of your goals and exclusions.",
|
||||
"chainNoFocus": "no focus in the plan",
|
||||
"chainNotInPlan": "not in the active plan",
|
||||
"removeSocialAria": "Remove social media",
|
||||
"addSocial": "Add social media",
|
||||
"platformAria": "Platform",
|
||||
"labelField": "Label",
|
||||
"basicSaved": "Basic data saved",
|
||||
"musclesSaved": "Priorities and exclusions saved",
|
||||
"socialSaved": "Social media saved",
|
||||
"editData": "Edit data",
|
||||
"editMuscles": "Edit muscles",
|
||||
"editSocial": "Edit social",
|
||||
"secBasics": "Basic data",
|
||||
"labelFirst": "First name",
|
||||
"labelLast": "Last name",
|
||||
"labelAge": "Age",
|
||||
"labelHeight": "Height",
|
||||
"labelPhone": "Phone",
|
||||
"labelNick": "Nick",
|
||||
"availability": "Availability",
|
||||
"noAvailability": "No availability set",
|
||||
"secMuscles": "Priorities and exclusions",
|
||||
"nothingAdded": "nothing added",
|
||||
"secSocial": "Social media",
|
||||
"noSocialProfiles": "No profiles added.",
|
||||
"fieldHeightCm": "Height (cm)",
|
||||
"nickPlaceholder": "e.g. fitfan",
|
||||
"muscleSearchPlaceholder": "Search muscle…",
|
||||
"muscleSearchAria": "Search muscle",
|
||||
"noMusclesMatch": "No muscles match “{{q}}”."
|
||||
}
|
||||
|
||||
@@ -6,5 +6,77 @@
|
||||
"legendPlannedPast": "planned (past)",
|
||||
"legendPlannedFuture": "planned (future)",
|
||||
"legendMoved": "moved"
|
||||
}
|
||||
},
|
||||
"sortNone": "None",
|
||||
"sortFlags": "Flags",
|
||||
"sortKillstreak": "Killstreak",
|
||||
"sortName": "Name",
|
||||
"sortLastSession": "Last session",
|
||||
"sortBy": "Sort: {{sort}}",
|
||||
"killstreak": "Killstreak",
|
||||
"noGym": "no gym",
|
||||
"planDays": "{{completed}}/{{total}} days",
|
||||
"noActivePlan": "No active plan",
|
||||
"lastSessionPrefix": "last session: ",
|
||||
"groupByGym": "Group by gym",
|
||||
"addTrainee": "Add trainee",
|
||||
"inviteSent": "Invitation sent",
|
||||
"noTrainerTitle": "No trainer role",
|
||||
"noTrainerDesc": "The Trainees section is available to users with a trainer role in a gym.",
|
||||
"firstNamePlaceholder": "First name",
|
||||
"lastNamePlaceholder": "Last name",
|
||||
"searchAction": "Search",
|
||||
"searchingAction": "Searching…",
|
||||
"noCandidates": "No results for the given first and last name.",
|
||||
"invite": "Invite",
|
||||
"gymFilterAria": "Filter by gym",
|
||||
"allGyms": "All gyms",
|
||||
"noQueryResults": "No results for the given query.",
|
||||
"emptyTitle": "No trainees",
|
||||
"emptyDesc": "Search a person by first and last name and send an invitation.",
|
||||
"groupOther": "Other",
|
||||
"commentAdded": "Comment added",
|
||||
"commentDeleted": "Comment deleted",
|
||||
"archived": "Relationship archived",
|
||||
"createPlan": "Create plan",
|
||||
"writeMessage": "Write a message",
|
||||
"archive": "Archive",
|
||||
"tabOverview": "Overview",
|
||||
"tabCalendar": "Calendar",
|
||||
"tabHistory": "History",
|
||||
"tabProgress": "Progress",
|
||||
"tabDiscipline": "Discipline",
|
||||
"tabPlans": "Plans",
|
||||
"noSessionsDot": "No sessions.",
|
||||
"archiveTitle": "Archive the relationship",
|
||||
"archiveDesc": "Are you sure you want to archive the relationship with {{name}}? The trainee will no longer be visible on your list.",
|
||||
"convTitle": "Conversation",
|
||||
"youPrefix": "You: ",
|
||||
"noMessagesYet": "No messages — write the first one.",
|
||||
"basicsTitle": "Basic information",
|
||||
"gymsLabel": "Gyms",
|
||||
"lastSessionLabel": "Last session",
|
||||
"socialLabel": "Social media",
|
||||
"activePlanTitle": "Active plan",
|
||||
"startWord": "starts ",
|
||||
"excessSeries": "Excess (sets)",
|
||||
"deficitSeries": "Deficit (sets)",
|
||||
"nextTraining": "Next training",
|
||||
"noActivePlanForTrainee": "The trainee has no active plan.",
|
||||
"noDaysInPlan": "No days in the active plan.",
|
||||
"movedDays": "Moved days",
|
||||
"noMovedDays": "No moved days.",
|
||||
"movedWord": "moved ",
|
||||
"progressPerExercise": "Progress per exercise",
|
||||
"volumePerPart": "Volume per muscle group",
|
||||
"volumeDesc": "Actual sets versus the plan and the recommended range: accent = in range, orange = >10% above, red = deficit.",
|
||||
"noPlanReport": "No active plan — report unavailable.",
|
||||
"excessWord": "excess",
|
||||
"deficitWord": "deficit",
|
||||
"outOfRange": "out of range",
|
||||
"noExercises": "No exercises.",
|
||||
"traineeCalendar": "Trainee's calendar",
|
||||
"plansOfTrainee": "Trainee's plans",
|
||||
"noPlansAtAll": "The trainee has no plans.",
|
||||
"trainerFallback": "trainer"
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
"toggleLanguage": "Zmień język",
|
||||
"ok": "OK",
|
||||
"remove": "Usuń",
|
||||
"showMore": "Pokaż więcej",
|
||||
"error": "Błąd",
|
||||
"yes": "tak",
|
||||
"no": "nie",
|
||||
"loading": "Ładowanie…",
|
||||
@@ -94,6 +96,14 @@
|
||||
"setCount_many": "{{count}} serii",
|
||||
"setCount_other": "{{count}} serii",
|
||||
"weeksShort": "{{count}} tyg.",
|
||||
"sessions_one": "{{count}} sesja",
|
||||
"sessions_few": "{{count}} sesje",
|
||||
"sessions_many": "{{count}} sesji",
|
||||
"sessions_other": "{{count}} sesji",
|
||||
"measurements_one": "{{count}} pomiar",
|
||||
"measurements_few": "{{count}} pomiary",
|
||||
"measurements_many": "{{count}} pomiarów",
|
||||
"measurements_other": "{{count}} pomiarów",
|
||||
"devices_one": "{{count}} urządzenie",
|
||||
"devices_few": "{{count}} urządzenia",
|
||||
"devices_many": "{{count}} urządzeń",
|
||||
@@ -141,5 +151,28 @@
|
||||
},
|
||||
"socialMedia": {
|
||||
"OTHER": "Inne"
|
||||
},
|
||||
"progress": {
|
||||
"volumePrefix": "objętość ",
|
||||
"noVolume": "brak objętości",
|
||||
"tabVolume": "Objętość",
|
||||
"notEnough1rm": "Za mało danych na wykres 1RM (min. 2 sesje).",
|
||||
"noVolumeData": "Brak danych o objętości (serie bez obciążenia).",
|
||||
"volumeKgName": "Objętość (kg)"
|
||||
},
|
||||
"avail": {
|
||||
"available": "dostępny",
|
||||
"from": "od",
|
||||
"to": "do"
|
||||
},
|
||||
"history": {
|
||||
"noExercises": "Brak ćwiczeń.",
|
||||
"added": "dodane",
|
||||
"notDone": "niewykonane",
|
||||
"planPrefix": "plan ",
|
||||
"addComment": "Dodaj komentarz",
|
||||
"difficultyWord": "trudność {{n}}",
|
||||
"deleteCommentAria": "Usuń komentarz {{author}}",
|
||||
"commentForAria": "Komentarz dla ćwiczenia {{name}}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"calendar": {
|
||||
"pageTitle": "Kalendarz",
|
||||
"prevYear": "Poprzedni rok",
|
||||
"nextYear": "Następny rok",
|
||||
"dayChip": "{{label}}: {{n}} ćw.",
|
||||
@@ -7,6 +8,41 @@
|
||||
"legendSkipped": "pominięty",
|
||||
"legendPlanned": "zaplanowany",
|
||||
"emptyTitle": "Brak treningów",
|
||||
"emptyDescription": "W tym miesiącu nie ma zaplanowanych dni treningowych."
|
||||
}
|
||||
"emptyDescription": "W tym miesiącu nie ma zaplanowanych dni treningowych.",
|
||||
"startTraining": "Rozpocznij trening",
|
||||
"showDetails": "Pokaż szczegóły"
|
||||
},
|
||||
"greetingNight": "Dobrej nocy",
|
||||
"greetingEvening": "Dobry wieczór",
|
||||
"greetingDay": "Dzień dobry",
|
||||
"weekOfPlan": "tydzień {{n}} planu",
|
||||
"trainingInProgress": "Trwa trening",
|
||||
"sessionTime": "czas sesji",
|
||||
"backToTraining": "Wróć do treningu",
|
||||
"sessionStart": "start {{time}}",
|
||||
"startOn": "Start {{date}}",
|
||||
"viewPlan": "Zobacz plan",
|
||||
"planCompleted": "Ukończono plan",
|
||||
"doneOfDays": "{{completed}} z {{total}} dni",
|
||||
"noActivePlanLower": "brak aktywnego planu",
|
||||
"toEnd": "{{days}} do końca",
|
||||
"weekTempo": "Tempo w tym tygodniu",
|
||||
"tempoDonePlanned": "ukończone / zaplanowane w tym tygodniu",
|
||||
"noTrainingThisWeek": "brak treningów w tym tygodniu",
|
||||
"setsLabel": "Serie",
|
||||
"setsLastWeeks": "w ostatnich 12 tygodniach",
|
||||
"bestResult": "najwyższy wynik: {{days}}",
|
||||
"completedPlans": "Ukończone plany",
|
||||
"completedWorkouts": "ukończone treningi",
|
||||
"nextTraining": "Następny trening",
|
||||
"createPlan": "Utwórz plan",
|
||||
"doTraining": "Wykonaj trening",
|
||||
"noUpcoming": "Brak nadchodzących treningów",
|
||||
"noActivePlanTitle": "Brak aktywnego planu",
|
||||
"allDone": "Wszystko zrobione — czekaj na kolejny dzień z planu.",
|
||||
"createPlanDesc": "Utwórz plan, aby rozpocząć treningi.",
|
||||
"feedTitle": "Aktualności",
|
||||
"seeAll": "Zobacz wszystkie",
|
||||
"feedEmptyTitle": "Brak aktualności",
|
||||
"feedEmptyDesc": "Tu pojawią się plany od trenera i ogłoszenia siłowni."
|
||||
}
|
||||
|
||||
@@ -236,5 +236,22 @@
|
||||
"emptyAll": "Brak siłowni do dołączenia — należysz już do wszystkich.",
|
||||
"submit": "Dołącz",
|
||||
"busy": "Dołączanie…"
|
||||
},
|
||||
"address": {
|
||||
"street": "Ulica i numer",
|
||||
"streetPh": "np. Mokotowska 12A",
|
||||
"premises": "Lokal",
|
||||
"premisesPh": "np. piętro 2, lokal 5",
|
||||
"postalCode": "Kod pocztowy",
|
||||
"postalFormatError": "Format kodu: 00-001",
|
||||
"city": "Miasto",
|
||||
"cityPh": "np. Warszawa",
|
||||
"country": "Kraj",
|
||||
"PL": "Polska",
|
||||
"DE": "Niemcy",
|
||||
"CZ": "Czechy",
|
||||
"SK": "Słowacja",
|
||||
"LT": "Litwa",
|
||||
"GB": "Wielka Brytania"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
"markComplete": "Oznacz jako ukończony",
|
||||
"abandon": "Porzuć",
|
||||
"reopen": "Wznów",
|
||||
"completeLabel": "Ukończ",
|
||||
"share": "Udostępnij",
|
||||
"reopenBlockedHint": "Podopieczny ma już aktywny plan — tylko jeden plan może być aktywny. Aby wznowić ten plan, najpierw ukończ lub porzuć aktywny."
|
||||
},
|
||||
@@ -202,7 +203,12 @@
|
||||
"confirmAbandonTitle": "Porzucić plan?",
|
||||
"confirmAbandonDesc": "Plan zostanie oznaczony jako porzucony — kolejne treningi z niego nie będą planowane.",
|
||||
"confirmReopenTitle": "Wznowić plan?",
|
||||
"confirmReopenDesc": "Plan wróci do statusu aktywnego — błędne sesje poprawisz w ich tygodniach. Pominięte dni pozostaną pominięte."
|
||||
"confirmReopenDesc": "Plan wróci do statusu aktywnego — błędne sesje poprawisz w ich tygodniach. Pominięte dni pozostaną pominięte.",
|
||||
"confirmActivateTitle": "Aktywować plan?",
|
||||
"confirmActivateDesc": "Plan zostanie aktywowany od poniedziałku zaznaczonego tygodnia.",
|
||||
"confirmCompleteTitle": "Oznaaczyć jako ukończony?",
|
||||
"confirmCompleteDesc": "Plan zostanie oznaczony jako ukończony.",
|
||||
"traineeConflictActivate": "Podopieczny ma już aktywny plan — tylko jeden plan może być aktywny. Aby aktywować ten plan, najpierw ukończ lub porzuć aktywny."
|
||||
},
|
||||
"exec": {
|
||||
"bonusBadge": "+{{n}} bonus",
|
||||
|
||||
@@ -1 +1,109 @@
|
||||
{}
|
||||
{
|
||||
"noMeasurements": "brak pomiarów",
|
||||
"noSessions": "brak sesji",
|
||||
"none": "brak",
|
||||
"lastWord": "ostatnia",
|
||||
"claimsPending": "{{count}} oczekujących",
|
||||
"claimsResolved": "{{count}} rozstrzygniętych",
|
||||
"noData": "brak danych",
|
||||
"ageYears": "{{count}} lat",
|
||||
"killstreak": "Killstreak",
|
||||
"volume7d": "Objętość 7 dni",
|
||||
"sessionsLabel": "Sesje",
|
||||
"secPersonal": "Dane osobowe",
|
||||
"secBody": "Parametry ciała",
|
||||
"secHistory": "Historia treningów",
|
||||
"secProgress": "Postępy",
|
||||
"secClaims": "Wnioski",
|
||||
"noProgressTitle": "Brak postępów",
|
||||
"noProgressDesc": "Postępy pojawią się po pierwszym ukończonym treningu.",
|
||||
"commentAdded": "Komentarz dodany",
|
||||
"commentDeleted": "Komentarz usunięty",
|
||||
"emptyMonthTitle": "Brak sesji w wybranym miesiącu",
|
||||
"emptyNoSessions": "Brak sesji",
|
||||
"emptyMonthDesc": "Wybierz inny miesiąc lub „Wszystkie”, aby zobaczyć pełną historię.",
|
||||
"emptyAllDesc": "Ukończ pierwszy trening, aby zobaczyć historię.",
|
||||
"newClaimAction": "Nowy wniosek o siłownię",
|
||||
"claimWithdrawn": "Wniosek wycofany",
|
||||
"claimsEmptyTitle": "Brak wniosków",
|
||||
"claimsEmptyDesc": "Składając wniosek o nową realną siłownię lub o weryfikację wirtualnej, zobaczysz go tutaj.",
|
||||
"newClaimShort": "Nowy wniosek",
|
||||
"typeVerification": "Weryfikacja wirtualnej",
|
||||
"typeNewGym": "Nowa siłownia",
|
||||
"submittedWord": "złożono",
|
||||
"reasonPrefix": "Powód: ",
|
||||
"withdraw": "Wycofaj",
|
||||
"resubmit": "Złóż ponownie",
|
||||
"pendingList": "Oczekujące wnioski: {{count}}",
|
||||
"withdrawConfirmTitle": "Wycofać wniosek?",
|
||||
"withdrawConfirmDesc": "{{name}} — wniosek zostanie trwale wycofany.",
|
||||
"statusPending": "Oczekuje",
|
||||
"statusApproved": "Zatwierdzony",
|
||||
"statusRejected": "Odrzucony",
|
||||
"progressTitle": "Postęp",
|
||||
"progressFromFirst": "{{delta}} {{unit}} od pierwszego",
|
||||
"noChange": "bez zmian",
|
||||
"secondHint": "drugi pomiar pokaże zmianę",
|
||||
"firstToLast": "pierwszy → ostatni",
|
||||
"chartNoData": "Za mało danych na wykres (min. 2 pomiary).",
|
||||
"removeMeasurementAria": "Usuń pomiar {{name}} z {{date}}",
|
||||
"addMeasurement": "Dodaj pomiar",
|
||||
"tabWeight": "Waga",
|
||||
"tabCirc": "Obwód",
|
||||
"weightPlaceholder": "waga (kg)",
|
||||
"circPlaceholder": "wartość (cm)",
|
||||
"dateField": "Data",
|
||||
"weightDateAria": "Data wagi",
|
||||
"circDateAria": "Data obwodu",
|
||||
"measureTypeAria": "Rodzaj pomiaru",
|
||||
"sideField": "Strona",
|
||||
"addWeight": "Dodaj wagę",
|
||||
"addCirc": "Dodaj obwód",
|
||||
"weightGenitive": "wagi",
|
||||
"weightAdded": "Waga dodana",
|
||||
"circAdded": "Obwód dodany",
|
||||
"measurementRemoved": "Pomiar usunięty",
|
||||
"saveError": "Błąd zapisu",
|
||||
"noMeasurementsTitle": "Brak pomiarów",
|
||||
"noMeasurementsDesc": "Dodaj pierwszy pomiar, aby śledzić postęp.",
|
||||
"removeConfirmTitle": "Usunąć pomiar?",
|
||||
"removeConfirmDesc": "{{label}} zostanie trwale usunięty.",
|
||||
"toneDevelop": "Co rozwija",
|
||||
"toneCanDo": "Co potrafi",
|
||||
"toneDifficult": "Co trudne",
|
||||
"toneAvoid": "Co unikać",
|
||||
"chainPrefixDevelop": "do rozwoju: ",
|
||||
"chainPrefixAvoid": "unikamy: ",
|
||||
"chainTitle": "Ciąg przyczynowo-skutkowy",
|
||||
"chainDesc": "Ćwiczenia z aktywnego planu w kontekście Twoich celów i wykluczeń.",
|
||||
"chainNoFocus": "brak akcentów w planie",
|
||||
"chainNotInPlan": "brak w aktywnym planie",
|
||||
"removeSocialAria": "Usuń social media",
|
||||
"addSocial": "Dodaj social media",
|
||||
"platformAria": "Platforma",
|
||||
"labelField": "Etykieta",
|
||||
"basicSaved": "Dane podstawowe zapisane",
|
||||
"musclesSaved": "Priorytety i wykluczenia zapisane",
|
||||
"socialSaved": "Social media zapisane",
|
||||
"editData": "Edytuj dane",
|
||||
"editMuscles": "Edytuj mięśnie",
|
||||
"editSocial": "Edytuj social",
|
||||
"secBasics": "Podstawowe dane",
|
||||
"labelFirst": "Imię",
|
||||
"labelLast": "Nazwisko",
|
||||
"labelAge": "Wiek",
|
||||
"labelHeight": "Wzrost",
|
||||
"labelPhone": "Telefon",
|
||||
"labelNick": "Nick",
|
||||
"availability": "Dostępność",
|
||||
"noAvailability": "Brak ustawionej dostępności",
|
||||
"secMuscles": "Priorytety i wykluczenia",
|
||||
"nothingAdded": "nic nie dodano",
|
||||
"secSocial": "Social media",
|
||||
"noSocialProfiles": "Brak dodanych profili.",
|
||||
"fieldHeightCm": "Wzrost (cm)",
|
||||
"nickPlaceholder": "np. fitfan",
|
||||
"muscleSearchPlaceholder": "Szukaj mięśnia…",
|
||||
"muscleSearchAria": "Szukaj mięśnia",
|
||||
"noMusclesMatch": "Brak mięśni pasujących do „{{q}}”."
|
||||
}
|
||||
|
||||
@@ -6,5 +6,77 @@
|
||||
"legendPlannedPast": "zaplanowany (miniony)",
|
||||
"legendPlannedFuture": "zaplanowany (przyszły)",
|
||||
"legendMoved": "przesunięty"
|
||||
}
|
||||
},
|
||||
"sortNone": "Brak",
|
||||
"sortFlags": "Flagi",
|
||||
"sortKillstreak": "Killstreak",
|
||||
"sortName": "Nazwa",
|
||||
"sortLastSession": "Ostatnia sesja",
|
||||
"sortBy": "Sortuj: {{sort}}",
|
||||
"killstreak": "Killstreak",
|
||||
"noGym": "bez siłowni",
|
||||
"planDays": "{{completed}}/{{total}} dni",
|
||||
"noActivePlan": "Brak aktywnego planu",
|
||||
"lastSessionPrefix": "ostatnia sesja: ",
|
||||
"groupByGym": "Grupuj wg siłowni",
|
||||
"addTrainee": "Dodaj podopiecznego",
|
||||
"inviteSent": "Zaproszenie wysłane",
|
||||
"noTrainerTitle": "Brak roli trenera",
|
||||
"noTrainerDesc": "Sekcja Podopieczni jest dostępna dla użytkowników z rolą trenera w siłowni.",
|
||||
"firstNamePlaceholder": "Imię",
|
||||
"lastNamePlaceholder": "Nazwisko",
|
||||
"searchAction": "Szukaj",
|
||||
"searchingAction": "Szukam…",
|
||||
"noCandidates": "Brak wyników dla podanych imienia i nazwiska.",
|
||||
"invite": "Zaproś",
|
||||
"gymFilterAria": "Filtruj po siłowni",
|
||||
"allGyms": "Wszystkie siłownie",
|
||||
"noQueryResults": "Brak wyników dla podanego zapytania.",
|
||||
"emptyTitle": "Brak podopiecznych",
|
||||
"emptyDesc": "Wyszukaj osobę po imieniu i nazwisku i wyślij zaproszenie.",
|
||||
"groupOther": "Inne",
|
||||
"commentAdded": "Komentarz dodany",
|
||||
"commentDeleted": "Komentarz usunięty",
|
||||
"archived": "Relacja zarchiwizowana",
|
||||
"createPlan": "Utwórz plan",
|
||||
"writeMessage": "Napisz wiadomość",
|
||||
"archive": "Archiwizuj",
|
||||
"tabOverview": "Przegląd",
|
||||
"tabCalendar": "Kalendarz",
|
||||
"tabHistory": "Historia",
|
||||
"tabProgress": "Postępy",
|
||||
"tabDiscipline": "Dyscyplina",
|
||||
"tabPlans": "Plany",
|
||||
"noSessionsDot": "Brak sesji.",
|
||||
"archiveTitle": "Archiwizuj relację",
|
||||
"archiveDesc": "Czy na pewno chcesz zarchiwizować relację z {{name}}? Podopieczny przestanie być widoczny na Twojej liście.",
|
||||
"convTitle": "Rozmowa",
|
||||
"youPrefix": "Ty: ",
|
||||
"noMessagesYet": "Brak wiadomości — napisz pierwszą.",
|
||||
"basicsTitle": "Podstawowe informacje",
|
||||
"gymsLabel": "Siłownie",
|
||||
"lastSessionLabel": "Ostatnia sesja",
|
||||
"socialLabel": "Social media",
|
||||
"activePlanTitle": "Aktywny plan",
|
||||
"startWord": "start ",
|
||||
"excessSeries": "Nadmiar (serie)",
|
||||
"deficitSeries": "Deficyt (serie)",
|
||||
"nextTraining": "Następny trening",
|
||||
"noActivePlanForTrainee": "Podopieczny nie ma aktywnego planu.",
|
||||
"noDaysInPlan": "Brak dni w aktywnym planie.",
|
||||
"movedDays": "Przesunięte dni",
|
||||
"noMovedDays": "Brak przesuniętych dni.",
|
||||
"movedWord": "przesunięto ",
|
||||
"progressPerExercise": "Postępy per ćwiczenie",
|
||||
"volumePerPart": "Objętość per partia",
|
||||
"volumeDesc": "Faktyczne serie względem planu i zalecanego zakresu: akcent = w zakresie, pomarańcz = >10% powyżej, czerwień = deficyt.",
|
||||
"noPlanReport": "Brak aktywnego planu — raport niedostępny.",
|
||||
"excessWord": "nadmiar",
|
||||
"deficitWord": "deficyt",
|
||||
"outOfRange": "poza zakresem",
|
||||
"noExercises": "Brak ćwiczeń.",
|
||||
"traineeCalendar": "Kalendarz podopiecznego",
|
||||
"plansOfTrainee": "Plany podopiecznego",
|
||||
"noPlansAtAll": "Podopieczny nie ma żadnych planów.",
|
||||
"trainerFallback": "trener"
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ function SelectedDayCard({ day }: { day: CalendarDay }) {
|
||||
<Link to={`/day/${day.id}`} className="mt-4 block">
|
||||
<Button className="w-full sm:w-auto">
|
||||
{inProgress
|
||||
? 'Wróć do treningu'
|
||||
? t('dashboard:backToTraining')
|
||||
: day.status === 'PLANNED'
|
||||
? 'Rozpocznij trening'
|
||||
: 'Pokaż szczegóły'}
|
||||
? t('dashboard:calendar.startTraining')
|
||||
: t('dashboard:calendar.showDetails')}
|
||||
</Button>
|
||||
</Link>
|
||||
</Card>
|
||||
@@ -64,6 +64,7 @@ function SelectedDayCard({ day }: { day: CalendarDay }) {
|
||||
}
|
||||
|
||||
export default function Calendar() {
|
||||
const { t } = useTranslation();
|
||||
const now = new Date();
|
||||
const [month, setMonth] = useState(monthStr(now));
|
||||
const [selectedDayId, setSelectedDayId] = useState<string | null>(null);
|
||||
@@ -74,7 +75,7 @@ export default function Calendar() {
|
||||
};
|
||||
|
||||
useTopbar({
|
||||
title: 'Kalendarz',
|
||||
title: t('dashboard:calendar.pageTitle'),
|
||||
navWidget: <CalendarMonthNav month={month} onMonth={goToMonth} />,
|
||||
});
|
||||
|
||||
@@ -90,7 +91,12 @@ export default function Calendar() {
|
||||
<>
|
||||
<Card>
|
||||
{isLoading && <Skeleton className="h-64" />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
{data && (
|
||||
<MonthGrid
|
||||
|
||||
@@ -16,6 +16,8 @@ import {
|
||||
import { localizedName } from '../lib/localizedName';
|
||||
import { muscleName } from '../lib/labels';
|
||||
import { useTopbar } from '../topbar';
|
||||
import i18n from '../i18n';
|
||||
import { resolveLocaleTag } from '../i18n/language';
|
||||
import { Button, Card, EmptyState, ErrorText, SectionHeader, Skeleton } from '../components/ui';
|
||||
|
||||
/* Czas trwania sesji od startu (M:SS lub H:MM:SS) — liczony przy renderze. */
|
||||
@@ -184,6 +186,7 @@ function SessionHero({
|
||||
to: string;
|
||||
cta: string;
|
||||
}) {
|
||||
const { t } = useTranslation('dashboard');
|
||||
return (
|
||||
<div
|
||||
className="relative mb-4 overflow-hidden rounded-xl border p-5 shadow-[var(--glow),var(--shadow)]"
|
||||
@@ -208,7 +211,7 @@ function SessionHero({
|
||||
<div className="min-w-[190px] flex-1">
|
||||
<div className="flex items-center gap-2 text-[11px] font-bold uppercase tracking-[0.1em] text-accent-text">
|
||||
<span className="live-dot" aria-hidden="true" />
|
||||
Trwa trening
|
||||
{t('trainingInProgress')}
|
||||
</div>
|
||||
<div className="mt-0.5 truncate font-display text-[1.3rem] font-bold tracking-[-0.01em]">
|
||||
{title}
|
||||
@@ -220,7 +223,7 @@ function SessionHero({
|
||||
{elapsed}
|
||||
</div>
|
||||
<div className="mt-1 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
czas sesji
|
||||
{t('sessionTime')}
|
||||
</div>
|
||||
</div>
|
||||
<Link to={to} className="shrink-0">
|
||||
@@ -273,27 +276,24 @@ function SessionBanner({
|
||||
|
||||
/* Karta „Aktualności": ostatnie wpisy feedu (powiadomienia + ogłoszenia siłowni). */
|
||||
function FeedCard() {
|
||||
const { t } = useTranslation('dashboard');
|
||||
const { data } = useFeed(5);
|
||||
const items = data?.pages.flatMap((p) => p.items ?? []) ?? [];
|
||||
return (
|
||||
<Card>
|
||||
<SectionHeader
|
||||
title="Aktualności"
|
||||
title={t('feedTitle')}
|
||||
actions={
|
||||
<Link
|
||||
to="/announcements"
|
||||
className="text-[0.8125rem] font-bold text-accent-text hover:underline"
|
||||
>
|
||||
Zobacz wszystkie
|
||||
{t('seeAll')}
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
{items.length === 0 ? (
|
||||
<EmptyState
|
||||
icon={Megaphone}
|
||||
title="Brak aktualności"
|
||||
description="Tu pojawią się plany od trenera i ogłoszenia siłowni."
|
||||
/>
|
||||
<EmptyState icon={Megaphone} title={t('feedEmptyTitle')} description={t('feedEmptyDesc')} />
|
||||
) : (
|
||||
<div className="-mx-2">
|
||||
{items.map((item) => (
|
||||
@@ -306,7 +306,8 @@ function FeedCard() {
|
||||
}
|
||||
|
||||
export default function Dashboard() {
|
||||
useTopbar({ title: 'Dashboard' });
|
||||
const { t } = useTranslation('dashboard');
|
||||
useTopbar({ title: t('nav:dashboard') });
|
||||
const { i18n } = useTranslation();
|
||||
const { user } = useAuth();
|
||||
const { data, isLoading, error } = useDashboard();
|
||||
@@ -329,14 +330,24 @@ export default function Dashboard() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (error) return <ErrorText>Błąd: {(error as Error).message}</ErrorText>;
|
||||
if (error)
|
||||
return (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
);
|
||||
if (!data) return null;
|
||||
|
||||
const now = new Date();
|
||||
const hour = now.getHours();
|
||||
const greeting =
|
||||
hour >= 22 || hour < 6 ? 'Dobrej nocy' : hour >= 18 ? 'Dobry wieczór' : 'Dzień dobry';
|
||||
const dateLine = now.toLocaleDateString('pl-PL', {
|
||||
hour >= 22 || hour < 6
|
||||
? t('greetingNight')
|
||||
: hour >= 18
|
||||
? t('greetingEvening')
|
||||
: t('greetingDay');
|
||||
const dateLine = now.toLocaleDateString(resolveLocaleTag(i18n.language), {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
@@ -344,7 +355,7 @@ export default function Dashboard() {
|
||||
const weekNo = planWeekNo(data.activePlan?.startDate ?? null);
|
||||
const subParts = [
|
||||
dateLine,
|
||||
weekNo != null && data.activePlan ? `tydzień ${weekNo} planu` : null,
|
||||
weekNo != null && data.activePlan ? t('weekOfPlan', { n: weekNo }) : null,
|
||||
].filter(Boolean);
|
||||
|
||||
const progress = data.progress;
|
||||
@@ -373,13 +384,15 @@ export default function Dashboard() {
|
||||
{active && (
|
||||
<SessionHero
|
||||
title={active.planTitle}
|
||||
subtitle={`start ${new Date(active.startedAt).toLocaleTimeString('pl-PL', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})}`}
|
||||
subtitle={t('sessionStart', {
|
||||
time: new Date(active.startedAt).toLocaleTimeString(resolveLocaleTag(i18n.language), {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
}),
|
||||
})}
|
||||
elapsed={fmtElapsed(active.startedAt)}
|
||||
to={`/day/${active.dayId}`}
|
||||
cta="Wróć do treningu"
|
||||
cta={t('backToTraining')}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -387,9 +400,9 @@ export default function Dashboard() {
|
||||
<SessionBanner
|
||||
icon={Dumbbell}
|
||||
title={data.activePlan.title}
|
||||
subtitle={`Start ${fmtDate(data.activePlan.startDate)}`}
|
||||
subtitle={t('startOn', { date: fmtDate(data.activePlan.startDate) })}
|
||||
to={`/plans/${data.activePlan.id}`}
|
||||
cta="Zobacz plan"
|
||||
cta={t('viewPlan')}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -401,23 +414,23 @@ export default function Dashboard() {
|
||||
<ProgressRing percent={progress?.percent ?? 0} />
|
||||
<div className="min-w-0">
|
||||
<div className="text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Ukończono plan
|
||||
{t('planCompleted')}
|
||||
</div>
|
||||
<div className="mt-1 text-dim text-[0.8125rem]">
|
||||
{progress
|
||||
? `${progress.completed} z ${progress.total} dni`
|
||||
: 'brak aktywnego planu'}
|
||||
{daysLeft != null && daysLeft > 0 ? ` · ${daysPlural(daysLeft)} do końca` : ''}
|
||||
? t('doneOfDays', { completed: progress.completed, total: progress.total })
|
||||
: t('noActivePlanLower')}
|
||||
{daysLeft != null && daysLeft > 0
|
||||
? ` · ${t('toEnd', { days: daysPlural(daysLeft) })}`
|
||||
: ''}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<StatCard
|
||||
label="Tempo w tym tygodniu"
|
||||
label={t('weekTempo')}
|
||||
value={week != null && week.planned > 0 ? `${week.completed}/${week.planned}` : '—'}
|
||||
sub={
|
||||
week != null && week.planned > 0
|
||||
? 'ukończone / zaplanowane w tym tygodniu'
|
||||
: 'brak treningów w tym tygodniu'
|
||||
week != null && week.planned > 0 ? t('tempoDonePlanned') : t('noTrainingThisWeek')
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@@ -431,16 +444,16 @@ export default function Dashboard() {
|
||||
<div className="mb-4 grid grid-cols-1 gap-4 sm:grid-cols-8">
|
||||
<StatCard
|
||||
className="sm:col-span-3"
|
||||
label="Serie"
|
||||
label={t('setsLabel')}
|
||||
value={history.sets}
|
||||
sub="w ostatnich 12 tygodniach"
|
||||
sub={t('setsLastWeeks')}
|
||||
trailing={<WeekBars values={(data.weeklySets ?? []).map((w) => w.sets)} />}
|
||||
/>
|
||||
<StatCard
|
||||
className="sm:col-span-3"
|
||||
label="Killstreak"
|
||||
label={t('killstreakLabel', { ns: 'trainees' })}
|
||||
value={data.killstreak}
|
||||
sub={`najwyższy wynik: ${daysPlural(killstreakBest)}`}
|
||||
sub={t('bestResult', { days: daysPlural(killstreakBest) })}
|
||||
trailing={
|
||||
data.killstreakDays != null ? <StreakDots days={data.killstreakDays} /> : null
|
||||
}
|
||||
@@ -448,7 +461,7 @@ export default function Dashboard() {
|
||||
{/* Plany + dorobek treningów (liczba na dole po prawej, jak w projekcie). */}
|
||||
<Card className="mb-0 flex min-w-0 flex-col items-start gap-0.5 p-5 sm:col-span-2">
|
||||
<div className="text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Ukończone plany
|
||||
{t('completedPlans')}
|
||||
</div>
|
||||
<div className="font-display text-[1.9rem] font-bold leading-tight tracking-[-0.02em] tabular-nums">
|
||||
{history.completedPlans}
|
||||
@@ -458,7 +471,7 @@ export default function Dashboard() {
|
||||
{history.sessions}
|
||||
</div>
|
||||
<div className="text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
ukończone treningi
|
||||
{t('completedWorkouts')}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -470,7 +483,7 @@ export default function Dashboard() {
|
||||
<Card>
|
||||
<div className="mb-1.5 flex flex-wrap items-baseline justify-between gap-2">
|
||||
<div className="flex min-w-0 flex-wrap items-baseline gap-x-3">
|
||||
<SectionHeader title="Następny trening" />
|
||||
<SectionHeader title={t('nextTraining')} />
|
||||
{data.nextTraining && (
|
||||
<span className="text-accent-text text-[1.25rem] font-bold tracking-[-0.01em]">
|
||||
{daysCountdown(daysFromToday(data.nextTraining.date))}
|
||||
@@ -479,11 +492,14 @@ export default function Dashboard() {
|
||||
</div>
|
||||
{data.nextTraining ? (
|
||||
<span className="text-dim text-[0.8125rem]">
|
||||
{new Date(data.nextTraining.date).toLocaleDateString('pl-PL', {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
})}
|
||||
{new Date(data.nextTraining.date).toLocaleDateString(
|
||||
resolveLocaleTag(i18n.language),
|
||||
{
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
},
|
||||
)}
|
||||
</span>
|
||||
) : (
|
||||
!data.activePlan && (
|
||||
@@ -491,7 +507,7 @@ export default function Dashboard() {
|
||||
to="/plans/new"
|
||||
className="text-[0.8125rem] font-bold text-accent-text hover:underline"
|
||||
>
|
||||
Utwórz plan
|
||||
{t('createPlan')}
|
||||
</Link>
|
||||
)
|
||||
)}
|
||||
@@ -518,8 +534,8 @@ export default function Dashboard() {
|
||||
<Button variant="secondary">
|
||||
<Play className="h-4 w-4" />
|
||||
{active?.dayId === data.nextTraining.dayId
|
||||
? 'Wróć do treningu'
|
||||
: 'Wykonaj trening'}
|
||||
? t('backToTraining')
|
||||
: t('doTraining')}
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
@@ -527,13 +543,13 @@ export default function Dashboard() {
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={CalendarPlus}
|
||||
title={data.activePlan ? 'Brak nadchodzących treningów' : 'Brak aktywnego planu'}
|
||||
title={data.activePlan ? t('noUpcoming') : t('noActivePlanTitle')}
|
||||
description={
|
||||
data.lastSessionAt != null
|
||||
? daysBehindMessage(-daysFromToday(data.lastSessionAt))
|
||||
: data.activePlan
|
||||
? 'Wszystko zrobione — czekaj na kolejny dzień z planu.'
|
||||
: 'Utwórz plan, aby rozpocząć treningi.'
|
||||
? t('allDone')
|
||||
: t('createPlanDesc')
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -850,7 +850,7 @@ function AnnouncementsSection({ gymId }: { gymId: string }) {
|
||||
type="button"
|
||||
onClick={() => void remove(a.id)}
|
||||
>
|
||||
Usuń
|
||||
{t('common:remove')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Building2,
|
||||
ChevronRight,
|
||||
@@ -25,14 +26,6 @@ import { Badge, Card, Skeleton } from '../../components/ui';
|
||||
import { Avatar } from '../../components/Avatar';
|
||||
import { useTopbar } from '../../topbar';
|
||||
|
||||
function sessionCountLabel(n: number) {
|
||||
const mod10 = n % 10;
|
||||
const mod100 = n % 100;
|
||||
if (mod10 === 1 && mod100 !== 11) return `${n} sesja`;
|
||||
if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) return `${n} sesje`;
|
||||
return `${n} sesji`;
|
||||
}
|
||||
|
||||
/** Mini-statystyka: ikona + etykieta + wartość. */
|
||||
function MiniStat({
|
||||
icon: Icon,
|
||||
@@ -92,7 +85,8 @@ function SectionLink({
|
||||
* i sekcje jako kompaktowe wiersze-listy (mobile: kolumna, sm+: siatka 2 kol.).
|
||||
*/
|
||||
export default function Profile() {
|
||||
useTopbar({ title: 'Profil' });
|
||||
const { t } = useTranslation('profile');
|
||||
useTopbar({ title: t('nav:profile') });
|
||||
const { data: meData, isLoading: meLoading } = useMe();
|
||||
const { data: bp } = useBodyParameters();
|
||||
const { data: hist } = useHistory();
|
||||
@@ -118,7 +112,7 @@ export default function Profile() {
|
||||
const user = meData?.user;
|
||||
const name = displayName(user ?? {});
|
||||
const ageHeight = [
|
||||
user?.age != null ? `${user.age} lat` : null,
|
||||
user?.age != null ? t('ageYears', { count: user.age }) : null,
|
||||
user?.heightCm != null ? `${user.heightCm} cm` : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
@@ -129,7 +123,7 @@ export default function Profile() {
|
||||
const latestWeight = weightPoints[weightPoints.length - 1];
|
||||
const weightSummary = latestWeight
|
||||
? `${latestWeight.value} kg · ${fmtDate(latestWeight.date)}`
|
||||
: 'brak pomiarów';
|
||||
: t('noMeasurements');
|
||||
|
||||
// sesje: liczba + ostatnia data (summary wiersza „Historia") + objętość z 7 dni (Σ planowane kg × powt.)
|
||||
const sessions = hist?.sessions ?? [];
|
||||
@@ -139,8 +133,8 @@ export default function Profile() {
|
||||
);
|
||||
const historySummary =
|
||||
sessions.length > 0
|
||||
? `${sessionCountLabel(sessions.length)} · ostatnia ${fmtDate(lastSession!)}`
|
||||
: 'brak sesji';
|
||||
? `${t('common:counters.sessions', { count: sessions.length })} · ${t('lastWord')} ${fmtDate(lastSession!)}`
|
||||
: t('noSessions');
|
||||
const weekAgo = Date.now() - 7 * 24 * 3600 * 1000;
|
||||
const volume7d = sessions
|
||||
.filter((s) => new Date(s.startedAt).getTime() >= weekAgo)
|
||||
@@ -153,28 +147,20 @@ export default function Profile() {
|
||||
);
|
||||
|
||||
const gyms = gymsData?.gyms ?? [];
|
||||
const gymsSummary = gyms.length > 0 ? gyms.map((g) => g.name).join(', ') : 'brak';
|
||||
const gymsSummary = gyms.length > 0 ? gyms.map((g) => g.name).join(', ') : t('none');
|
||||
|
||||
const claims = claimsData?.claims ?? [];
|
||||
const pendingClaims = claims.filter((c) => c.status === 'PENDING').length;
|
||||
const claimsSummary =
|
||||
claims.length === 0
|
||||
? 'brak'
|
||||
? t('none')
|
||||
: pendingClaims > 0
|
||||
? `${pendingClaims} oczekujących`
|
||||
: `${claims.length} rozstrzygniętych`;
|
||||
? t('claimsPending', { count: pendingClaims })
|
||||
: t('claimsResolved', { count: claims.length });
|
||||
|
||||
const progressCount = (progressData?.exercises ?? []).length;
|
||||
const progressSummary =
|
||||
progressCount > 0
|
||||
? `${progressCount} ${
|
||||
progressCount === 1
|
||||
? 'ćwiczenie'
|
||||
: progressCount < 5 && progressCount % 10 >= 2 && progressCount % 10 <= 4
|
||||
? 'ćwiczenia'
|
||||
: 'ćwiczeń'
|
||||
}`
|
||||
: 'brak danych';
|
||||
progressCount > 0 ? t('common:counters.exercises', { count: progressCount }) : t('noData');
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -194,17 +180,17 @@ export default function Profile() {
|
||||
<div className="mb-4 grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
<MiniStat
|
||||
icon={Flame}
|
||||
label="Killstreak"
|
||||
label={t('killstreak')}
|
||||
value={dash?.killstreak != null ? String(dash.killstreak) : '—'}
|
||||
/>
|
||||
<MiniStat
|
||||
icon={Dumbbell}
|
||||
label="Objętość 7 dni"
|
||||
label={t('volume7d')}
|
||||
value={volume7d > 0 ? fmtVolume(volume7d) : '—'}
|
||||
/>
|
||||
<MiniStat
|
||||
icon={History}
|
||||
label="Sesje"
|
||||
label={t('sessionsLabel')}
|
||||
value={sessions.length > 0 ? String(sessions.length) : '—'}
|
||||
/>
|
||||
</div>
|
||||
@@ -215,19 +201,19 @@ export default function Profile() {
|
||||
<div className="divide-y divide-line">
|
||||
<SectionLink
|
||||
to="/profile/info"
|
||||
title="Dane osobowe"
|
||||
title={t('secPersonal')}
|
||||
icon={User}
|
||||
summary={ageHeight ? `${name} · ${ageHeight}` : name}
|
||||
/>
|
||||
<SectionLink
|
||||
to="/profile/body-parameters"
|
||||
title="Parametry ciała"
|
||||
title={t('secBody')}
|
||||
icon={Scale}
|
||||
summary={weightSummary}
|
||||
/>
|
||||
<SectionLink
|
||||
to="/profile/history"
|
||||
title="Historia treningów"
|
||||
title={t('secHistory')}
|
||||
icon={History}
|
||||
summary={historySummary}
|
||||
/>
|
||||
@@ -235,14 +221,14 @@ export default function Profile() {
|
||||
<div className="divide-y divide-line">
|
||||
<SectionLink
|
||||
to="/profile/progress"
|
||||
title="Postępy"
|
||||
title={t('secProgress')}
|
||||
icon={TrendingUp}
|
||||
summary={progressSummary}
|
||||
/>
|
||||
<SectionLink to="/gyms" title="Siłownie" icon={Building2} summary={gymsSummary} />
|
||||
<SectionLink to="/gyms" title={t('nav:gyms')} icon={Building2} summary={gymsSummary} />
|
||||
<SectionLink
|
||||
to="/profile/claims"
|
||||
title="Wnioski"
|
||||
title={t('secClaims')}
|
||||
icon={FileText}
|
||||
summary={claimsSummary}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useMemo, useRef, useState, type ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Plus,
|
||||
Ruler,
|
||||
@@ -25,6 +26,8 @@ import {
|
||||
CartesianGrid,
|
||||
} from 'recharts';
|
||||
import { fmtDate } from '../../lib/format';
|
||||
import i18n from '../../i18n';
|
||||
import { resolveLocaleTag } from '../../i18n/language';
|
||||
import {
|
||||
BackButton,
|
||||
Button,
|
||||
@@ -140,16 +143,12 @@ interface PartGroup {
|
||||
sidesPresent: Side[];
|
||||
}
|
||||
|
||||
/* Polski pluralis dla „pomiar”. */
|
||||
function pomN(n: number): string {
|
||||
if (n === 1) return '1 pomiar';
|
||||
if (n % 10 >= 2 && n % 10 <= 4 && !(n % 100 >= 12 && n % 100 <= 14)) return `${n} pomiary`;
|
||||
return `${n} pomiarów`;
|
||||
}
|
||||
/* Pomiar — liczownik przez i18n (common:counters.measurements). */
|
||||
|
||||
const WEIGHT_KEY = 'weight';
|
||||
|
||||
const fmtVal = (n: number) => n.toLocaleString('pl-PL', { maximumFractionDigits: 1 });
|
||||
const fmtVal = (n: number) =>
|
||||
n.toLocaleString(resolveLocaleTag(i18n.language), { maximumFractionDigits: 1 });
|
||||
const signed = (d: number) => `${d < 0 ? '−' : '+'}${fmtVal(Math.abs(d))}`;
|
||||
|
||||
/* Postęp części: zmiana najnowszego pomiaru od pierwszego; spadek wagi = dobry kierunek. */
|
||||
@@ -161,7 +160,10 @@ function progressOf(g: { unit: 'kg' | 'cm'; points: GroupPoint[] }): {
|
||||
const d = g.points[g.points.length - 1].value - g.points[0].value;
|
||||
if (d === 0) return null;
|
||||
const className = g.unit === 'kg' ? (d < 0 ? 'text-accent-text' : 'text-warn') : 'text-ink';
|
||||
return { text: `${signed(d)} ${g.unit} od pierwszego`, className };
|
||||
return {
|
||||
text: i18n.t('profile:progressFromFirst', { delta: signed(d), unit: g.unit }),
|
||||
className,
|
||||
};
|
||||
}
|
||||
|
||||
/* Osobny div postępu wybranej części: kierunek zmiany + wynik (strony osobno, gdy łączone). */
|
||||
@@ -176,6 +178,7 @@ function ProgressCard({
|
||||
primaryClass: string;
|
||||
sub: string;
|
||||
}) {
|
||||
const { t } = useTranslation('profile');
|
||||
const Icon = down ? TrendingDown : TrendingUp;
|
||||
return (
|
||||
<Card className="mb-4">
|
||||
@@ -184,7 +187,7 @@ function ProgressCard({
|
||||
<Icon className="h-4 w-4" />
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<H3 className="mb-0.5">Postęp</H3>
|
||||
<H3 className="mb-0.5">{t('progressTitle')}</H3>
|
||||
<p className={`text-[0.95rem] font-semibold tabular-nums ${primaryClass}`}>{primary}</p>
|
||||
<p className="text-[0.8125rem] text-dim">{sub}</p>
|
||||
</div>
|
||||
@@ -195,7 +198,7 @@ function ProgressCard({
|
||||
|
||||
/** Etykieta osi X: `17.10`; gdy historia przekracza rok — `17.10.26`. */
|
||||
function axisDateLabel(iso: string, withYear: boolean): string {
|
||||
return new Date(iso).toLocaleDateString('pl-PL', {
|
||||
return new Date(iso).toLocaleDateString(resolveLocaleTag(i18n.language), {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
...(withYear ? { year: '2-digit' } : {}),
|
||||
@@ -397,6 +400,7 @@ function PartSection({
|
||||
onDelete: (target: { kind: 'weight' | 'circumference'; id: string; label: string }) => void;
|
||||
sideName: (side: Side) => string;
|
||||
}) {
|
||||
const { t } = useTranslation('profile');
|
||||
const latest = points[points.length - 1];
|
||||
// historia przekracza rok → oś X z rokiem (również przy przerwie >12 mies. w jednym roku)
|
||||
const withYear =
|
||||
@@ -404,12 +408,12 @@ function PartSection({
|
||||
300 * 86_400_000;
|
||||
// postęp sekcji (dla strony: osobna, przy łączonej: per strona): zmiana od pierwszego pomiaru
|
||||
const prog = progressOf({ unit, points });
|
||||
const primary = prog?.text ?? 'bez zmian';
|
||||
const primary = prog?.text ?? t('noChange');
|
||||
const primaryClass = prog?.className ?? 'text-dim';
|
||||
const sub =
|
||||
points.length < 2
|
||||
? 'drugi pomiar pokaże zmianę'
|
||||
: `${pomN(points.length)} · pierwszy → ostatni`;
|
||||
? t('secondHint')
|
||||
: `${t('common:counters.measurements', { count: points.length })} · ${t('firstToLast')}`;
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -450,7 +454,7 @@ function PartSection({
|
||||
height={220}
|
||||
/>
|
||||
) : (
|
||||
<p className="text-dim">Za mało danych na wykres (min. 2 pomiary).</p>
|
||||
<p className="text-dim">{t('chartNoData')}</p>
|
||||
)}
|
||||
|
||||
{/* lista: najnowsze 3 + „Pokaż więcej" (kolejne 3); pełna historia w wykresie */}
|
||||
@@ -479,7 +483,10 @@ function PartSection({
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Usuń pomiar ${p.name} z ${fmtDate(p.date)}`}
|
||||
aria-label={t('removeMeasurementAria', {
|
||||
name: p.name,
|
||||
date: fmtDate(p.date),
|
||||
})}
|
||||
onClick={() =>
|
||||
onDelete({
|
||||
kind,
|
||||
@@ -498,7 +505,7 @@ function PartSection({
|
||||
</ul>
|
||||
{points.length > visible && (
|
||||
<Button variant="ghost" size="sm" className="mt-2" onClick={onShowMore}>
|
||||
Pokaż więcej
|
||||
{t('common:showMore')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -550,12 +557,13 @@ function AddMeasurementModal({
|
||||
measurementLabel: (typeId: string) => string;
|
||||
sideLabel: (side: Side, gender: Gender) => string;
|
||||
}) {
|
||||
const { t } = useTranslation('profile');
|
||||
return (
|
||||
<Modal open={open} onClose={onClose} title="Dodaj pomiar">
|
||||
<Modal open={open} onClose={onClose} title={t('addMeasurement')}>
|
||||
<Tabs
|
||||
tabs={[
|
||||
{ id: 'weight', label: 'Waga' },
|
||||
{ id: 'circ', label: 'Obwód' },
|
||||
{ id: 'weight', label: t('tabWeight') },
|
||||
{ id: 'circ', label: t('tabCirc') },
|
||||
]}
|
||||
active={tab}
|
||||
onChange={(id) => onTabChange(id === 'circ' ? 'circ' : 'weight')}
|
||||
@@ -565,27 +573,27 @@ function AddMeasurementModal({
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
placeholder="waga (kg)"
|
||||
placeholder={t('weightPlaceholder')}
|
||||
value={weight}
|
||||
onChange={(e) => onWeightChange(e.target.value)}
|
||||
/>
|
||||
<Field label="Data">
|
||||
<Field label={t('dateField')}>
|
||||
<Input
|
||||
type="date"
|
||||
value={weightDate}
|
||||
onChange={(e) => onWeightDateChange(e.target.value)}
|
||||
aria-label="Data wagi"
|
||||
aria-label={t('weightDateAria')}
|
||||
/>
|
||||
</Field>
|
||||
<Button type="submit">
|
||||
<Plus className="w-4 h-4" />
|
||||
Dodaj wagę
|
||||
{t('addWeight')}
|
||||
</Button>
|
||||
</form>
|
||||
) : (
|
||||
<form onSubmit={onSaveCirc} className="flex flex-col gap-3 mt-4">
|
||||
<Select
|
||||
aria-label="Rodzaj pomiaru"
|
||||
aria-label={t('measureTypeAria')}
|
||||
value={circType}
|
||||
onChange={(e) => onCircTypeChange(e.target.value)}
|
||||
>
|
||||
@@ -596,11 +604,11 @@ function AddMeasurementModal({
|
||||
))}
|
||||
</Select>
|
||||
{measurementType(circType)?.sided && (
|
||||
<Field label="Strona">
|
||||
<Field label={t('sideField')}>
|
||||
<div
|
||||
className="inline-flex overflow-hidden rounded-xl border border-line bg-input"
|
||||
role="group"
|
||||
aria-label="Strona"
|
||||
aria-label={t('sideField')}
|
||||
>
|
||||
{(['left', 'right'] as Side[]).map((s) => (
|
||||
<button
|
||||
@@ -623,21 +631,21 @@ function AddMeasurementModal({
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
placeholder="wartość (cm)"
|
||||
placeholder={t('circPlaceholder')}
|
||||
value={circValue}
|
||||
onChange={(e) => onCircValueChange(e.target.value)}
|
||||
/>
|
||||
<Field label="Data">
|
||||
<Field label={t('dateField')}>
|
||||
<Input
|
||||
type="date"
|
||||
value={circDate}
|
||||
onChange={(e) => onCircDateChange(e.target.value)}
|
||||
aria-label="Data obwodu"
|
||||
aria-label={t('circDateAria')}
|
||||
/>
|
||||
</Field>
|
||||
<Button type="submit">
|
||||
<Plus className="w-4 h-4" />
|
||||
Dodaj obwód
|
||||
{t('addCirc')}
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
@@ -646,6 +654,7 @@ function AddMeasurementModal({
|
||||
}
|
||||
|
||||
export default function ProfileBodyParameters() {
|
||||
const { t } = useTranslation('profile');
|
||||
const { data: bp, isLoading: bpLoading, refetch: refetchBp } = useBodyParameters();
|
||||
const { push } = useToast();
|
||||
const { measurementLabel, genderOf, sideLabel } = useMeasurementLabels();
|
||||
@@ -671,9 +680,9 @@ export default function ProfileBodyParameters() {
|
||||
// menu top: jedyna akcja strony (tworzenie pomiaru) — treść = dane i wybór części
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: 'Profil',
|
||||
title: t('nav:profile'),
|
||||
back: '/profile',
|
||||
actions: [{ label: 'Dodaj pomiar', onClick: () => setAddOpen(true), icon: Plus }],
|
||||
actions: [{ label: t('addMeasurement'), onClick: () => setAddOpen(true), icon: Plus }],
|
||||
});
|
||||
|
||||
// lista panelu: 3 najnowsze + „Pokaż więcej" (kolejne 3)
|
||||
@@ -696,7 +705,7 @@ export default function ProfileBodyParameters() {
|
||||
value: w.value,
|
||||
date: w.date,
|
||||
side: null,
|
||||
name: 'wagi',
|
||||
name: t('weightGenitive'),
|
||||
})),
|
||||
sidesPresent: [],
|
||||
});
|
||||
@@ -728,7 +737,7 @@ export default function ProfileBodyParameters() {
|
||||
});
|
||||
}
|
||||
return list;
|
||||
}, [bp, measurementLabel, genderOf, sideLabel]);
|
||||
}, [bp, measurementLabel, genderOf, sideLabel, t]);
|
||||
|
||||
// wybrana część odpada (brak danych) → pierwsza dostępna
|
||||
const active = groups.find((g) => g.key === selected) ?? groups[0];
|
||||
@@ -747,9 +756,9 @@ export default function ProfileBodyParameters() {
|
||||
setAddOpen(false);
|
||||
setSelected(WEIGHT_KEY);
|
||||
await refetchBp();
|
||||
push('Waga dodana', 'success');
|
||||
push(t('weightAdded'), 'success');
|
||||
} catch (err) {
|
||||
push(err instanceof Error ? err.message : 'Błąd zapisu', 'error');
|
||||
push(err instanceof Error ? err.message : t('saveError'), 'error');
|
||||
} finally {
|
||||
savingRef.current = false;
|
||||
}
|
||||
@@ -773,9 +782,9 @@ export default function ProfileBodyParameters() {
|
||||
// dodany pomiar od razu widoczny w panelu jego części
|
||||
setSelected(`t:${circType}`);
|
||||
await refetchBp();
|
||||
push('Obwód dodany', 'success');
|
||||
push(t('circAdded'), 'success');
|
||||
} catch (err) {
|
||||
push(err instanceof Error ? err.message : 'Błąd zapisu', 'error');
|
||||
push(err instanceof Error ? err.message : t('saveError'), 'error');
|
||||
} finally {
|
||||
savingRef.current = false;
|
||||
}
|
||||
@@ -790,9 +799,9 @@ export default function ProfileBodyParameters() {
|
||||
if (kind === 'weight') await removeWeightPoint(id);
|
||||
else await removeCircumferencePoint(id);
|
||||
await refetchBp();
|
||||
push('Pomiar usunięty', 'success');
|
||||
push(t('measurementRemoved'), 'success');
|
||||
} catch (e) {
|
||||
push(e instanceof Error ? e.message : 'Błąd', 'error');
|
||||
push(e instanceof Error ? e.message : t('common:error'), 'error');
|
||||
} finally {
|
||||
setRemoveBusy(false);
|
||||
}
|
||||
@@ -810,13 +819,13 @@ export default function ProfileBodyParameters() {
|
||||
return (
|
||||
<>
|
||||
{/* podstrona: h2 z nazwą sekcji + „Wstecz” (na telefonie additionally „<” w topmenu) */}
|
||||
<PageHeader title="Parametry ciała" actions={<BackButton to="/profile" />} />
|
||||
<PageHeader title={t('secBody')} actions={<BackButton to="/profile" />} />
|
||||
|
||||
{active == null ? (
|
||||
<EmptyState
|
||||
icon={Scale}
|
||||
title="Brak pomiarów"
|
||||
description="Dodaj pierwszy pomiar, aby śledzić postęp."
|
||||
title={t('noMeasurementsTitle')}
|
||||
description={t('noMeasurementsDesc')}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
@@ -867,9 +876,9 @@ export default function ProfileBodyParameters() {
|
||||
open={removeTarget != null}
|
||||
onClose={() => setRemoveTarget(null)}
|
||||
onConfirm={confirmRemove}
|
||||
title="Usunąć pomiar?"
|
||||
description={removeTarget ? `${removeTarget.label} zostanie trwale usunięty.` : ''}
|
||||
confirmLabel="Usuń"
|
||||
title={t('removeConfirmTitle')}
|
||||
description={removeTarget ? t('removeConfirmDesc', { label: removeTarget.label }) : ''}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={removeBusy}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { FileText, Plus } from 'lucide-react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
@@ -23,11 +24,11 @@ import ClaimModal, { type ClaimInitial } from '../../components/gyms/ClaimModal'
|
||||
|
||||
const CLAIM_STATUS: Record<
|
||||
GymClaim['status'],
|
||||
{ label: string; color: 'yellow' | 'green' | 'red' }
|
||||
{ labelKey: string; color: 'yellow' | 'green' | 'red' }
|
||||
> = {
|
||||
PENDING: { label: 'Oczekuje', color: 'yellow' },
|
||||
APPROVED: { label: 'Zatwierdzony', color: 'green' },
|
||||
REJECTED: { label: 'Odrzucony', color: 'red' },
|
||||
PENDING: { labelKey: 'statusPending', color: 'yellow' },
|
||||
APPROVED: { labelKey: 'statusApproved', color: 'green' },
|
||||
REJECTED: { labelKey: 'statusRejected', color: 'red' },
|
||||
};
|
||||
|
||||
function claimTitle(claim: GymClaim) {
|
||||
@@ -35,6 +36,7 @@ function claimTitle(claim: GymClaim) {
|
||||
}
|
||||
|
||||
export default function ProfileClaims() {
|
||||
const { t } = useTranslation('profile');
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
const { push } = useToast();
|
||||
@@ -48,9 +50,9 @@ export default function ProfileClaims() {
|
||||
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: 'Profil',
|
||||
title: t('nav:profile'),
|
||||
back: '/profile',
|
||||
actions: [{ label: 'Nowy wniosek o siłownię', icon: Plus, onClick: () => setNewOpen(true) }],
|
||||
actions: [{ label: t('newClaimAction'), icon: Plus, onClick: () => setNewOpen(true) }],
|
||||
});
|
||||
|
||||
const withdraw = async (claimId: string) => {
|
||||
@@ -58,7 +60,7 @@ export default function ProfileClaims() {
|
||||
try {
|
||||
await withdrawGymClaim(claimId);
|
||||
await queryClient.invalidateQueries({ queryKey: ['gyms', 'claims'] });
|
||||
push('Wniosek wycofany', 'success');
|
||||
push(t('claimWithdrawn'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
} finally {
|
||||
@@ -71,21 +73,29 @@ export default function ProfileClaims() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Wnioski" actions={<BackButton onClick={() => navigate('/profile')} />} />
|
||||
<PageHeader
|
||||
title={t('secClaims')}
|
||||
actions={<BackButton onClick={() => navigate('/profile')} />}
|
||||
/>
|
||||
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
{!isLoading && !error && claims.length === 0 && (
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={FileText}
|
||||
title="Brak wniosków"
|
||||
description="Składając wniosek o nową realną siłownię lub o weryfikację wirtualnej, zobaczysz go tutaj."
|
||||
title={t('claimsEmptyTitle')}
|
||||
description={t('claimsEmptyDesc')}
|
||||
action={
|
||||
<Button size="sm" onClick={() => setNewOpen(true)}>
|
||||
<Plus className="w-4 h-4" />
|
||||
Nowy wniosek
|
||||
{t('newClaimShort')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
@@ -105,14 +115,15 @@ export default function ProfileClaims() {
|
||||
<>
|
||||
<span className="flex flex-wrap items-center gap-2">
|
||||
<Badge color={c.type === 'verification' ? 'blue' : 'green'}>
|
||||
{c.type === 'verification' ? 'Weryfikacja wirtualnej' : 'Nowa siłownia'}
|
||||
{c.type === 'verification' ? t('typeVerification') : t('typeNewGym')}
|
||||
</Badge>
|
||||
<Badge color={status.color}>{status.label}</Badge>
|
||||
złożono {fmtDate(c.createdAt)}
|
||||
<Badge color={status.color}>{t(status.labelKey)}</Badge>
|
||||
{t('submittedWord')} {fmtDate(c.createdAt)}
|
||||
</span>
|
||||
{c.status === 'REJECTED' && c.rejectReason && (
|
||||
<span className="mt-1 block text-[0.875rem] text-danger">
|
||||
Powód: {c.rejectReason}
|
||||
{t('reasonPrefix')}
|
||||
{c.rejectReason}
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
@@ -127,12 +138,12 @@ export default function ProfileClaims() {
|
||||
disabled={busyId === c.id}
|
||||
onClick={() => setWithdrawTarget(c)}
|
||||
>
|
||||
Wycofaj
|
||||
{t('withdraw')}
|
||||
</Button>
|
||||
)}
|
||||
{c.status === 'REJECTED' && (
|
||||
<Button size="sm" variant="secondary" onClick={() => setResubmit(c)}>
|
||||
Złóż ponownie
|
||||
{t('resubmit')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -142,7 +153,9 @@ export default function ProfileClaims() {
|
||||
})}
|
||||
</div>
|
||||
{pendingCount > 0 && (
|
||||
<p className="mt-3 text-[0.875rem] text-dim">Oczekujące wnioski: {pendingCount}</p>
|
||||
<p className="mt-3 text-[0.875rem] text-dim">
|
||||
{t('pendingList', { count: pendingCount })}
|
||||
</p>
|
||||
)}
|
||||
</Card>
|
||||
)}
|
||||
@@ -152,11 +165,11 @@ export default function ProfileClaims() {
|
||||
open={withdrawTarget != null}
|
||||
onClose={() => setWithdrawTarget(null)}
|
||||
onConfirm={() => withdrawTarget && void withdraw(withdrawTarget.id)}
|
||||
title="Wycofać wniosek?"
|
||||
title={t('withdrawConfirmTitle')}
|
||||
description={
|
||||
withdrawTarget ? `${claimTitle(withdrawTarget)} — wniosek zostanie trwale wycofany.` : ''
|
||||
withdrawTarget ? t('withdrawConfirmDesc', { name: claimTitle(withdrawTarget) }) : ''
|
||||
}
|
||||
confirmLabel="Wycofaj"
|
||||
confirmLabel={t('withdraw')}
|
||||
danger
|
||||
busy={busyId != null}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { History } from 'lucide-react';
|
||||
@@ -10,6 +11,7 @@ import { MonthPickerCore, useTopbar } from '../../topbar';
|
||||
import { useHistoryMonth } from '../../store/history-month';
|
||||
|
||||
export default function ProfileHistory() {
|
||||
const { t } = useTranslation('profile');
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
const { push } = useToast();
|
||||
@@ -34,7 +36,7 @@ export default function ProfileHistory() {
|
||||
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: 'Profil',
|
||||
title: t('nav:profile'),
|
||||
back: '/profile',
|
||||
dateFilter: (
|
||||
<MonthPickerCore
|
||||
@@ -55,7 +57,7 @@ export default function ProfileHistory() {
|
||||
try {
|
||||
await addMyComment(args);
|
||||
await queryClient.invalidateQueries({ queryKey: ['me', 'history'] });
|
||||
push('Komentarz dodany', 'success');
|
||||
push(t('commentAdded'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
}
|
||||
@@ -65,7 +67,7 @@ export default function ProfileHistory() {
|
||||
try {
|
||||
await deleteComment(commentId, 'me');
|
||||
await queryClient.invalidateQueries({ queryKey: ['me', 'history'] });
|
||||
push('Komentarz usunięty', 'success');
|
||||
push(t('commentDeleted'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
}
|
||||
@@ -87,21 +89,22 @@ export default function ProfileHistory() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Historia treningów"
|
||||
title={t('secHistory')}
|
||||
actions={<BackButton onClick={() => navigate('/profile')} />}
|
||||
/>
|
||||
|
||||
<Card>
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!error && sessions.length === 0 && (
|
||||
<EmptyState
|
||||
icon={History}
|
||||
title={month ? 'Brak sesji w wybranym miesiącu' : 'Brak sesji'}
|
||||
description={
|
||||
month
|
||||
? 'Wybierz inny miesiąc lub „Wszystkie”, aby zobaczyć pełną historię.'
|
||||
: 'Ukończ pierwszy trening, aby zobaczyć historię.'
|
||||
}
|
||||
title={month ? t('emptyMonthTitle') : t('emptyNoSessions')}
|
||||
description={month ? t('emptyMonthDesc') : t('emptyAllDesc')}
|
||||
/>
|
||||
)}
|
||||
{!error && sessions.length > 0 && (
|
||||
|
||||
@@ -65,8 +65,8 @@ const MUSCLE_TONES = {
|
||||
/* podświetlenie grupy w karcie ciągu (bg + border lewy + kolor tekstu) */
|
||||
tint: 'border-accent/40 bg-accent/10',
|
||||
dot: 'bg-accent',
|
||||
label: 'Co rozwija',
|
||||
chainPrefix: 'do rozwoju: ',
|
||||
labelKey: 'toneDevelop',
|
||||
chainPrefixKey: 'chainPrefixDevelop',
|
||||
},
|
||||
canDo: {
|
||||
active: 'bg-info/15 text-info border-info/40',
|
||||
@@ -74,8 +74,8 @@ const MUSCLE_TONES = {
|
||||
text: 'text-info',
|
||||
tint: 'border-info/40 bg-info/10',
|
||||
dot: 'bg-info',
|
||||
label: 'Co potrafi',
|
||||
chainPrefix: '',
|
||||
labelKey: 'toneCanDo',
|
||||
chainPrefixKey: '',
|
||||
},
|
||||
difficult: {
|
||||
active: 'bg-warn/15 text-warn border-warn/40',
|
||||
@@ -83,8 +83,8 @@ const MUSCLE_TONES = {
|
||||
text: 'text-warn',
|
||||
tint: 'border-warn/40 bg-warn/10',
|
||||
dot: 'bg-warn',
|
||||
label: 'Co trudne',
|
||||
chainPrefix: '',
|
||||
labelKey: 'toneDifficult',
|
||||
chainPrefixKey: '',
|
||||
},
|
||||
avoid: {
|
||||
active: 'bg-danger/15 text-danger border-danger/40',
|
||||
@@ -92,8 +92,8 @@ const MUSCLE_TONES = {
|
||||
text: 'text-danger',
|
||||
tint: 'border-danger/40 bg-danger/10',
|
||||
dot: 'bg-danger',
|
||||
label: 'Co unikać',
|
||||
chainPrefix: 'unikamy: ',
|
||||
labelKey: 'toneAvoid',
|
||||
chainPrefixKey: 'chainPrefixAvoid',
|
||||
},
|
||||
} as const;
|
||||
type MuscleTone = keyof typeof MUSCLE_TONES;
|
||||
@@ -176,8 +176,11 @@ function hostOf(url: string): string {
|
||||
}
|
||||
|
||||
function SocialTile({ entry }: { entry: SocialMediaEntry }) {
|
||||
const { t } = useTranslation('profile');
|
||||
const label =
|
||||
entry.platform === 'OTHER' ? entry.label || 'Inne' : SOCIAL_MEDIA_LABELS[entry.platform];
|
||||
entry.platform === 'OTHER'
|
||||
? entry.label || t('common:socialMedia.OTHER')
|
||||
: SOCIAL_MEDIA_LABELS[entry.platform];
|
||||
const brand = SOCIAL_BRAND[entry.platform];
|
||||
return (
|
||||
<a
|
||||
@@ -254,12 +257,13 @@ function SocialMediaEditor({
|
||||
onAdd: () => void;
|
||||
onRemove: (index: number) => void;
|
||||
}) {
|
||||
const { t } = useTranslation('profile');
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{entries.map((s, i) => (
|
||||
<div key={i} className="flex flex-col gap-2 sm:flex-row sm:items-center">
|
||||
<Select
|
||||
aria-label="Platforma"
|
||||
aria-label={t('platformAria')}
|
||||
value={s.platform}
|
||||
onChange={(e) =>
|
||||
onPatch(i, {
|
||||
@@ -271,7 +275,7 @@ function SocialMediaEditor({
|
||||
>
|
||||
{(Object.keys(SOCIAL_MEDIA_LABELS) as SocialMediaPlatform[]).map((p) => (
|
||||
<option key={p} value={p}>
|
||||
{SOCIAL_MEDIA_LABELS[p]}
|
||||
{p === 'OTHER' ? t('common:socialMedia.OTHER') : SOCIAL_MEDIA_LABELS[p]}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
@@ -284,7 +288,7 @@ function SocialMediaEditor({
|
||||
/>
|
||||
{s.platform === 'OTHER' && (
|
||||
<Input
|
||||
placeholder="Etykieta"
|
||||
placeholder={t('labelField')}
|
||||
value={s.label ?? ''}
|
||||
maxLength={50}
|
||||
onChange={(e) => onPatch(i, { label: e.target.value })}
|
||||
@@ -295,7 +299,7 @@ function SocialMediaEditor({
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
aria-label="Usuń social media"
|
||||
aria-label={t('removeSocialAria')}
|
||||
onClick={() => onRemove(i)}
|
||||
className="shrink-0 self-end sm:self-center"
|
||||
>
|
||||
@@ -305,7 +309,7 @@ function SocialMediaEditor({
|
||||
))}
|
||||
<Button type="button" variant="secondary" size="sm" onClick={onAdd}>
|
||||
<Plus className="w-4 h-4" />
|
||||
Dodaj social media
|
||||
{t('addSocial')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
@@ -314,47 +318,47 @@ function SocialMediaEditor({
|
||||
/* Ciąg przyczynowo-skutkowy: 4 kafelki w tonie grupy (kolor spójny z „Priorytety
|
||||
i wykluczenia”); puste tony wyciszone. Nazwy mięśni ujednolicone z resztą aplikacji. */
|
||||
function FocusChainCard({ chain }: { chain: FocusChain | undefined }) {
|
||||
const { i18n } = useTranslation();
|
||||
const { i18n, t } = useTranslation('profile');
|
||||
return (
|
||||
<Card>
|
||||
<SectionHeader
|
||||
title={
|
||||
<span className="flex items-center gap-2">
|
||||
<Sparkles className="h-4.5 w-4.5 text-accent-text" />
|
||||
Ciąg przyczynowo-skutkowy
|
||||
{t('chainTitle')}
|
||||
</span>
|
||||
}
|
||||
description="Ćwiczenia z aktywnego planu w kontekście Twoich celów i wykluczeń."
|
||||
description={t('chainDesc')}
|
||||
/>
|
||||
{chain ? (
|
||||
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{(Object.keys(MUSCLE_TONES) as MuscleTone[]).map((tone) => {
|
||||
const entries = chain[tone] ?? [];
|
||||
const t = MUSCLE_TONES[tone];
|
||||
const meta = MUSCLE_TONES[tone];
|
||||
return (
|
||||
<div
|
||||
key={tone}
|
||||
className={`rounded-xl border-l-[3px] border-y border-r px-4 py-3 ${
|
||||
entries.length > 0 ? t.tint : 'border-line bg-input/40'
|
||||
entries.length > 0 ? meta.tint : 'border-line bg-input/40'
|
||||
}`}
|
||||
>
|
||||
<div className="mb-2 flex items-center gap-2">
|
||||
<span
|
||||
className={`h-2 w-2 shrink-0 rounded-full ${
|
||||
entries.length > 0 ? t.dot : 'bg-dim/40'
|
||||
entries.length > 0 ? meta.dot : 'bg-dim/40'
|
||||
}`}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span
|
||||
className={`text-[11px] font-bold uppercase tracking-[0.1em] ${
|
||||
entries.length > 0 ? t.text : 'text-dim'
|
||||
entries.length > 0 ? meta.text : 'text-dim'
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
{t(meta.labelKey)}
|
||||
</span>
|
||||
</div>
|
||||
{entries.length === 0 ? (
|
||||
<span className="text-[0.875rem] text-dim">brak akcentów w planie</span>
|
||||
<span className="text-[0.875rem] text-dim">{t('chainNoFocus')}</span>
|
||||
) : (
|
||||
<div className="space-y-3">
|
||||
{entries.map((e) => (
|
||||
@@ -371,8 +375,8 @@ function FocusChainCard({ chain }: { chain: FocusChain | undefined }) {
|
||||
</div>
|
||||
<div className="mt-1 text-[0.875rem] text-dim">
|
||||
{(e.exercises ?? []).length > 0
|
||||
? `${t.chainPrefix}${(e.exercises ?? []).map((x) => localizedName(x, i18n.language)).join(', ')}`
|
||||
: 'brak w aktywnym planie'}
|
||||
? `${meta.chainPrefixKey ? t(meta.chainPrefixKey) : ''}${(e.exercises ?? []).map((x) => localizedName(x, i18n.language)).join(', ')}`
|
||||
: t('chainNotInPlan')}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -394,6 +398,7 @@ function FocusChainCard({ chain }: { chain: FocusChain | undefined }) {
|
||||
* z osobnym zapisem per sekcja + ciąg przyczynowo-skutkowy.
|
||||
*/
|
||||
export default function ProfileInfo() {
|
||||
const { t } = useTranslation('profile');
|
||||
const navigate = useNavigate();
|
||||
const { data: meData, isLoading: meLoading } = useMe();
|
||||
const { data: areasData } = useFocusAreas();
|
||||
@@ -469,7 +474,7 @@ export default function ProfileInfo() {
|
||||
});
|
||||
await refresh();
|
||||
setBasicOpen(false);
|
||||
push('Dane podstawowe zapisane', 'success');
|
||||
push(t('basicSaved'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
} finally {
|
||||
@@ -488,7 +493,7 @@ export default function ProfileInfo() {
|
||||
});
|
||||
await refresh();
|
||||
setMusclesOpen(false);
|
||||
push('Priorytety i wykluczenia zapisane', 'success');
|
||||
push(t('musclesSaved'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
} finally {
|
||||
@@ -504,7 +509,7 @@ export default function ProfileInfo() {
|
||||
});
|
||||
await refresh();
|
||||
setSocialOpen(false);
|
||||
push('Social media zapisane', 'success');
|
||||
push(t('socialSaved'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
} finally {
|
||||
@@ -540,12 +545,12 @@ export default function ProfileInfo() {
|
||||
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: 'Profil',
|
||||
title: t('nav:profile'),
|
||||
back: '/profile',
|
||||
actions: [
|
||||
{ label: 'Edytuj dane', icon: Pencil, onClick: () => setBasicOpen(true) },
|
||||
{ label: 'Edytuj mięśnie', icon: Pencil, onClick: openMusclesModal },
|
||||
{ label: 'Edytuj social', icon: Pencil, onClick: () => setSocialOpen(true) },
|
||||
{ label: t('editData'), icon: Pencil, onClick: () => setBasicOpen(true) },
|
||||
{ label: t('editMuscles'), icon: Pencil, onClick: openMusclesModal },
|
||||
{ label: t('editSocial'), icon: Pencil, onClick: () => setSocialOpen(true) },
|
||||
],
|
||||
});
|
||||
|
||||
@@ -565,30 +570,34 @@ export default function ProfileInfo() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Dane osobowe"
|
||||
title={t('secPersonal')}
|
||||
leading={<Avatar name={name} size={40} />}
|
||||
actions={<BackButton onClick={() => navigate('/profile')} />}
|
||||
/>
|
||||
|
||||
{/* Karta 1: podstawowe dane — siatka płytek z ikonami + dostępność jako chipy */}
|
||||
<Card>
|
||||
<SectionHeader title="Podstawowe dane" />
|
||||
<SectionHeader title={t('secBasics')} />
|
||||
<div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
<InfoTile icon={User} label="Imię" value={user?.firstName || '—'} />
|
||||
<InfoTile icon={User} label="Nazwisko" value={user?.lastName || '—'} />
|
||||
<InfoTile icon={Cake} label="Wiek" value={user?.age != null ? `${user.age} lat` : '—'} />
|
||||
<InfoTile icon={User} label={t('labelFirst')} value={user?.firstName || '—'} />
|
||||
<InfoTile icon={User} label={t('labelLast')} value={user?.lastName || '—'} />
|
||||
<InfoTile
|
||||
icon={Cake}
|
||||
label={t('labelAge')}
|
||||
value={user?.age != null ? t('ageYears', { count: user.age }) : '—'}
|
||||
/>
|
||||
<InfoTile
|
||||
icon={Ruler}
|
||||
label="Wzrost"
|
||||
label={t('labelHeight')}
|
||||
value={user?.heightCm != null ? `${user.heightCm} cm` : '—'}
|
||||
/>
|
||||
<InfoTile icon={Phone} label="Telefon" value={user?.phone || '—'} />
|
||||
<InfoTile icon={AtSign} label="Nick" value={user?.nickname || '—'} />
|
||||
<InfoTile icon={Phone} label={t('labelPhone')} value={user?.phone || '—'} />
|
||||
<InfoTile icon={AtSign} label={t('labelNick')} value={user?.nickname || '—'} />
|
||||
</div>
|
||||
<div className="mt-3 rounded-[10px] border border-line bg-input/40 px-3.5 py-3">
|
||||
<div className="mb-2 flex items-center gap-1.5 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
<Clock className="h-3.5 w-3.5" />
|
||||
Dostępność
|
||||
{t('availability')}
|
||||
</div>
|
||||
{availabilityParts.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
@@ -599,38 +608,38 @@ export default function ProfileInfo() {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-[0.875rem] text-dim">Brak ustawionej dostępności</span>
|
||||
<span className="text-[0.875rem] text-dim">{t('noAvailability')}</span>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Karta 2: priorytety i wykluczenia — 4 kafelki w tonie grupy */}
|
||||
<Card>
|
||||
<SectionHeader title="Priorytety i wykluczenia" />
|
||||
<SectionHeader title={t('secMuscles')} />
|
||||
<div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
{(Object.keys(MUSCLE_TONES) as MuscleTone[]).map((tone) => {
|
||||
const musclesList = user?.[MUSCLE_FIELD_BY_TONE[tone]] ?? [];
|
||||
const t = MUSCLE_TONES[tone];
|
||||
const meta = MUSCLE_TONES[tone];
|
||||
return (
|
||||
<div
|
||||
key={tone}
|
||||
className={`rounded-xl border-l-[3px] border-y border-r px-4 py-3 ${
|
||||
musclesList.length > 0 ? t.tint : 'border-line bg-input/40'
|
||||
musclesList.length > 0 ? meta.tint : 'border-line bg-input/40'
|
||||
}`}
|
||||
>
|
||||
<div className="mb-2 flex items-center gap-2">
|
||||
<span
|
||||
className={`h-2 w-2 shrink-0 rounded-full ${
|
||||
musclesList.length > 0 ? t.dot : 'bg-dim/40'
|
||||
musclesList.length > 0 ? meta.dot : 'bg-dim/40'
|
||||
}`}
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<span
|
||||
className={`text-[11px] font-bold uppercase tracking-[0.1em] ${
|
||||
musclesList.length > 0 ? t.text : 'text-dim'
|
||||
musclesList.length > 0 ? meta.text : 'text-dim'
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
{t(meta.labelKey)}
|
||||
</span>
|
||||
{musclesList.length > 0 && (
|
||||
<span className="ml-auto text-[11px] font-bold tabular-nums text-dim">
|
||||
@@ -643,14 +652,14 @@ export default function ProfileInfo() {
|
||||
musclesList.map((m) => (
|
||||
<Badge
|
||||
key={m}
|
||||
color={t.badge as 'green' | 'blue' | 'yellow' | 'red'}
|
||||
color={meta.badge as 'green' | 'blue' | 'yellow' | 'red'}
|
||||
className="bg-card/70"
|
||||
>
|
||||
{areaName(m)}
|
||||
</Badge>
|
||||
))
|
||||
) : (
|
||||
<span className="text-[0.875rem] text-dim">nic nie dodano</span>
|
||||
<span className="text-[0.875rem] text-dim">{t('nothingAdded')}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -661,7 +670,7 @@ export default function ProfileInfo() {
|
||||
|
||||
{/* Karta 3: social media — kafelki linków z markową kropką i domeną */}
|
||||
<Card>
|
||||
<SectionHeader title="Social media" />
|
||||
<SectionHeader title={t('secSocial')} />
|
||||
{(user?.socialMedia ?? []).length > 0 ? (
|
||||
<div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
{(user?.socialMedia ?? []).map((s, i) => (
|
||||
@@ -671,7 +680,7 @@ export default function ProfileInfo() {
|
||||
) : (
|
||||
<div className="flex items-center gap-3 rounded-xl border border-dashed border-line bg-input/40 px-4 py-4 text-[0.875rem] text-dim">
|
||||
<Link2 className="h-4 w-4 shrink-0" />
|
||||
Brak dodanych profili.
|
||||
{t('noSocialProfiles')}
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
@@ -682,7 +691,7 @@ export default function ProfileInfo() {
|
||||
<Modal
|
||||
open={basicOpen}
|
||||
onClose={() => setBasicOpen(false)}
|
||||
title="Podstawowe dane"
|
||||
title={t('secBasics')}
|
||||
wide
|
||||
handle
|
||||
>
|
||||
@@ -694,49 +703,49 @@ export default function ProfileInfo() {
|
||||
}}
|
||||
>
|
||||
<div className="grid grid-cols-1 gap-x-4 sm:grid-cols-2">
|
||||
<Field label="Imię">
|
||||
<Field label={t('labelFirst')}>
|
||||
<Input
|
||||
value={basic.firstName}
|
||||
onChange={(e) => setBasic((f) => ({ ...f, firstName: e.target.value }))}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nazwisko">
|
||||
<Field label={t('labelLast')}>
|
||||
<Input
|
||||
value={basic.lastName}
|
||||
onChange={(e) => setBasic((f) => ({ ...f, lastName: e.target.value }))}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Wiek">
|
||||
<Field label={t('labelAge')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={basic.age}
|
||||
onChange={(e) => setBasic((f) => ({ ...f, age: e.target.value }))}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Wzrost (cm)">
|
||||
<Field label={t('fieldHeightCm')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={basic.heightCm}
|
||||
onChange={(e) => setBasic((f) => ({ ...f, heightCm: e.target.value }))}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Telefon">
|
||||
<Field label={t('labelPhone')}>
|
||||
<Input
|
||||
value={basic.phone}
|
||||
placeholder="+48 600 000 000"
|
||||
onChange={(e) => setBasic((f) => ({ ...f, phone: e.target.value }))}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nick">
|
||||
<Field label={t('labelNick')}>
|
||||
<Input
|
||||
value={basic.nickname}
|
||||
placeholder="np. fitfan"
|
||||
placeholder={t('nickPlaceholder')}
|
||||
maxLength={50}
|
||||
onChange={(e) => setBasic((f) => ({ ...f, nickname: e.target.value }))}
|
||||
/>
|
||||
</Field>
|
||||
<div className="sm:col-span-2">
|
||||
<Field label="Dostępność">
|
||||
<Field label={t('availability')}>
|
||||
<AvailabilityEditor
|
||||
value={basic.availability}
|
||||
onChange={(availability) => setBasic((f) => ({ ...f, availability }))}
|
||||
@@ -751,10 +760,10 @@ export default function ProfileInfo() {
|
||||
onClick={() => setBasicOpen(false)}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button type="submit" disabled={saving === 'basic'} className="w-full sm:w-auto">
|
||||
Zapisz
|
||||
{t('common:save')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -764,7 +773,7 @@ export default function ProfileInfo() {
|
||||
<Modal
|
||||
open={musclesOpen}
|
||||
onClose={() => setMusclesOpen(false)}
|
||||
title="Priorytety i wykluczenia"
|
||||
title={t('secMuscles')}
|
||||
wide
|
||||
handle
|
||||
>
|
||||
@@ -772,7 +781,7 @@ export default function ProfileInfo() {
|
||||
<Tabs
|
||||
tabs={(Object.keys(MUSCLE_TONES) as MuscleTone[]).map((tone) => ({
|
||||
id: tone,
|
||||
label: MUSCLE_TONES[tone].label,
|
||||
label: t(MUSCLE_TONES[tone].labelKey),
|
||||
}))}
|
||||
active={muscleTab}
|
||||
onChange={(id) => setMuscleTab(id as MuscleTone)}
|
||||
@@ -781,15 +790,15 @@ export default function ProfileInfo() {
|
||||
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-dim" />
|
||||
<Input
|
||||
type="search"
|
||||
placeholder="Szukaj mięśnia…"
|
||||
placeholder={t('muscleSearchPlaceholder')}
|
||||
value={muscleSearch}
|
||||
onChange={(e) => setMuscleSearch(e.target.value)}
|
||||
aria-label="Szukaj mięśnia"
|
||||
aria-label={t('muscleSearchAria')}
|
||||
className="pl-9"
|
||||
/>
|
||||
</div>
|
||||
{filteredAreas.length === 0 ? (
|
||||
<p className="text-dim text-[0.875rem]">Brak mięśni pasujących do „{muscleSearch}”.</p>
|
||||
<p className="text-dim text-[0.875rem]">{t('noMusclesMatch', { q: muscleSearch })}</p>
|
||||
) : (
|
||||
<MuscleChips
|
||||
areas={filteredAreas}
|
||||
@@ -805,7 +814,7 @@ export default function ProfileInfo() {
|
||||
onClick={() => setMusclesOpen(false)}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@@ -813,7 +822,7 @@ export default function ProfileInfo() {
|
||||
disabled={saving === 'muscles'}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
Zapisz
|
||||
{t('common:save')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -823,7 +832,7 @@ export default function ProfileInfo() {
|
||||
<Modal
|
||||
open={socialOpen}
|
||||
onClose={() => setSocialOpen(false)}
|
||||
title="Social media"
|
||||
title={t('secSocial')}
|
||||
wide
|
||||
handle
|
||||
>
|
||||
@@ -849,10 +858,10 @@ export default function ProfileInfo() {
|
||||
onClick={() => setSocialOpen(false)}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button type="submit" disabled={saving === 'social'} className="w-full sm:w-auto">
|
||||
Zapisz
|
||||
{t('common:save')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TrendingUp } from 'lucide-react';
|
||||
import { useExerciseProgress } from '../../api/queries';
|
||||
import ExerciseProgressCards from '../../components/ExerciseProgressCards';
|
||||
import {
|
||||
BackButton,
|
||||
Card,
|
||||
EmptyState,
|
||||
ErrorText,
|
||||
PageHeader,
|
||||
Skeleton,
|
||||
} from '../../components/ui';
|
||||
import { BackButton, Card, EmptyState, ErrorText, PageHeader, Skeleton } from '../../components/ui';
|
||||
import { useTopbar } from '../../topbar';
|
||||
|
||||
export default function ProfileProgress() {
|
||||
const { t } = useTranslation('profile');
|
||||
// topbar = rodzic („Profil”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
useTopbar({ title: 'Profil', back: '/profile' });
|
||||
useTopbar({ title: t('nav:profile'), back: '/profile' });
|
||||
const navigate = useNavigate();
|
||||
const { data, isLoading, error } = useExerciseProgress();
|
||||
|
||||
@@ -31,15 +26,23 @@ export default function ProfileProgress() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Postępy" actions={<BackButton onClick={() => navigate('/profile')} />} />
|
||||
<PageHeader
|
||||
title={t('secProgress')}
|
||||
actions={<BackButton onClick={() => navigate('/profile')} />}
|
||||
/>
|
||||
|
||||
<Card>
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!error && exercises.length === 0 && (
|
||||
<EmptyState
|
||||
icon={TrendingUp}
|
||||
title="Brak postępów"
|
||||
description="Postępy pojawią się po pierwszym ukończonym treningu."
|
||||
title={t('noProgressTitle')}
|
||||
description={t('noProgressDesc')}
|
||||
/>
|
||||
)}
|
||||
{!error && exercises.length > 0 && <ExerciseProgressCards exercises={exercises} />}
|
||||
|
||||
@@ -39,7 +39,7 @@ import { DisciplineTab } from './trainee-detail/DisciplineTab';
|
||||
import { TraineePlansTab } from './trainee-detail/TraineePlansTab';
|
||||
|
||||
export default function TraineeDetail() {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('trainees');
|
||||
const { userId = '' } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -72,7 +72,7 @@ export default function TraineeDetail() {
|
||||
try {
|
||||
await addTraineeComment(userId, args);
|
||||
await queryClient.invalidateQueries({ queryKey: ['trainees', userId, 'history'] });
|
||||
push('Komentarz dodany', 'success');
|
||||
push(t('commentAdded'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
}
|
||||
@@ -82,7 +82,7 @@ export default function TraineeDetail() {
|
||||
try {
|
||||
await deleteComment(commentId, { userId });
|
||||
await queryClient.invalidateQueries({ queryKey: ['trainees', userId, 'history'] });
|
||||
push('Komentarz usunięty', 'success');
|
||||
push(t('commentDeleted'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export default function TraineeDetail() {
|
||||
queryClient.invalidateQueries({ queryKey: ['trainees'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['invitations'] }),
|
||||
]);
|
||||
push('Relacja zarchiwizowana', 'success');
|
||||
push(t('archived'), 'success');
|
||||
navigate('/trainees');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
@@ -107,23 +107,23 @@ export default function TraineeDetail() {
|
||||
};
|
||||
|
||||
useTopbar({
|
||||
title: 'Podopieczni',
|
||||
title: t('nav:trainees'),
|
||||
back: '/trainees',
|
||||
actions: [
|
||||
{
|
||||
label: 'Utwórz plan',
|
||||
label: t('createPlan'),
|
||||
icon: Plus,
|
||||
onClick: () => navigate(`/trainees/${userId}/plans/new`),
|
||||
},
|
||||
{
|
||||
label: 'Napisz wiadomość',
|
||||
label: t('writeMessage'),
|
||||
icon: MessageSquare,
|
||||
onClick: () => {
|
||||
if (data?.coachingId) navigate(`/messages/${data.coachingId}`);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: 'Archiwizuj',
|
||||
label: t('archive'),
|
||||
icon: Archive,
|
||||
variant: 'danger',
|
||||
onClick: () => setConfirmOpen(true),
|
||||
@@ -143,7 +143,10 @@ export default function TraineeDetail() {
|
||||
if (error || !data) {
|
||||
return (
|
||||
<Card>
|
||||
<ErrorText>Błąd: {(error as Error).message}</ErrorText>
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -160,7 +163,7 @@ export default function TraineeDetail() {
|
||||
<div className="flex flex-wrap items-center gap-1.5">
|
||||
{data.flags.map((f) => (
|
||||
<Badge key={f} color={TRAINEE_FLAGS[f].color}>
|
||||
{t(TRAINEE_FLAGS[f].labelKey)}
|
||||
{t(`common:${TRAINEE_FLAGS[f].labelKey}`)}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
@@ -172,12 +175,12 @@ export default function TraineeDetail() {
|
||||
<div className="mb-4">
|
||||
<Tabs
|
||||
tabs={[
|
||||
{ id: 'overview', label: 'Przegląd' },
|
||||
{ id: 'calendar', label: 'Kalendarz' },
|
||||
{ id: 'history', label: 'Historia' },
|
||||
{ id: 'progress', label: 'Postępy' },
|
||||
{ id: 'discipline', label: 'Dyscyplina' },
|
||||
{ id: 'plans', label: 'Plany' },
|
||||
{ id: 'overview', label: t('tabOverview') },
|
||||
{ id: 'calendar', label: t('tabCalendar') },
|
||||
{ id: 'history', label: t('tabHistory') },
|
||||
{ id: 'progress', label: t('tabProgress') },
|
||||
{ id: 'discipline', label: t('tabDiscipline') },
|
||||
{ id: 'plans', label: t('tabPlans') },
|
||||
]}
|
||||
active={tab}
|
||||
onChange={setTab}
|
||||
@@ -195,11 +198,16 @@ export default function TraineeDetail() {
|
||||
|
||||
{tab === 'history' && (
|
||||
<Card>
|
||||
<H2 className="mb-0">Historia treningów</H2>
|
||||
<H2 className="mb-0">{t('profile:secHistory')}</H2>
|
||||
{histLoading && <Loading />}
|
||||
{histError && <ErrorText>Błąd: {(histError as Error).message}</ErrorText>}
|
||||
{histError && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(histError as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!histLoading && !histError && (hist?.sessions ?? []).length === 0 && (
|
||||
<p className="text-dim">Brak sesji.</p>
|
||||
<p className="text-dim">{t('noSessionsDot')}</p>
|
||||
)}
|
||||
{!histLoading && !histError && (hist?.sessions ?? []).length > 0 && (
|
||||
<HistoryTable
|
||||
@@ -240,9 +248,9 @@ export default function TraineeDetail() {
|
||||
open={confirmOpen}
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
onConfirm={() => void doArchive()}
|
||||
title="Archiwizuj relację"
|
||||
description={`Czy na pewno chcesz zarchiwizować relację z ${name}? Podopieczny przestanie być widoczny na Twojej liście.`}
|
||||
confirmLabel="Archiwizuj"
|
||||
title={t('archiveTitle')}
|
||||
description={t('archiveDesc', { name })}
|
||||
confirmLabel={t('archive')}
|
||||
danger
|
||||
busy={busy}
|
||||
/>
|
||||
|
||||
@@ -35,18 +35,18 @@ import { useListSearch } from '../../store/list-search';
|
||||
import { useTopbar } from '../../topbar';
|
||||
|
||||
const SORT_OPTIONS = [
|
||||
{ id: 'none', label: 'Brak' },
|
||||
{ id: 'flags', label: 'Flagi' },
|
||||
{ id: 'killstreak', label: 'Killstreak' },
|
||||
{ id: 'name', label: 'Nazwa' },
|
||||
{ id: 'lastSession', label: 'Ostatnia sesja' },
|
||||
{ id: 'none', labelKey: 'sortNone' },
|
||||
{ id: 'flags', labelKey: 'sortFlags' },
|
||||
{ id: 'killstreak', labelKey: 'sortKillstreak' },
|
||||
{ id: 'name', labelKey: 'sortName' },
|
||||
{ id: 'lastSession', labelKey: 'sortLastSession' },
|
||||
] as const;
|
||||
type SortKey = (typeof SORT_OPTIONS)[number]['id'];
|
||||
|
||||
/* Wiersz podopiecznego: avatar + nazwa + siłownie + killstreak,
|
||||
aktywny plan (pasek), ostatnia sesja + flagi. Cały wiersz to przycisk. */
|
||||
function TraineeCard({ trainee, onOpen }: { trainee: Trainee; onOpen: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('trainees');
|
||||
const name = displayName(trainee.user);
|
||||
return (
|
||||
<button
|
||||
@@ -60,7 +60,7 @@ function TraineeCard({ trainee, onOpen }: { trainee: Trainee; onOpen: () => void
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<span className="min-w-0 truncate font-semibold text-[0.95rem]">{name}</span>
|
||||
<span
|
||||
title="Killstreak"
|
||||
title={t('killstreak')}
|
||||
className={`inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[0.75rem] font-bold tabular-nums ${
|
||||
trainee.killstreak > 0 ? 'bg-accent/14 text-accent-text' : 'bg-dim/13 text-dim'
|
||||
}`}
|
||||
@@ -70,7 +70,7 @@ function TraineeCard({ trainee, onOpen }: { trainee: Trainee; onOpen: () => void
|
||||
</span>
|
||||
</div>
|
||||
<div className="truncate text-dim text-[0.8125rem]">
|
||||
{trainee.gyms.length > 0 ? trainee.gyms.map((g) => g.name).join(', ') : 'bez siłowni'}
|
||||
{trainee.gyms.length > 0 ? trainee.gyms.map((g) => g.name).join(', ') : t('noGym')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,23 +81,27 @@ function TraineeCard({ trainee, onOpen }: { trainee: Trainee; onOpen: () => void
|
||||
<div className="mb-1 flex items-center justify-between gap-2">
|
||||
<span className="truncate text-[0.875rem]">{trainee.activePlan.title}</span>
|
||||
<span className="shrink-0 text-[0.8125rem] tabular-nums text-dim">
|
||||
{trainee.activePlan.progress.completed}/{trainee.activePlan.progress.total} dni
|
||||
{t('planDays', {
|
||||
completed: trainee.activePlan.progress.completed,
|
||||
total: trainee.activePlan.progress.total,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
<ProgressBar percent={trainee.activePlan.progress.percent} />
|
||||
</>
|
||||
) : (
|
||||
<span className="text-[0.875rem] text-dim">Brak aktywnego planu</span>
|
||||
<span className="text-[0.875rem] text-dim">{t('noActivePlan')}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-2 flex flex-wrap items-center gap-1.5">
|
||||
<span className="mr-1 text-[0.8125rem] text-dim">
|
||||
ostatnia sesja: {trainee.lastSessionAt ? fmtDate(trainee.lastSessionAt) : '—'}
|
||||
{t('lastSessionPrefix')}
|
||||
{trainee.lastSessionAt ? fmtDate(trainee.lastSessionAt) : '—'}
|
||||
</span>
|
||||
{trainee.flags.map((f) => (
|
||||
<Badge key={f} color={TRAINEE_FLAGS[f].color}>
|
||||
{t(TRAINEE_FLAGS[f].labelKey)}
|
||||
{t(`common:${TRAINEE_FLAGS[f].labelKey}`)}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
@@ -106,6 +110,7 @@ function TraineeCard({ trainee, onOpen }: { trainee: Trainee; onOpen: () => void
|
||||
}
|
||||
|
||||
export default function Trainees() {
|
||||
const { t } = useTranslation('trainees');
|
||||
const isTrainer = useIsTrainer();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -124,7 +129,7 @@ export default function Trainees() {
|
||||
const [addOpen, setAddOpen] = useState(false);
|
||||
|
||||
useTopbar({
|
||||
title: 'Podopieczni',
|
||||
title: t('nav:trainees'),
|
||||
search: 'trainees',
|
||||
filters: [
|
||||
/* sortowanie: przycisk „Sortuj: <wartość>” + rozwijany select (kompaktowo w grupie filtrów) */
|
||||
@@ -142,7 +147,9 @@ export default function Trainees() {
|
||||
)}
|
||||
>
|
||||
<ArrowUpDown className="w-4 h-4" />
|
||||
Sortuj: {SORT_OPTIONS.find((s) => s.id === sortKey)?.label}
|
||||
{t('sortBy', {
|
||||
sort: t(SORT_OPTIONS.find((s) => s.id === sortKey)?.labelKey ?? 'sortNone'),
|
||||
})}
|
||||
<ChevronDown className={`w-4 h-4 transition-transform ${sortOpen ? 'rotate-180' : ''}`} />
|
||||
</Button>
|
||||
{sortOpen && (
|
||||
@@ -162,7 +169,7 @@ export default function Trainees() {
|
||||
sortKey === s.id ? 'bg-accent/12 text-accent-text' : 'text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{s.label}
|
||||
{t(s.labelKey)}
|
||||
{sortKey === s.id && <Check className="w-4 h-4" />}
|
||||
</button>
|
||||
))}
|
||||
@@ -183,12 +190,12 @@ export default function Trainees() {
|
||||
)}
|
||||
>
|
||||
<Building2 className="w-4 h-4" />
|
||||
Grupuj wg siłowni
|
||||
{t('groupByGym')}
|
||||
</Button>,
|
||||
],
|
||||
filterActive: sortKey !== 'none' || groupByGym,
|
||||
actions: isTrainer
|
||||
? [{ label: 'Dodaj podopiecznego', icon: Plus, onClick: () => setAddOpen(true) }]
|
||||
? [{ label: t('addTrainee'), icon: Plus, onClick: () => setAddOpen(true) }]
|
||||
: undefined,
|
||||
});
|
||||
const { data: traineesData, isLoading, error } = useTrainees(gymId || undefined);
|
||||
@@ -262,9 +269,9 @@ export default function Trainees() {
|
||||
}
|
||||
}
|
||||
const groups = [...byGym.values()].sort((a, b) => a.name.localeCompare(b.name, 'pl'));
|
||||
if (other.length > 0) groups.push({ id: 'other', name: 'Inne', trainees: other });
|
||||
if (other.length > 0) groups.push({ id: 'other', name: t('groupOther'), trainees: other });
|
||||
return groups;
|
||||
}, [filtered, trainerGymIds]);
|
||||
}, [filtered, trainerGymIds, t]);
|
||||
// aktywna zakładka siłowni (domyślnie pierwsza grupa; fallback gdy grupa zniknie np. po wyszukiwarce)
|
||||
const activeGroup = gymGroups.find((g) => g.id === activeGymTab) ?? gymGroups[0];
|
||||
// lokalizacja aktywnej siłowni (z członkostw trenera) — pod nagłówkiem grupy
|
||||
@@ -281,7 +288,7 @@ export default function Trainees() {
|
||||
queryClient.invalidateQueries({ queryKey: ['trainees'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['trainee-search'] }),
|
||||
]);
|
||||
push('Zaproszenie wysłane', 'success');
|
||||
push(t('inviteSent'), 'success');
|
||||
} catch (e) {
|
||||
push((e as Error).message, 'error');
|
||||
}
|
||||
@@ -290,11 +297,7 @@ export default function Trainees() {
|
||||
if (!isTrainer) {
|
||||
return (
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={Users}
|
||||
title="Brak roli trenera"
|
||||
description="Sekcja Podopieczni jest dostępna dla użytkowników z rolą trenera w siłowni."
|
||||
/>
|
||||
<EmptyState icon={Users} title={t('noTrainerTitle')} description={t('noTrainerDesc')} />
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -304,16 +307,16 @@ export default function Trainees() {
|
||||
return (
|
||||
<>
|
||||
{/* wyszukiwanie kandydata i zapraszanie — modal otwierany z top menu */}
|
||||
<Modal open={addOpen} onClose={() => setAddOpen(false)} title="Dodaj podopiecznego">
|
||||
<Modal open={addOpen} onClose={() => setAddOpen(false)} title={t('addTrainee')}>
|
||||
<div className="flex flex-col sm:flex-row gap-3">
|
||||
<Input
|
||||
placeholder="Imię"
|
||||
placeholder={t('firstNamePlaceholder')}
|
||||
value={firstName}
|
||||
onChange={(e) => setFirstName(e.target.value)}
|
||||
className="sm:flex-1"
|
||||
/>
|
||||
<Input
|
||||
placeholder="Nazwisko"
|
||||
placeholder={t('lastNamePlaceholder')}
|
||||
value={lastName}
|
||||
onChange={(e) => setLastName(e.target.value)}
|
||||
className="sm:flex-1"
|
||||
@@ -323,15 +326,13 @@ export default function Trainees() {
|
||||
disabled={!firstName.trim() || !lastName.trim() || searchLoading}
|
||||
className="sm:w-auto"
|
||||
>
|
||||
{searchLoading ? 'Szukam…' : 'Szukaj'}
|
||||
{searchLoading ? t('searchingAction') : t('searchAction')}
|
||||
</Button>
|
||||
</div>
|
||||
{searching && (
|
||||
<div className="mt-4">
|
||||
{candidates.length === 0 && !searchLoading && (
|
||||
<p className="text-dim text-[0.875rem]">
|
||||
Brak wyników dla podanych imienia i nazwiska.
|
||||
</p>
|
||||
<p className="text-dim text-[0.875rem]">{t('noCandidates')}</p>
|
||||
)}
|
||||
<div className="divide-y divide-line">
|
||||
{candidates.map((c) => (
|
||||
@@ -347,7 +348,7 @@ export default function Trainees() {
|
||||
}
|
||||
actions={
|
||||
<Button size="sm" onClick={() => void invite(c)}>
|
||||
Zaproś
|
||||
{t('invite')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
@@ -362,10 +363,10 @@ export default function Trainees() {
|
||||
<Select
|
||||
value={gymId}
|
||||
onChange={(e) => setGymId(e.target.value)}
|
||||
aria-label="Filtruj po siłowni"
|
||||
aria-label={t('gymFilterAria')}
|
||||
className="w-auto"
|
||||
>
|
||||
<option value="">Wszystkie siłownie</option>
|
||||
<option value="">{t('allGyms')}</option>
|
||||
{trainerGyms.map((m) => (
|
||||
<option key={m.gymId} value={m.gymId}>
|
||||
{m.gym.name}
|
||||
@@ -381,17 +382,18 @@ export default function Trainees() {
|
||||
<Skeleton className="h-32" />
|
||||
</div>
|
||||
)}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!isLoading && !error && filtered.length === 0 && (
|
||||
<Card>
|
||||
{query ? (
|
||||
<p className="text-dim">Brak wyników dla podanego zapytania.</p>
|
||||
<p className="text-dim">{t('noQueryResults')}</p>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Users}
|
||||
title="Brak podopiecznych"
|
||||
description="Wyszukaj osobę po imieniu i nazwisku i wyślij zaproszenie."
|
||||
/>
|
||||
<EmptyState icon={Users} title={t('emptyTitle')} description={t('emptyDesc')} />
|
||||
)}
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { MessageSquare } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useConversations, useMe } from '../../../api/queries';
|
||||
import { timeAgo } from '../../../lib/format';
|
||||
@@ -10,6 +11,7 @@ import { Button, Card, Muted, SectionHeader, Skeleton } from '../../../component
|
||||
* tu tylko sygnał, że rozmowa istnieje i czy wymaga reakcji.
|
||||
*/
|
||||
export function ConversationCard({ coachingId }: { coachingId: string }) {
|
||||
const { t } = useTranslation('trainees');
|
||||
const navigate = useNavigate();
|
||||
const { data, isLoading } = useConversations();
|
||||
const { data: meData } = useMe();
|
||||
@@ -19,7 +21,7 @@ export function ConversationCard({ coachingId }: { coachingId: string }) {
|
||||
if (isLoading) {
|
||||
return (
|
||||
<Card>
|
||||
<SectionHeader title="Rozmowa" />
|
||||
<SectionHeader title={t('convTitle')} />
|
||||
<Skeleton className="h-10" />
|
||||
</Card>
|
||||
);
|
||||
@@ -32,11 +34,11 @@ export function ConversationCard({ coachingId }: { coachingId: string }) {
|
||||
return (
|
||||
<Card>
|
||||
<SectionHeader
|
||||
title="Rozmowa"
|
||||
title={t('convTitle')}
|
||||
actions={
|
||||
<Button size="sm" onClick={() => navigate(`/messages/${coachingId}`)}>
|
||||
<MessageSquare className="w-4 h-4" />
|
||||
Napisz wiadomość
|
||||
{t('writeMessage')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
@@ -44,7 +46,7 @@ export function ConversationCard({ coachingId }: { coachingId: string }) {
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<div className="truncate text-[0.95rem] font-semibold">
|
||||
{mine ? 'Ty: ' : ''}
|
||||
{mine ? t('youPrefix') : ''}
|
||||
{last.body}
|
||||
</div>
|
||||
<Muted className="text-[0.8125rem]">{timeAgo(last.createdAt)}</Muted>
|
||||
@@ -56,7 +58,7 @@ export function ConversationCard({ coachingId }: { coachingId: string }) {
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-dim">Brak wiadomości — napisz pierwszą.</p>
|
||||
<p className="text-dim">{t('noMessagesYet')}</p>
|
||||
)}
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { fmtDate, fmtDateTime } from '../../../lib/format';
|
||||
import {
|
||||
Card,
|
||||
@@ -27,23 +28,34 @@ export function DisciplineTab({
|
||||
movesLoading: boolean;
|
||||
movesError: Error | null;
|
||||
}) {
|
||||
const { t } = useTranslation('trainees');
|
||||
return (
|
||||
<Card>
|
||||
<SectionHeader title="Dyscyplina" />
|
||||
<SectionHeader title={t('tabDiscipline')} />
|
||||
{reportLoading && <Loading />}
|
||||
{reportError && <ErrorText>Błąd: {(reportError as Error).message}</ErrorText>}
|
||||
{reportError && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(reportError as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!reportLoading && !reportError && (report?.days.length ?? 0) === 0 && (
|
||||
<p className="text-dim">Brak dni w aktywnym planie.</p>
|
||||
<p className="text-dim">{t('noDaysInPlan')}</p>
|
||||
)}
|
||||
{!reportLoading && !reportError && (report?.days.length ?? 0) > 0 && (
|
||||
<DisciplineHeatmap days={report!.days} />
|
||||
)}
|
||||
<div className="mt-4">
|
||||
<H3 className="mb-1.5">Przesunięte dni</H3>
|
||||
<H3 className="mb-1.5">{t('movedDays')}</H3>
|
||||
{movesLoading && <Loading />}
|
||||
{movesError && <ErrorText>Błąd: {(movesError as Error).message}</ErrorText>}
|
||||
{movesError && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(movesError as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!movesLoading && !movesError && (movesData?.moves.length ?? 0) === 0 && (
|
||||
<p className="text-dim">Brak przesuniętych dni.</p>
|
||||
<p className="text-dim">{t('noMovedDays')}</p>
|
||||
)}
|
||||
{!movesLoading && !movesError && (movesData?.moves.length ?? 0) > 0 && (
|
||||
<div className="divide-y divide-line">
|
||||
@@ -57,7 +69,10 @@ export function DisciplineTab({
|
||||
}
|
||||
meta={m.reason ? <span>· {m.reason}</span> : undefined}
|
||||
actions={
|
||||
<Muted className="text-[0.875rem]">przesunięto {fmtDateTime(m.movedAt)}</Muted>
|
||||
<Muted className="text-[0.875rem]">
|
||||
{t('movedWord')}
|
||||
{fmtDateTime(m.movedAt)}
|
||||
</Muted>
|
||||
}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Flame } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { fmtDate, fmtDateTime } from '../../../lib/format';
|
||||
import { muscleName, SOCIAL_MEDIA_LABELS } from '../../../lib/labels';
|
||||
import { Card, H3, Muted, ProgressBar, SectionHeader, StatTile } from '../../../components/ui';
|
||||
@@ -6,21 +7,22 @@ import type { TraineeDetail as TraineeDetailData } from '../../../api/types';
|
||||
|
||||
/* Zakładka „Przegląd”: podstawowe informacje (StatTile) + karta aktywnego planu. */
|
||||
export function OverviewTab({ data }: { data: TraineeDetailData }) {
|
||||
const { t } = useTranslation('trainees');
|
||||
return (
|
||||
<>
|
||||
<Card>
|
||||
<SectionHeader title="Podstawowe informacje" />
|
||||
<SectionHeader title={t('basicsTitle')} />
|
||||
<div className="grid grid-cols-2 sm:grid-cols-3 gap-4 sm:gap-5">
|
||||
<StatTile
|
||||
label="Siłownie"
|
||||
label={t('gymsLabel')}
|
||||
value={data.gyms.length > 0 ? data.gyms.map((g) => g.name).join(', ') : '—'}
|
||||
/>
|
||||
<StatTile
|
||||
label="Ostatnia sesja"
|
||||
label={t('lastSessionLabel')}
|
||||
value={data.lastSessionAt ? fmtDateTime(data.lastSessionAt) : '—'}
|
||||
/>
|
||||
<StatTile
|
||||
label="Killstreak"
|
||||
label={t('killstreak')}
|
||||
value={
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
<Flame
|
||||
@@ -31,7 +33,7 @@ export function OverviewTab({ data }: { data: TraineeDetailData }) {
|
||||
}
|
||||
/>
|
||||
<StatTile
|
||||
label="Social media"
|
||||
label={t('socialLabel')}
|
||||
value={
|
||||
data.socialMedia && data.socialMedia.length > 0 ? (
|
||||
<span className="flex flex-wrap gap-x-3 gap-y-1">
|
||||
@@ -43,7 +45,9 @@ export function OverviewTab({ data }: { data: TraineeDetailData }) {
|
||||
rel="noopener noreferrer"
|
||||
className="text-accent-text hover:underline"
|
||||
>
|
||||
{s.platform === 'OTHER' ? s.label || 'Inne' : SOCIAL_MEDIA_LABELS[s.platform]}
|
||||
{s.platform === 'OTHER'
|
||||
? s.label || t('common:socialMedia.OTHER')
|
||||
: SOCIAL_MEDIA_LABELS[s.platform]}
|
||||
</a>
|
||||
))}
|
||||
</span>
|
||||
@@ -56,18 +60,24 @@ export function OverviewTab({ data }: { data: TraineeDetailData }) {
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<SectionHeader title="Aktywny plan" />
|
||||
<SectionHeader title={t('activePlanTitle')} />
|
||||
{data.activePlan ? (
|
||||
<>
|
||||
<div className="mb-2 flex flex-wrap items-center justify-between gap-2">
|
||||
<strong>{data.activePlan.title}</strong>
|
||||
<Muted className="text-[0.875rem]">start {fmtDate(data.activePlan.startDate)}</Muted>
|
||||
<Muted className="text-[0.875rem]">
|
||||
{t('startWord')}
|
||||
{fmtDate(data.activePlan.startDate)}
|
||||
</Muted>
|
||||
</div>
|
||||
{data.progress && (
|
||||
<>
|
||||
<div className="mb-1 flex items-center justify-between text-[0.875rem]">
|
||||
<Muted>
|
||||
{data.progress.completed}/{data.progress.total} dni
|
||||
{t('planDays', {
|
||||
completed: data.progress.completed,
|
||||
total: data.progress.total,
|
||||
})}
|
||||
</Muted>
|
||||
<Muted>{data.progress.percent}%</Muted>
|
||||
</div>
|
||||
@@ -75,12 +85,15 @@ export function OverviewTab({ data }: { data: TraineeDetailData }) {
|
||||
</>
|
||||
)}
|
||||
<div className="mt-4 grid grid-cols-2 gap-4">
|
||||
<StatTile label="Nadmiar (serie)" value={data.extra ? `+${data.extra.sets}` : '—'} />
|
||||
<StatTile label="Deficyt (serie)" value={data.missing ? data.missing.sets : '—'} />
|
||||
<StatTile
|
||||
label={t('excessSeries')}
|
||||
value={data.extra ? `+${data.extra.sets}` : '—'}
|
||||
/>
|
||||
<StatTile label={t('deficitSeries')} value={data.missing ? data.missing.sets : '—'} />
|
||||
</div>
|
||||
{data.nextTraining && (
|
||||
<div className="mt-4">
|
||||
<H3 className="mb-1.5">Następny trening</H3>
|
||||
<H3 className="mb-1.5">{t('nextTraining')}</H3>
|
||||
<div className="text-[0.875rem]">
|
||||
<strong>{fmtDate(data.nextTraining.date)}</strong>
|
||||
<Muted className="ml-2">
|
||||
@@ -91,7 +104,7 @@ export function OverviewTab({ data }: { data: TraineeDetailData }) {
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p className="text-dim">Podopieczny nie ma aktywnego planu.</p>
|
||||
<p className="text-dim">{t('noActivePlanForTrainee')}</p>
|
||||
)}
|
||||
</Card>
|
||||
</>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useTraineeExerciseProgress } from '../../../api/queries';
|
||||
import { muscleName } from '../../../lib/labels';
|
||||
import ExerciseProgressCards from '../../../components/ExerciseProgressCards';
|
||||
@@ -12,6 +13,7 @@ interface ProgressTabProps {
|
||||
}
|
||||
|
||||
export function ProgressTab({ userId, report, reportLoading, reportError }: ProgressTabProps) {
|
||||
const { t } = useTranslation('trainees');
|
||||
const {
|
||||
data: progress,
|
||||
isLoading: progressLoading,
|
||||
@@ -21,23 +23,30 @@ export function ProgressTab({ userId, report, reportLoading, reportError }: Prog
|
||||
return (
|
||||
<>
|
||||
<Card>
|
||||
<SectionHeader title="Postępy per ćwiczenie" />
|
||||
<SectionHeader title={t('progressPerExercise')} />
|
||||
{progressLoading && <Loading />}
|
||||
{progressError && <ErrorText>Błąd: {(progressError as Error).message}</ErrorText>}
|
||||
{progressError && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(progressError as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!progressLoading && !progressError && (
|
||||
<ExerciseProgressCards exercises={progress?.exercises ?? []} />
|
||||
)}
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<SectionHeader
|
||||
title="Objętość per partia"
|
||||
description="Faktyczne serie względem planu i zalecanego zakresu: akcent = w zakresie, pomarańcz = >10% powyżej, czerwień = deficyt."
|
||||
/>
|
||||
<SectionHeader title={t('volumePerPart')} description={t('volumeDesc')} />
|
||||
{reportLoading && <Loading />}
|
||||
{reportError && <ErrorText>Błąd: {(reportError as Error).message}</ErrorText>}
|
||||
{reportError && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(reportError as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!reportLoading && !reportError && (report?.muscles ?? []).length === 0 && (
|
||||
<p className="text-dim">Brak aktywnego planu — raport niedostępny.</p>
|
||||
<p className="text-dim">{t('noPlanReport')}</p>
|
||||
)}
|
||||
{!reportLoading && !reportError && (report?.muscles ?? []).length > 0 && (
|
||||
<div className="flex flex-col gap-3">
|
||||
@@ -72,9 +81,17 @@ export function ProgressTab({ userId, report, reportLoading, reportError }: Prog
|
||||
</div>
|
||||
{(m.extra.sets > 0 || m.missing.sets > 0 || m.outOfRange) && (
|
||||
<div className="mt-1 flex flex-wrap items-center gap-1.5 sm:pl-[104px]">
|
||||
{m.extra.sets > 0 && <Badge color="green">+{m.extra.sets} nadmiar</Badge>}
|
||||
{m.missing.sets > 0 && <Badge color="red">-{m.missing.sets} deficyt</Badge>}
|
||||
{m.outOfRange && <Badge color="yellow">poza zakresem</Badge>}
|
||||
{m.extra.sets > 0 && (
|
||||
<Badge color="green">
|
||||
+{m.extra.sets} {t('excessWord')}
|
||||
</Badge>
|
||||
)}
|
||||
{m.missing.sets > 0 && (
|
||||
<Badge color="red">
|
||||
-{m.missing.sets} {t('deficitWord')}
|
||||
</Badge>
|
||||
)}
|
||||
{m.outOfRange && <Badge color="yellow">{t('outOfRange')}</Badge>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import i18n from '../../../i18n';
|
||||
import { resolveLocaleTag } from '../../../i18n/language';
|
||||
import { monthStr } from '../../../lib/format';
|
||||
import { localizedName } from '../../../lib/localizedName';
|
||||
import { DAY_STATUS, muscleName } from '../../../lib/labels';
|
||||
@@ -23,7 +25,7 @@ function TraineeDayCard({ day }: { day: CalendarDay }) {
|
||||
<Card>
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2">
|
||||
<H2 className="mb-0 capitalize">
|
||||
{new Date(day.date).toLocaleDateString('pl-PL', {
|
||||
{new Date(day.date).toLocaleDateString(resolveLocaleTag(i18n.language), {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
@@ -32,7 +34,7 @@ function TraineeDayCard({ day }: { day: CalendarDay }) {
|
||||
<Badge color={st.color}>{t(st.labelKey)}</Badge>
|
||||
</div>
|
||||
{day.exercises.length === 0 ? (
|
||||
<p className="mt-2 text-dim">Brak ćwiczeń.</p>
|
||||
<p className="mt-2 text-dim">{t('trainees:noExercises')}</p>
|
||||
) : (
|
||||
<ul className="mt-2 divide-y divide-line">
|
||||
{day.exercises.map((e, i) => (
|
||||
@@ -54,6 +56,7 @@ function TraineeDayCard({ day }: { day: CalendarDay }) {
|
||||
|
||||
/* Zakładka „Kalendarz”: kalendarz podopiecznego (dni jego aktywnego planu). */
|
||||
export function TraineeCalendarTab({ userId }: { userId: string }) {
|
||||
const { t } = useTranslation('trainees');
|
||||
const now = new Date();
|
||||
const [month, setMonth] = useState(monthStr(now));
|
||||
const [selectedDayId, setSelectedDayId] = useState<string | null>(null);
|
||||
@@ -75,11 +78,16 @@ export function TraineeCalendarTab({ userId }: { userId: string }) {
|
||||
<>
|
||||
<Card>
|
||||
<div className="mb-4 flex items-center justify-between gap-3">
|
||||
<SectionHeader title="Kalendarz podopiecznego" />
|
||||
<SectionHeader title={t('traineeCalendar')} />
|
||||
<CalendarMonthNav month={month} onMonth={goToMonth} />
|
||||
</div>
|
||||
{isLoading && <Skeleton className="h-64" />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
{data && (
|
||||
<MonthGrid
|
||||
|
||||
@@ -39,7 +39,7 @@ type PlanAction = {
|
||||
* Tworzenie planu: akcja „Utwórz plan" w menu kontekstowym strony (TraineeDetail).
|
||||
*/
|
||||
export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation('plans');
|
||||
const queryClient = useQueryClient();
|
||||
const { push } = useToast();
|
||||
const { data, isLoading, error } = useTraineePlans(userId);
|
||||
@@ -74,7 +74,7 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
await invalidate();
|
||||
push(msg, 'success');
|
||||
} catch (e) {
|
||||
setActionError(e instanceof Error ? e.message : 'Błąd');
|
||||
setActionError(e instanceof Error ? e.message : t('genericError'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -83,19 +83,26 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
const creatorLabel = (p: Plan): string | null => {
|
||||
if (!p.creator) return null;
|
||||
if (meData?.user.id && p.creator.id === meData.user.id) return null;
|
||||
const name = [p.creator.firstName, p.creator.lastName].filter(Boolean).join(' ') || 'trener';
|
||||
return `utworzył: ${name}`;
|
||||
const name =
|
||||
[p.creator.firstName, p.creator.lastName].filter(Boolean).join(' ') ||
|
||||
t('trainees:trainerFallback');
|
||||
return `${t('detail.createdPrefix')} ${name}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<H2>Plany podopiecznego</H2>
|
||||
<H2>{t('trainees:plansOfTrainee')}</H2>
|
||||
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!isLoading && !error && plans.length === 0 && (
|
||||
<Card>
|
||||
<p className="text-dim">Podopieczny nie ma żadnych planów.</p>
|
||||
<p className="text-dim">{t('trainees:noPlansAtAll')}</p>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -118,10 +125,15 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
>
|
||||
{p.title}
|
||||
</button>
|
||||
<Badge color={st.color}>{t(st.labelKey)}</Badge>
|
||||
<Muted className="text-[0.875rem]">{p.weeksCount} tyg.</Muted>
|
||||
<Badge color={st.color}>{t(`common:${st.labelKey}`)}</Badge>
|
||||
<Muted className="text-[0.875rem]">
|
||||
{t('common:counters.weeksShort', { count: p.weeksCount })}
|
||||
</Muted>
|
||||
{p.startDate && (
|
||||
<Muted className="text-[0.875rem]">start {fmtDate(p.startDate)}</Muted>
|
||||
<Muted className="text-[0.875rem]">
|
||||
{t('trainees:startWord')}
|
||||
{fmtDate(p.startDate)}
|
||||
</Muted>
|
||||
)}
|
||||
{creatorLabel(p) && (
|
||||
<Muted className="text-[0.875rem]">{creatorLabel(p)}</Muted>
|
||||
@@ -131,7 +143,12 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
{isSel && (
|
||||
<div className="mt-3">
|
||||
{detailLoading && <Loading />}
|
||||
{detailError && <ErrorText>Błąd: {(detailError as Error).message}</ErrorText>}
|
||||
{detailError && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(detailError as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{selectedDetail && (
|
||||
<>
|
||||
<div className="mb-3">
|
||||
@@ -159,21 +176,17 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
}
|
||||
activateDisabled={hasActivePlan}
|
||||
reopenDisabled={hasActivePlan}
|
||||
hint={
|
||||
hasActivePlan
|
||||
? 'Podopieczny ma już aktywny plan — tylko jeden plan może być aktywny. Aby aktywować ten plan, najpierw ukończ lub porzuć aktywny.'
|
||||
: undefined
|
||||
}
|
||||
hint={hasActivePlan ? t('detail.traineeConflictActivate') : undefined}
|
||||
/>
|
||||
</div>
|
||||
{selectedDetail.weeks.map((w) => (
|
||||
<div key={w.id} className="mb-3">
|
||||
<div className="mb-1.5 flex items-center gap-2">
|
||||
<H3 className="mb-0">Tydzień {w.index + 1}</H3>
|
||||
<H3 className="mb-0">{t('week.title', { n: w.index + 1 })}</H3>
|
||||
{w.customName && <Badge color="blue">{w.customName}</Badge>}
|
||||
</div>
|
||||
{w.days.length === 0 && (
|
||||
<p className="text-dim">Brak dni treningowych.</p>
|
||||
<p className="text-dim">{t('week.emptyDays')}</p>
|
||||
)}
|
||||
<div className="divide-y divide-line">
|
||||
{w.days.map((d) => (
|
||||
@@ -199,11 +212,11 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
onConfirm={() => {
|
||||
const planId = confirm!.planId;
|
||||
setConfirm(null);
|
||||
void act(() => activateTraineePlan(userId, planId, startDate), 'Plan aktywowany');
|
||||
void act(() => activateTraineePlan(userId, planId, startDate), t('toasts.activated'));
|
||||
}}
|
||||
title="Aktywować plan?"
|
||||
description="Plan zostanie aktywowany od poniedziałku zaznaczonego tygodnia."
|
||||
confirmLabel="Aktywuj"
|
||||
title={t('detail.confirmActivateTitle')}
|
||||
description={t('detail.confirmActivateDesc')}
|
||||
confirmLabel={t('actions.activate')}
|
||||
busy={busy}
|
||||
/>
|
||||
<ConfirmDialog
|
||||
@@ -212,11 +225,11 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
onConfirm={() => {
|
||||
const planId = confirm!.planId;
|
||||
setConfirm(null);
|
||||
void act(() => deleteTraineePlan(userId, planId), 'Usunięto plan');
|
||||
void act(() => deleteTraineePlan(userId, planId), t('toasts.deleted'));
|
||||
}}
|
||||
title="Usunąć plan?"
|
||||
description="Plan i wszystkie powiązane dni zostaną trwale usunięte."
|
||||
confirmLabel="Usuń"
|
||||
title={t('detail.confirmDeleteTitle')}
|
||||
description={t('detail.confirmDeleteDesc')}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={busy}
|
||||
/>
|
||||
@@ -226,11 +239,11 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
onConfirm={() => {
|
||||
const planId = confirm!.planId;
|
||||
setConfirm(null);
|
||||
void act(() => abandonTraineePlan(userId, planId), 'Plan porzucony');
|
||||
void act(() => abandonTraineePlan(userId, planId), t('toasts.abandoned'));
|
||||
}}
|
||||
title="Porzucić plan?"
|
||||
description="Plan zostanie oznaczony jako porzucony — kolejne treningi z niego nie będą planowane."
|
||||
confirmLabel="Porzuć"
|
||||
title={t('detail.confirmAbandonTitle')}
|
||||
description={t('detail.confirmAbandonDesc')}
|
||||
confirmLabel={t('actions.abandon')}
|
||||
danger
|
||||
busy={busy}
|
||||
/>
|
||||
@@ -240,11 +253,11 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
onConfirm={() => {
|
||||
const planId = confirm!.planId;
|
||||
setConfirm(null);
|
||||
void act(() => completeTraineePlan(userId, planId), 'Plan ukończony');
|
||||
void act(() => completeTraineePlan(userId, planId), t('toasts.completed'));
|
||||
}}
|
||||
title="Oznaaczyć jako ukończony?"
|
||||
description="Plan zostanie oznaczony jako ukończony."
|
||||
confirmLabel="Ukończ"
|
||||
title={t('detail.confirmCompleteTitle')}
|
||||
description={t('detail.confirmCompleteDesc')}
|
||||
confirmLabel={t('actions.completeLabel')}
|
||||
busy={busy}
|
||||
/>
|
||||
<ConfirmDialog
|
||||
@@ -253,11 +266,11 @@ export function TraineePlansTab({ userId }: { userId: string }) {
|
||||
onConfirm={() => {
|
||||
const planId = confirm!.planId;
|
||||
setConfirm(null);
|
||||
void act(() => reopenTraineePlan(userId, planId), 'Plan wznowiony');
|
||||
void act(() => reopenTraineePlan(userId, planId), t('toasts.reopened'));
|
||||
}}
|
||||
title="Wznowić plan?"
|
||||
description="Plan wróci do statusu aktywnego — błędne sesje poprawisz w ich tygodniach. Pominięte dni pozostaną pominięte."
|
||||
confirmLabel="Wznów"
|
||||
title={t('detail.confirmReopenTitle')}
|
||||
description={t('detail.confirmReopenDesc')}
|
||||
confirmLabel={t('actions.reopen')}
|
||||
busy={busy}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -29,7 +29,7 @@ function isStandalone(): boolean {
|
||||
typeof window.matchMedia === 'function' &&
|
||||
window.matchMedia('(display-mode: standalone)').matches) ||
|
||||
// iOS < 15.4 nie zna display-mode — legacy flaga standalone
|
||||
(window.navigator as unknown as { standalone?: boolean }).standalone === true
|
||||
(window.navigator as unknown as { standalone?: boolean }).standalone === true
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,8 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
Dwie warstwy: zewnętrzna = pełnej szerokości, przezroczysty „tor”
|
||||
(centruje i animuje odstęp od dołu), wewnętrzna = właściwa pigułka
|
||||
na szerokość treści (flex na osi pionowej → szerokość z treści), otwarta
|
||||
grupa rozpycha ją w dół i płynnie poszerza (max-width) */} <div
|
||||
grupa rozpycha ją w dół i płynnie poszerza (max-width) */}{' '}
|
||||
<div
|
||||
className={cn(
|
||||
'md:contents',
|
||||
'max-md:fixed max-md:inset-x-1 max-md:bottom-1 max-md:z-40 max-md:flex max-md:justify-center max-md:transition-[bottom,inset-x] max-md:duration-200 max-md:ease-out',
|
||||
@@ -180,148 +181,148 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
: null,
|
||||
)}
|
||||
>
|
||||
{/* panel otwartej grupy (akordeon) — wewnątrz pigułki nad ikonami; animacja
|
||||
{/* panel otwartej grupy (akordeon) — wewnątrz pigułki nad ikonami; animacja
|
||||
max-width poszerza też rząd ikon (rozszerzane rodzeństwo w kolumnie);
|
||||
overflow-x: clip tnie w poziomie, w pionie widać (monthpicker nad paskiem) */}
|
||||
<div
|
||||
className={cn(
|
||||
'order-first md:hidden max-md:flex max-md:min-w-0 max-md:overflow-x-clip max-md:transition-[max-width] max-md:duration-200 max-md:ease-out',
|
||||
menuOpen ? 'max-md:max-w-[380px]' : 'max-md:max-w-0',
|
||||
)}
|
||||
>
|
||||
{menuOpen ? (
|
||||
<div
|
||||
key={openGroup}
|
||||
data-topbar-panel
|
||||
className="topbar-expand max-md:flex max-md:flex-col max-md:items-stretch max-md:gap-1.5 max-md:pt-2 max-md:pb-3"
|
||||
>
|
||||
{openGroup === 'filters' && (
|
||||
<>
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
{openGroup === 'add' &&
|
||||
plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup === 'actions' &&
|
||||
otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup?.startsWith('grp:') &&
|
||||
(config?.groups ?? [])
|
||||
.find((g) => `grp:${g.id}` === openGroup)
|
||||
?.actions.map((action) => (
|
||||
<div
|
||||
className={cn(
|
||||
'order-first md:hidden max-md:flex max-md:min-w-0 max-md:overflow-x-clip max-md:transition-[max-width] max-md:duration-200 max-md:ease-out',
|
||||
menuOpen ? 'max-md:max-w-[380px]' : 'max-md:max-w-0',
|
||||
)}
|
||||
>
|
||||
{menuOpen ? (
|
||||
<div
|
||||
key={openGroup}
|
||||
data-topbar-panel
|
||||
className="topbar-expand max-md:flex max-md:flex-col max-md:items-stretch max-md:gap-1.5 max-md:pt-2 max-md:pb-3"
|
||||
>
|
||||
{openGroup === 'filters' && (
|
||||
<>
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
{openGroup === 'add' &&
|
||||
plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup === 'search' && config?.search && (
|
||||
<SectionSearchInput section={config.search} />
|
||||
)}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
{/* rząd ikon: na md+ pojedynczy flex w nagłówku (contents rodzica),
|
||||
na telefonie rząd wewnątrz pigułki */}
|
||||
<div className="flex shrink-0 flex-wrap items-center justify-end gap-2 max-md:flex-nowrap max-md:justify-center">
|
||||
{/* telefon: „<” = wróć do strony-rodzica zadeklarowanej przez podstronę */}
|
||||
{config?.back && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (config.onBack ? config.onBack() : navigate(config.back!))}
|
||||
aria-label={t('back')}
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink md:hidden"
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
{/* nawigacja (np. Kalendarz) zawsze widoczna, nie jest grupą */}
|
||||
{config?.navWidget}
|
||||
{hasFilters && (
|
||||
<GroupButton
|
||||
icon={Filter}
|
||||
label={t('topbar.filters')}
|
||||
active={config?.filterActive}
|
||||
open={openGroup === 'filters'}
|
||||
onToggle={() => toggle('filters')}
|
||||
>
|
||||
{/* telefon: treść renderuje panel w pigułce (Topbar) — children to md+ */}
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* własne grupy tematyczne strony (np. Edycja/Galeria/Urządzenia) */}
|
||||
{(config?.groups ?? []).map((g) => (
|
||||
<GroupButton
|
||||
key={g.id}
|
||||
icon={g.icon}
|
||||
label={g.label}
|
||||
open={openGroup === `grp:${g.id}`}
|
||||
onToggle={() => toggle(`grp:${g.id}`)}
|
||||
>
|
||||
{g.actions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
))}
|
||||
{plusActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={Plus}
|
||||
label={t('topbar.add')}
|
||||
open={openGroup === 'add'}
|
||||
onToggle={() => toggle('add')}
|
||||
>
|
||||
{plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{otherActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={MoreHorizontal}
|
||||
label={t('topbar.actions')}
|
||||
open={openGroup === 'actions'}
|
||||
onToggle={() => toggle('actions')}
|
||||
flatOnMobile={config?.flatActionsMobile}
|
||||
alwaysInlineFromMd={config?.alwaysInlineActions}
|
||||
>
|
||||
{otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* wyszukiwarka zawsze maksymalnie z prawej */}
|
||||
{config?.search && (
|
||||
<GroupButton
|
||||
icon={Search}
|
||||
label={t('topbar.search')}
|
||||
active={searchQuery !== ''}
|
||||
open={openGroup === 'search'}
|
||||
onToggle={() => toggle('search')}
|
||||
>
|
||||
<div className="w-56">
|
||||
<SectionSearchInput section={config.search} />
|
||||
{openGroup === 'actions' &&
|
||||
otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup?.startsWith('grp:') &&
|
||||
(config?.groups ?? [])
|
||||
.find((g) => `grp:${g.id}` === openGroup)
|
||||
?.actions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
{openGroup === 'search' && config?.search && (
|
||||
<SectionSearchInput section={config.search} />
|
||||
)}
|
||||
</div>
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* telefon: X zamykający otwarte menu; renderowany tylko gdy menu otwarte
|
||||
) : null}
|
||||
</div>
|
||||
{/* rząd ikon: na md+ pojedynczy flex w nagłówku (contents rodzica),
|
||||
na telefonie rząd wewnątrz pigułki */}
|
||||
<div className="flex shrink-0 flex-wrap items-center justify-end gap-2 max-md:flex-nowrap max-md:justify-center">
|
||||
{/* telefon: „<” = wróć do strony-rodzica zadeklarowanej przez podstronę */}
|
||||
{config?.back && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (config.onBack ? config.onBack() : navigate(config.back!))}
|
||||
aria-label={t('back')}
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink md:hidden"
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
{/* nawigacja (np. Kalendarz) zawsze widoczna, nie jest grupą */}
|
||||
{config?.navWidget}
|
||||
{hasFilters && (
|
||||
<GroupButton
|
||||
icon={Filter}
|
||||
label={t('topbar.filters')}
|
||||
active={config?.filterActive}
|
||||
open={openGroup === 'filters'}
|
||||
onToggle={() => toggle('filters')}
|
||||
>
|
||||
{/* telefon: treść renderuje panel w pigułce (Topbar) — children to md+ */}
|
||||
{config?.dateFilter}
|
||||
{config?.filters?.map((filter, i) => (
|
||||
<div key={i}>{filter}</div>
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* własne grupy tematyczne strony (np. Edycja/Galeria/Urządzenia) */}
|
||||
{(config?.groups ?? []).map((g) => (
|
||||
<GroupButton
|
||||
key={g.id}
|
||||
icon={g.icon}
|
||||
label={g.label}
|
||||
open={openGroup === `grp:${g.id}`}
|
||||
onToggle={() => toggle(`grp:${g.id}`)}
|
||||
>
|
||||
{g.actions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
))}
|
||||
{plusActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={Plus}
|
||||
label={t('topbar.add')}
|
||||
open={openGroup === 'add'}
|
||||
onToggle={() => toggle('add')}
|
||||
>
|
||||
{plusActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{otherActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={MoreHorizontal}
|
||||
label={t('topbar.actions')}
|
||||
open={openGroup === 'actions'}
|
||||
onToggle={() => toggle('actions')}
|
||||
flatOnMobile={config?.flatActionsMobile}
|
||||
alwaysInlineFromMd={config?.alwaysInlineActions}
|
||||
>
|
||||
{otherActions.map((action) => (
|
||||
<ActionButton key={action.label} action={action} onNavigate={navigate} />
|
||||
))}
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* wyszukiwarka zawsze maksymalnie z prawej */}
|
||||
{config?.search && (
|
||||
<GroupButton
|
||||
icon={Search}
|
||||
label={t('topbar.search')}
|
||||
active={searchQuery !== ''}
|
||||
open={openGroup === 'search'}
|
||||
onToggle={() => toggle('search')}
|
||||
>
|
||||
<div className="w-56">
|
||||
<SectionSearchInput section={config.search} />
|
||||
</div>
|
||||
</GroupButton>
|
||||
)}
|
||||
{/* telefon: X zamykający otwarte menu; renderowany tylko gdy menu otwarte
|
||||
(zamknięty nie zostawia śladu w rządzie — inaczej jego gap psuje
|
||||
wyśrodkowanie samych ikon) */}
|
||||
{menuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('topbar.closeMenu')}
|
||||
onClick={() => setOpenGroup(null)}
|
||||
className="topbar-expand grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-danger md:hidden"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{menuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('topbar.closeMenu')}
|
||||
onClick={() => setOpenGroup(null)}
|
||||
className="topbar-expand grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-danger md:hidden"
|
||||
>
|
||||
<X className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user