Web: wielojezycznosc — cala tresc wizytowki przez t()/Trans z locales pl/en w src/i18n (i18next + react-i18next), domyslny jezyk z przegladarki, przelacznik PL/EN w naglowku z zapisem w localStorage fitos-web-lang, aktualizacja html lang / document.title / meta description przy zmianie jezyka; testy unit 8 i e2e 7 przechodza (nowy spec jezykowy), AGENTS.md: zakres i18n obejmuje tez web
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
interface BootLine {
|
||||
text: string;
|
||||
ok?: boolean;
|
||||
}
|
||||
|
||||
// Log startowy „systemu” — ≤6 linii, po wpisaniu zostają widoczne.
|
||||
const LINES: BootLine[] = [
|
||||
{ text: '$ fitos --init' },
|
||||
{ text: 'moduł Trening ......... ', ok: true },
|
||||
{ text: 'moduł Coaching ........ ', ok: true },
|
||||
{ text: 'moduł Siłownie ........ ', ok: true },
|
||||
{ text: '$ system gotowy — 0 błędów' },
|
||||
];
|
||||
|
||||
const CHAR_MS = 24;
|
||||
const LINE_MS = 240;
|
||||
|
||||
@@ -26,6 +18,11 @@ function prefersReducedMotion() {
|
||||
|
||||
/** Boot log z efektem typewritera; w prefers-reduced-motion renderuje się od razu. */
|
||||
export function BootLog() {
|
||||
const { t, i18n } = useTranslation('boot');
|
||||
const LINES = useMemo(
|
||||
() => t('lines', { returnObjects: true }) as unknown as BootLine[],
|
||||
[t, i18n.language],
|
||||
);
|
||||
const done = prefersReducedMotion();
|
||||
const [visible, setVisible] = useState<{ line: number; char: number }>(
|
||||
done ? { line: LINES.length, char: 0 } : { line: 0, char: 0 },
|
||||
@@ -53,11 +50,11 @@ export function BootLog() {
|
||||
cancelled = true;
|
||||
clearTimeout(timer);
|
||||
};
|
||||
}, [done]);
|
||||
}, [done, LINES]);
|
||||
|
||||
return (
|
||||
<pre
|
||||
aria-label="Log startowy FitOS"
|
||||
aria-label={t('logAria')}
|
||||
className="m-0 font-mono text-[12.5px] leading-6 text-dim sm:text-[13px]"
|
||||
>
|
||||
{LINES.map((l, i) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { CalendarClock, Wifi } from 'lucide-react';
|
||||
import { StreakDots } from './StreakDots';
|
||||
|
||||
@@ -15,7 +16,7 @@ function useClock() {
|
||||
}
|
||||
|
||||
// odliczany w pętli czas przerwy między seriami
|
||||
function useBreakCountdown(from = 45) {
|
||||
function useRestCountdown(from = 45) {
|
||||
const [secs, setSecs] = useState(from);
|
||||
useEffect(() => {
|
||||
const id = setInterval(() => setSecs((s) => (s > 0 ? s - 1 : from)), 1000);
|
||||
@@ -64,14 +65,11 @@ function SideButtons() {
|
||||
|
||||
/** Mock iPhone’a 16 Pro (tytan, Dynamic Island) z odpaloną apką „Trwa trening”. */
|
||||
export function PhoneMock() {
|
||||
const { t } = useTranslation('mock');
|
||||
const clock = useClock();
|
||||
const przerwa = useBreakCountdown();
|
||||
const rest = useRestCountdown();
|
||||
return (
|
||||
<div
|
||||
className="relative mx-auto w-[300px]"
|
||||
role="img"
|
||||
aria-label="Podgląd aplikacji FitOS na telefonie: trwa trening, seria 3 na 4, killstreak 23 dni"
|
||||
>
|
||||
<div className="relative mx-auto w-[300px]" role="img" aria-label={t('previewAria')}>
|
||||
<SideButtons />
|
||||
<div className="rounded-[3.4rem] bg-(image:--metal-frame) p-[3px] shadow-[0_30px_80px_-30px_rgb(0_0_0/0.85),0_0_0_1px_rgb(0_0_0/0.6)]">
|
||||
<div className="rounded-[3.28rem] bg-black p-[9px]">
|
||||
@@ -100,9 +98,11 @@ export function PhoneMock() {
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="flex items-center gap-2 text-sm font-semibold text-ink">
|
||||
<span className="live-dot" />
|
||||
Trwa trening
|
||||
{t('liveSession')}
|
||||
</span>
|
||||
<span className="font-mono text-[10px] text-dim">
|
||||
{t('sessionDay', { n: 3 })}
|
||||
</span>
|
||||
<span className="font-mono text-[10px] text-dim">sesja · dzień 3</span>
|
||||
</div>
|
||||
|
||||
<div className="mt-2.5 flex flex-col gap-1.5 border-b border-line pb-2.5 text-[11.5px]">
|
||||
@@ -111,7 +111,7 @@ export function PhoneMock() {
|
||||
<span aria-hidden="true" className="text-accent">
|
||||
✓
|
||||
</span>{' '}
|
||||
Przysiady
|
||||
{t('squats')}
|
||||
</span>
|
||||
<span className="font-mono text-[10.5px]">4 × 8 @ 100 kg</span>
|
||||
</span>
|
||||
@@ -120,46 +120,46 @@ export function PhoneMock() {
|
||||
<span aria-hidden="true" className="text-accent">
|
||||
✓
|
||||
</span>{' '}
|
||||
Wyciskanie skos
|
||||
{t('inclinePress')}
|
||||
</span>
|
||||
<span className="font-mono text-[10.5px]">3 × 10 @ 60 kg</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p className="mt-2.5 font-display text-[15px] font-semibold text-ink">
|
||||
Wyciskanie sztangi
|
||||
{t('barbellPress')}
|
||||
</p>
|
||||
<p className="font-mono text-[11px] text-dim">4 x 8 @ 80 kg · RIR 2</p>
|
||||
|
||||
<div className="mt-2.5 flex items-center justify-between text-[11px] text-dim">
|
||||
<span>Seria 3/4</span>
|
||||
<span className="font-mono text-accent">powt. 8</span>
|
||||
<span>{t('setOf', { done: 3, total: 4 })}</span>
|
||||
<span className="font-mono text-accent">{t('repsValue', { n: 8 })}</span>
|
||||
</div>
|
||||
<div className="mt-1.5 h-1.5 overflow-hidden rounded-full bg-input">
|
||||
<div className="h-full w-3/4 rounded-full bg-(image:--btn-grad)" />
|
||||
</div>
|
||||
|
||||
<div className="mt-2.5 flex items-center justify-between rounded-md border border-line bg-input px-2.5 py-2">
|
||||
<span className="text-[11px] text-dim">Przerwa</span>
|
||||
<span className="text-[11px] text-dim">{t('rest')}</span>
|
||||
<span className="font-mono text-sm font-semibold text-accent tabular-nums">
|
||||
{przerwa}
|
||||
{rest}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="mt-2.5 h-8 rounded-md bg-(image:--btn-grad) text-center font-sans text-[12.5px] font-bold leading-8 text-accent-ink shadow-(--btn-shadow)">
|
||||
Norma spełniona
|
||||
{t('goalMet')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* dwa kafelki: killstreak i pomiary */}
|
||||
<div className="mx-3 grid grid-cols-2 gap-2.5">
|
||||
<div className="rounded-xl border border-line bg-card p-3">
|
||||
<span className="text-[11px] font-semibold text-ink">Killstreak</span>
|
||||
<span className="text-[11px] font-semibold text-ink">{t('killstreakTile')}</span>
|
||||
<StreakDots total={10} filled={8} className="mt-2 gap-[3px]" />
|
||||
<p className="mt-1.5 font-mono text-[10px] text-accent">23 dni · rekord 41</p>
|
||||
<p className="mt-1.5 font-mono text-[10px] text-accent">{t('killstreakInfo')}</p>
|
||||
</div>
|
||||
<div className="rounded-xl border border-line bg-card p-3">
|
||||
<span className="text-[11px] font-semibold text-ink">Progres</span>
|
||||
<span className="text-[11px] font-semibold text-ink">{t('progressTile')}</span>
|
||||
<svg viewBox="0 0 90 26" className="mt-1.5 h-6 w-full" aria-hidden="true">
|
||||
{[26, 38, 34, 50, 46, 62, 58, 78].map((h, i) => (
|
||||
<rect
|
||||
@@ -174,9 +174,7 @@ export function PhoneMock() {
|
||||
/>
|
||||
))}
|
||||
</svg>
|
||||
<p className="mt-1 font-mono text-[10px] text-accent">
|
||||
Wyciskanie +20 kg / 12 tyg.
|
||||
</p>
|
||||
<p className="mt-1 font-mono text-[10px] text-accent">{t('progressInfo')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -184,9 +182,9 @@ export function PhoneMock() {
|
||||
<div className="mx-3 flex items-center justify-between rounded-xl border border-line bg-card px-3.5 py-2.5">
|
||||
<span className="flex items-center gap-2 text-[11.5px] text-ink">
|
||||
<CalendarClock size={13} aria-hidden="true" className="text-accent" />
|
||||
Czwartek · Wyciąg i plecy
|
||||
{t('nextSession')}
|
||||
</span>
|
||||
<span className="font-mono text-[10px] text-dim">4 ćwiczenia</span>
|
||||
<span className="font-mono text-[10px] text-dim">{t('exercisesCount')}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user