From 101a8fdc88756cae3e7149b050f8e564a4b040c8 Mon Sep 17 00:00:00 2001 From: tisachi Date: Sat, 17 Oct 2026 11:35:35 +0200 Subject: [PATCH] =?UTF-8?q?I18n:=20ekstrakcja=20UI=20wspolnego=20w=20apce?= =?UTF-8?q?=20(komponenty=20ui,=20dialogi,=20toast,=20Layout,=20topbar,=20?= =?UTF-8?q?AuthShell=20=E2=80=94=20namespace'y=20common/nav/plans(set),=20?= =?UTF-8?q?tlumaczenia=20PL/EN)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/components/AuthShell.tsx | 36 ++++-------- app/src/components/Layout.tsx | 58 +++++++++++--------- app/src/components/toast.tsx | 14 +++-- app/src/components/ui/content.tsx | 18 +++--- app/src/components/ui/dialogs.tsx | 76 +++++++++++++++----------- app/src/components/ui/typography.tsx | 6 +- app/src/components/ui/week-picker.tsx | 19 ++++--- app/src/i18n/index.ts | 61 ++++++++++++++++++++- app/src/i18n/locales/en/common.json | 38 ++++++++++++- app/src/i18n/locales/en/dashboard.json | 1 + app/src/i18n/locales/en/feed.json | 1 + app/src/i18n/locales/en/gyms.json | 1 + app/src/i18n/locales/en/messages.json | 1 + app/src/i18n/locales/en/nav.json | 18 ++++++ app/src/i18n/locales/en/plans.json | 18 ++++++ app/src/i18n/locales/en/profile.json | 1 + app/src/i18n/locales/en/trainees.json | 1 + app/src/i18n/locales/pl/common.json | 38 ++++++++++++- app/src/i18n/locales/pl/dashboard.json | 1 + app/src/i18n/locales/pl/feed.json | 1 + app/src/i18n/locales/pl/gyms.json | 1 + app/src/i18n/locales/pl/messages.json | 1 + app/src/i18n/locales/pl/nav.json | 18 ++++++ app/src/i18n/locales/pl/plans.json | 18 ++++++ app/src/i18n/locales/pl/profile.json | 1 + app/src/i18n/locales/pl/trainees.json | 1 + app/src/topbar/MonthPicker.tsx | 12 ++-- app/src/topbar/Topbar.tsx | 33 ++++++----- 28 files changed, 360 insertions(+), 133 deletions(-) create mode 100644 app/src/i18n/locales/en/dashboard.json create mode 100644 app/src/i18n/locales/en/feed.json create mode 100644 app/src/i18n/locales/en/gyms.json create mode 100644 app/src/i18n/locales/en/messages.json create mode 100644 app/src/i18n/locales/en/nav.json create mode 100644 app/src/i18n/locales/en/plans.json create mode 100644 app/src/i18n/locales/en/profile.json create mode 100644 app/src/i18n/locales/en/trainees.json create mode 100644 app/src/i18n/locales/pl/dashboard.json create mode 100644 app/src/i18n/locales/pl/feed.json create mode 100644 app/src/i18n/locales/pl/gyms.json create mode 100644 app/src/i18n/locales/pl/messages.json create mode 100644 app/src/i18n/locales/pl/nav.json create mode 100644 app/src/i18n/locales/pl/plans.json create mode 100644 app/src/i18n/locales/pl/profile.json create mode 100644 app/src/i18n/locales/pl/trainees.json diff --git a/app/src/components/AuthShell.tsx b/app/src/components/AuthShell.tsx index 1a9dcc0..3c93f38 100644 --- a/app/src/components/AuthShell.tsx +++ b/app/src/components/AuthShell.tsx @@ -1,4 +1,5 @@ import type { ReactNode } from 'react'; +import { useTranslation } from 'react-i18next'; import { Dumbbell, Handshake, Ruler } from 'lucide-react'; import { Card, ThemeToggle, LanguageToggle } from './ui'; import { Brandmark } from './Brandmark'; @@ -6,6 +7,12 @@ import { Brandmark } from './Brandmark'; /* Layout stron auth: panel brandingowy (gradient w akcencie + wzór siatki, claim) + panel formularza. Na mobile — jeden słupek (branding u góry). */ export default function AuthShell({ children }: { children: ReactNode }) { + const { t } = useTranslation('auth'); + const FEATURES = [ + { icon: Handshake, title: t('featureCoachingTitle'), desc: t('featureCoachingDesc') }, + { icon: Dumbbell, title: t('featureSetsTitle'), desc: t('featureSetsDesc') }, + { icon: Ruler, title: t('featureMeasuresTitle'), desc: t('featureMeasuresDesc') }, + ]; return (
@@ -35,34 +42,13 @@ export default function AuthShell({ children }: { children: ReactNode }) {

FitOS

- Trening, który -
- się dowozi. + {t('claimTitle')}

- Od planowania po ostatnią serię. + {t('claimSubtitle')}

-
@@ -274,8 +278,8 @@ export default function Layout() { ); } @@ -165,7 +167,7 @@ export function MetaItem({ export function Chip({ children, onRemove, - removeLabel = 'Usuń', + removeLabel, className = '', }: { children: ReactNode; @@ -173,6 +175,7 @@ export function Chip({ removeLabel?: string; className?: string; }) { + const { t } = useTranslation(); return ( @@ -233,6 +236,7 @@ export function Tabs({ active: string; onChange: (id: string) => void; }) { + const { t } = useTranslation(); const scrollRef = useRef(null); const [canPrev, setCanPrev] = useState(false); const [canNext, setCanNext] = useState(false); @@ -283,7 +287,7 @@ export function Tabs({ > @@ -112,12 +115,13 @@ export function AlertModal({ title: string; message: string; }) { + const { t } = useTranslation(); return (

{message}

@@ -140,6 +144,7 @@ export function NumberPadDialog({ onConfirm: (value: string) => void; onClose: () => void; }) { + const { t } = useTranslation(); const [draft, setDraft] = useState(value); useEffect(() => { if (open) setDraft(value); @@ -175,7 +180,7 @@ export function NumberPadDialog({ key={d} type="button" onClick={() => press(d)} - aria-label={d === 'C' ? 'Wyczyść' : d === '⌫' ? 'Usuń cyfrę' : d} + aria-label={d === 'C' ? t('clear') : d === '⌫' ? t('deleteDigit') : d} className="h-14 rounded-[10px] bg-input border border-line text-xl font-semibold text-ink shadow-(--inset-shadow) cursor-pointer hover:border-accent/55 hover:text-accent-text active:bg-line/40 transition-all duration-150" > {d} @@ -184,10 +189,10 @@ export function NumberPadDialog({
@@ -210,13 +215,14 @@ export function DifficultyDialog({ const parsed = v === '' ? NaN : parseInt(v); return String(isNaN(parsed) ? 3 : Math.max(1, Math.min(5, parsed))); }; + const { t } = useTranslation(); const [draft, setDraft] = useState(() => normalize(value)); useEffect(() => { if (open) setDraft(normalize(value)); }, [open, value]); return ( - +
{draft}
@@ -228,20 +234,20 @@ export function DifficultyDialog({ step={1} value={parseInt(draft)} onChange={(e) => setDraft(e.target.value)} - aria-label="Trudność (suwak)" + aria-label={t('difficultySlider')} className="w-full accent-accent cursor-pointer" />
- łatwo - trudno + {t('difficultyLow')} + {t('difficultyHigh')}
@@ -249,11 +255,12 @@ export function DifficultyDialog({ } /* Metadata for the set fields edited in SetEditDialog. */ -const SET_FIELD_META: { key: 'reps' | 'rir' | 'difficulty'; label: string; hint: string }[] = [ - { key: 'reps', label: 'Powtórzenia', hint: 'liczba powtórzeń' }, - { key: 'rir', label: 'RIR', hint: '0–10 (reps in reserve)' }, - { key: 'difficulty', label: 'Trudność', hint: '1–5' }, -]; +const SET_FIELD_META: { key: 'reps' | 'rir' | 'difficulty'; labelKey: string; hintKey: string }[] = + [ + { key: 'reps', labelKey: 'plans:set.reps', hintKey: 'plans:set.repsHint' }, + { key: 'rir', labelKey: 'plans:set.rir', hintKey: 'plans:set.rirHint' }, + { key: 'difficulty', labelKey: 'common:difficulty', hintKey: 'plans:set.difficultyHint' }, + ]; export type SetFieldValues = { reps: string; rir: string; difficulty: string; note: string }; @@ -286,6 +293,7 @@ export function SetEditDialog({ onSave: (values: SetFieldValues) => void; onClose: () => void; }) { + const { t } = useTranslation(); const [drafts, setDrafts] = useState(values); const [editingField, setEditingField] = useState<'reps' | 'rir' | 'difficulty' | null>(null); useEffect(() => { @@ -312,27 +320,29 @@ export function SetEditDialog({ return ( <> - + {rest && rest.remaining > 0 && (
{rest.resetsOnSave && ( -

- Zapisanie serii zrestartuje odliczanie przerwy. -

+

{t('plans:set.restReset')}

)}
)} {hasNorm && ( )}
@@ -343,7 +353,7 @@ export function SetEditDialog({ onClick={() => setEditingField(f.key)} className="w-full flex items-center justify-between rounded-[10px] border border-line bg-input px-3.5 py-3 shadow-(--inset-shadow) cursor-pointer hover:border-accent/55 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/60" > - {f.label} + {t(f.labelKey)} @@ -355,13 +365,13 @@ export function SetEditDialog({ {/* Opcjonalny komentarz trenującego — widoczny także trenerowi w historii sesji. */}
- Komentarz (opcjonalnie) + {t('plans:set.comment')} {t('plans:set.optional')}