I18n: panel admina (partia 6) - tlumaczenie calego UI: common rozbudowany (nav/topbar/fmt/counters/roles/equipmentKind/picker/muscles/statuses), nowe namespace'y gyms/users/catalog/logs/verifications/announcements; lib format/labels/availability/equipment/roles na i18n.t (Intl wg jezyka); layout, topbar, MonthPicker, modale i pickery; strony Login, Logs, Verifications, Announcements, katalog (Equipment/Exercises/FocusAreas), siłownie (GymForm/GymsList/GymDetail z sekcjami) i users (lista, wizard, profil z podstronami, parametry ciala, historia, postepy, członkostwa, wnioski, kary); auth store i formaty dat/licit przez jezyk; testy jednostkowe 84/84 zielone
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useAuth } from './store/auth';
|
||||
import Layout from './components/Layout';
|
||||
import Login from './pages/Login';
|
||||
@@ -23,6 +24,7 @@ import Logs from './pages/Logs';
|
||||
import VerificationsList, { VerificationDetail } from './pages/Verifications';
|
||||
|
||||
export default function App() {
|
||||
const { t } = useTranslation();
|
||||
const { user, ready, init } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
@@ -30,7 +32,9 @@ export default function App() {
|
||||
}, [init]);
|
||||
|
||||
if (!ready) {
|
||||
return <div className="min-h-screen flex items-center justify-center text-dim">Ładowanie…</div>;
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center 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: 'address.PL' },
|
||||
{ code: 'DE', labelKey: 'address.DE' },
|
||||
{ code: 'CZ', labelKey: 'address.CZ' },
|
||||
{ code: 'SK', labelKey: 'address.SK' },
|
||||
{ code: 'LT', labelKey: 'address.LT' },
|
||||
{ code: 'GB', labelKey: 'address.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) })}
|
||||
@@ -87,26 +89,26 @@ export function AddressFields({
|
||||
required={required}
|
||||
/>
|
||||
{postalInvalid && (
|
||||
<p className="mt-1 text-[0.8rem] text-danger">Format kodu: 00-001</p>
|
||||
<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(c.labelKey)}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { DAY_NAMES_FULL, TIME_SLOTS } from '../lib/availability';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { dayFull, TIME_SLOTS } 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;
|
||||
@@ -20,23 +22,24 @@ export function AvailabilityEditor({
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{DAY_NAMES_FULL.map((name, i) => {
|
||||
{[0, 1, 2, 3, 4, 5, 6].map((i) => {
|
||||
const name = dayFull(i);
|
||||
const day = value[i];
|
||||
const enabled = day != null;
|
||||
const start = day?.start ?? DEFAULT_START;
|
||||
const end = day?.end ?? DEFAULT_END;
|
||||
return (
|
||||
<div key={name} className="flex items-center gap-2">
|
||||
<div key={i} className="flex items-center gap-2">
|
||||
<span className="w-28 shrink-0 text-dim text-[0.875rem]">{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 })}
|
||||
@@ -50,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 })}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
import type { ExerciseProgress } from '../api/types';
|
||||
import { fmtDate, fmtVolume } from '../lib/format';
|
||||
import { localizedName } from '../lib/localizedName';
|
||||
import { MUSCLE_NAMES } from '../lib/labels';
|
||||
import { muscleName } from '../lib/labels';
|
||||
import { Badge, Tabs } from './ui';
|
||||
|
||||
const TOOLTIP_STYLE = {
|
||||
@@ -72,9 +72,7 @@ export default function ExerciseProgressCards({ exercises }: { exercises: Exerci
|
||||
</strong>
|
||||
{isPr && <Badge color="green">PR</Badge>}
|
||||
</div>
|
||||
<div className="text-[0.8125rem] text-dim">
|
||||
{MUSCLE_NAMES[ex.muscle] || ex.muscle}
|
||||
</div>
|
||||
<div className="text-[0.8125rem] text-dim">{muscleName(ex.muscle)}</div>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-3">
|
||||
<div className="text-right">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Search, X } from 'lucide-react';
|
||||
import type { Gym } from '../api/types';
|
||||
|
||||
@@ -15,6 +16,7 @@ export function GymPicker({
|
||||
value: string;
|
||||
onChange: (id: string) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState('');
|
||||
const [open, setOpen] = useState(false);
|
||||
const selected = gyms.find((g) => g.id === value);
|
||||
@@ -37,9 +39,9 @@ export function GymPicker({
|
||||
<input
|
||||
role="combobox"
|
||||
aria-expanded={open}
|
||||
aria-label="Szukaj siłowni"
|
||||
aria-label={t('picker.gymAria')}
|
||||
className="w-full bg-transparent py-2.5 text-[0.95rem] focus:outline-none"
|
||||
placeholder={selected && !open ? '' : 'Szukaj siłowni…'}
|
||||
placeholder={selected && !open ? '' : t('picker.gymPh')}
|
||||
value={open ? query : (selected?.name ?? '')}
|
||||
onChange={(e) => {
|
||||
setQuery(e.target.value);
|
||||
@@ -50,7 +52,7 @@ export function GymPicker({
|
||||
{selected && !open && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Wyczyść wybór siłowni"
|
||||
aria-label={t('picker.gymClear')}
|
||||
onClick={() => onChange('')}
|
||||
className="shrink-0 cursor-pointer text-dim hover:text-ink"
|
||||
>
|
||||
@@ -61,12 +63,14 @@ export function GymPicker({
|
||||
{open && (
|
||||
<div
|
||||
role="listbox"
|
||||
aria-label="Lista siłowni"
|
||||
aria-label={t('picker.gymList')}
|
||||
className="absolute z-20 mt-1.5 max-h-56 w-full overflow-y-auto rounded-xl border border-line bg-card shadow-xl"
|
||||
>
|
||||
{filtered.length === 0 ? (
|
||||
<div className="px-3.5 py-3 text-[0.875rem] text-dim">
|
||||
{query.trim() ? `Brak siłowni o nazwie „${query.trim()}”` : 'Brak dostępnych siłowni'}
|
||||
{query.trim()
|
||||
? t('picker.gymNoResults', { query: query.trim() })
|
||||
: t('picker.gymEmpty')}
|
||||
</div>
|
||||
) : (
|
||||
filtered.map((g) => (
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Check } from 'lucide-react';
|
||||
import type { GymRole } from '../api/types';
|
||||
import { GYM_ROLE_META, GYM_ROLE_ORDER, GYM_ROLE_PILL_ACTIVE } from '../lib/roles';
|
||||
@@ -33,6 +34,7 @@ export function GymRolePicker({
|
||||
showExplain = true,
|
||||
className,
|
||||
}: GymRolePickerProps) {
|
||||
const { t } = useTranslation();
|
||||
const [explained, setExplained] = useState<GymRole | null>(null);
|
||||
const locked = value.length <= minRoles;
|
||||
|
||||
@@ -63,9 +65,9 @@ export function GymRolePicker({
|
||||
type="button"
|
||||
role="checkbox"
|
||||
aria-checked={active}
|
||||
aria-label={`${GYM_ROLE_META[role].label} — ${labelPrefix}`}
|
||||
aria-description={GYM_ROLE_META[role].summary}
|
||||
title={disabled ? lockTitle : GYM_ROLE_META[role].summary}
|
||||
aria-label={`${t(GYM_ROLE_META[role].labelKey)} — ${labelPrefix}`}
|
||||
aria-description={t(GYM_ROLE_META[role].summaryKey)}
|
||||
title={disabled ? lockTitle : t(GYM_ROLE_META[role].summaryKey)}
|
||||
disabled={disabled}
|
||||
onClick={() => toggle(role)}
|
||||
className={cn(
|
||||
@@ -74,7 +76,7 @@ export function GymRolePicker({
|
||||
)}
|
||||
>
|
||||
<Check className={cn('h-4 w-4', active ? '' : 'opacity-0')} />
|
||||
{GYM_ROLE_META[role].label}
|
||||
{t(GYM_ROLE_META[role].labelKey)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -83,22 +85,19 @@ export function GymRolePicker({
|
||||
<div className="mt-2.5 min-h-[2.5rem] rounded-xl border border-line bg-input/40 px-3 py-2.5 text-[0.875rem]">
|
||||
{meta ? (
|
||||
<>
|
||||
<span className="font-semibold text-ink">{meta.label}: </span>
|
||||
<span className="text-dim">{meta.summary}</span>
|
||||
<span className="font-semibold text-ink">{t(meta.labelKey)}: </span>
|
||||
<span className="text-dim">{t(meta.summaryKey)}</span>
|
||||
<ul className="mt-1.5 space-y-0.5 text-dim">
|
||||
{meta.grants.map((g) => (
|
||||
{meta.grantKeys.map((g) => (
|
||||
<li key={g} className="flex gap-1.5">
|
||||
<span className="text-accent-text">•</span>
|
||||
<span>{g}</span>
|
||||
<span>{t(g)}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
) : (
|
||||
<span className="text-dim">
|
||||
Wybierz rolę, aby zobaczyć, co dokładnie daje. Ćwiczący = trenuje, Trener = prowadzi
|
||||
podopiecznych, Właściciel = zarządza siłownią.
|
||||
</span>
|
||||
<span className="text-dim">{t('roles.picker.hint')}</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ChevronDown, ChevronUp, MessageSquare } from 'lucide-react';
|
||||
import type { HistorySession } from '../api/types';
|
||||
import { fmtDate, fmtDuration, fmtVolume } from '../lib/format';
|
||||
import { localizedName } from '../lib/localizedName';
|
||||
import { MUSCLE_NAMES, SESSION_STATUS } from '../lib/labels';
|
||||
import { muscleName, SESSION_STATUS } from '../lib/labels';
|
||||
import { Badge } from './ui';
|
||||
|
||||
interface HistoryTableProps {
|
||||
@@ -18,7 +18,7 @@ interface HistoryTableProps {
|
||||
* Port odpowiednika z aplikacji (`app/src/components/HistoryTable`) bez dodawania komentarzy.
|
||||
*/
|
||||
export default function HistoryTable({ sessions, initialOpenSessionId }: HistoryTableProps) {
|
||||
const { i18n } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
const [openSession, setOpenSession] = useState<string | null>(initialOpenSessionId ?? null);
|
||||
|
||||
return (
|
||||
@@ -78,7 +78,7 @@ export default function HistoryTable({ sessions, initialOpenSessionId }: History
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<Badge color={st.color}>{st.label}</Badge>
|
||||
<Badge color={st.color}>{t(st.labelKey)}</Badge>
|
||||
{open ? (
|
||||
<ChevronUp className="h-4 w-4 text-dim" />
|
||||
) : (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { NavLink, Outlet, useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
AppWindow,
|
||||
Building2,
|
||||
@@ -26,7 +27,7 @@ import { cn } from '../lib/utils';
|
||||
|
||||
interface NavItem {
|
||||
to: string;
|
||||
label: string;
|
||||
labelKey: string;
|
||||
icon: LucideIcon;
|
||||
end: boolean;
|
||||
/** Link na inny origin (np. aplikacja) — <a href>, nie <NavLink>. */
|
||||
@@ -34,35 +35,35 @@ interface NavItem {
|
||||
}
|
||||
|
||||
interface NavSection {
|
||||
label: string;
|
||||
labelKey: string;
|
||||
items: NavItem[];
|
||||
}
|
||||
|
||||
const SECTIONS: NavSection[] = [
|
||||
{
|
||||
label: 'Zarządzanie',
|
||||
labelKey: 'nav.management',
|
||||
items: [
|
||||
{ to: '/gyms', label: 'Siłownie', icon: Building2, end: false },
|
||||
{ to: '/verifications', label: 'Weryfikacje', icon: ShieldCheck, end: false },
|
||||
{ to: '/users', label: 'Użytkownicy', icon: Users, end: false },
|
||||
{ to: '/announcements', label: 'Ogłoszenia', icon: Megaphone, end: false },
|
||||
{ to: '/gyms', labelKey: 'nav.gyms', icon: Building2, end: false },
|
||||
{ to: '/verifications', labelKey: 'nav.verifications', icon: ShieldCheck, end: false },
|
||||
{ to: '/users', labelKey: 'nav.users', icon: Users, end: false },
|
||||
{ to: '/announcements', labelKey: 'nav.announcements', icon: Megaphone, end: false },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Słowniki',
|
||||
labelKey: 'nav.dictionaries',
|
||||
items: [
|
||||
{ to: '/focus-areas', label: 'Obszary treningowe', icon: Target, end: false },
|
||||
{ to: '/exercises', label: 'Rodzaje ćwiczeń', icon: Dumbbell, end: false },
|
||||
{ to: '/equipment', label: 'Urządzenia', icon: Wrench, end: false },
|
||||
{ to: '/focus-areas', labelKey: 'nav.focusAreas', icon: Target, end: false },
|
||||
{ to: '/exercises', labelKey: 'nav.exercises', icon: Dumbbell, end: false },
|
||||
{ to: '/equipment', labelKey: 'nav.equipment', icon: Wrench, end: false },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'System',
|
||||
labelKey: 'nav.system',
|
||||
items: [
|
||||
{ to: '/logs', label: 'Logi', icon: ScrollText, end: true },
|
||||
{ to: '/logs', labelKey: 'nav.logs', icon: ScrollText, end: true },
|
||||
// Powrót do aplikacji użytkownika — zawsze na końcu, inny origin (aplikacja
|
||||
// wznowi sesję z własnego ciastka fitos_refresh, panelu nie dotyka).
|
||||
{ to: APP_URL, label: 'Aplikacja', icon: AppWindow, end: false, external: true },
|
||||
{ to: APP_URL, labelKey: 'nav.application', icon: AppWindow, end: false, external: true },
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -87,10 +88,11 @@ function NavLinks({
|
||||
collapsed: boolean;
|
||||
onNavigate?: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<nav
|
||||
className={cn('flex flex-col gap-0.5', collapsed ? 'px-2' : 'px-3')}
|
||||
aria-label="Nawigacja główna"
|
||||
aria-label={t('nav.mainNav')}
|
||||
>
|
||||
{items.map((item) => {
|
||||
const rowClass = (isActive: boolean) =>
|
||||
@@ -100,7 +102,7 @@ function NavLinks({
|
||||
isActive ? 'bg-accent/11 text-accent-text' : 'text-dim hover:bg-line/30 hover:text-ink',
|
||||
);
|
||||
const icon = <item.icon className="h-[17px] w-[17px] shrink-0" strokeWidth={1.9} />;
|
||||
const label = !collapsed && <span className="min-w-0 truncate">{item.label}</span>;
|
||||
const label = !collapsed && <span className="min-w-0 truncate">{t(item.labelKey)}</span>;
|
||||
|
||||
if (item.external) {
|
||||
return (
|
||||
@@ -108,8 +110,8 @@ function NavLinks({
|
||||
key={item.to}
|
||||
href={item.to}
|
||||
onClick={onNavigate}
|
||||
title={collapsed ? item.label : undefined}
|
||||
aria-label={collapsed ? item.label : undefined}
|
||||
title={collapsed ? t(item.labelKey) : undefined}
|
||||
aria-label={collapsed ? t(item.labelKey) : undefined}
|
||||
className={rowClass(false)}
|
||||
>
|
||||
{icon}
|
||||
@@ -124,8 +126,8 @@ function NavLinks({
|
||||
to={item.to}
|
||||
end={item.end}
|
||||
onClick={onNavigate}
|
||||
title={collapsed ? item.label : undefined}
|
||||
aria-label={collapsed ? item.label : undefined}
|
||||
title={collapsed ? t(item.labelKey) : undefined}
|
||||
aria-label={collapsed ? t(item.labelKey) : undefined}
|
||||
className={({ isActive }) => rowClass(isActive)}
|
||||
>
|
||||
{({ isActive }) => (
|
||||
@@ -151,13 +153,14 @@ function NavLinks({
|
||||
}
|
||||
|
||||
function NavSections({ collapsed, onNavigate }: { collapsed: boolean; onNavigate?: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className={cn('flex flex-col', collapsed ? 'gap-2' : 'gap-4')}>
|
||||
{SECTIONS.map((section) => (
|
||||
<div key={section.label}>
|
||||
<div key={section.labelKey}>
|
||||
{!collapsed && (
|
||||
<div className="mb-1 px-6 text-[10.5px] font-bold uppercase tracking-[0.13em] text-dim/80">
|
||||
{section.label}
|
||||
{t(section.labelKey)}
|
||||
</div>
|
||||
)}
|
||||
<NavLinks items={section.items} collapsed={collapsed} onNavigate={onNavigate} />
|
||||
@@ -168,6 +171,7 @@ function NavSections({ collapsed, onNavigate }: { collapsed: boolean; onNavigate
|
||||
}
|
||||
|
||||
export default function Layout() {
|
||||
const { t } = useTranslation();
|
||||
const { user, logout } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const [drawerOpen, setDrawerOpen] = useState(false);
|
||||
@@ -186,7 +190,10 @@ export default function Layout() {
|
||||
const isTrainer = useIsTrainer();
|
||||
const fullName =
|
||||
[user?.firstName, user?.lastName].filter(Boolean).join(' ') || user?.email || '?';
|
||||
const roles = [user?.isAdmin ? 'Admin' : null, isTrainer ? 'Trener' : 'Ćwiczący']
|
||||
const roles = [
|
||||
user?.isAdmin ? t('nav.roleAdmin') : null,
|
||||
isTrainer ? t('nav.roleTrainer') : t('nav.roleMember'),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
|
||||
@@ -210,7 +217,7 @@ export default function Layout() {
|
||||
<LanguageToggle />
|
||||
<Button variant="secondary" size="sm" className="flex-1" onClick={doLogout}>
|
||||
<LogOut className="w-4 h-4" />
|
||||
Wyloguj
|
||||
{t('nav.logout')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -225,8 +232,8 @@ export default function Layout() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={doLogout}
|
||||
aria-label="Wyloguj"
|
||||
title="Wyloguj"
|
||||
aria-label={t('nav.logout')}
|
||||
title={t('nav.logout')}
|
||||
className="grid h-[38px] w-[38px] cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:border-danger/45 hover:text-danger"
|
||||
>
|
||||
<LogOut className="h-5 w-5" />
|
||||
@@ -248,13 +255,13 @@ export default function Layout() {
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Brandmark size={26} />
|
||||
<span className="font-display text-[1.05rem] font-bold tracking-[-0.02em]">
|
||||
FitOS Admin
|
||||
{t('appName')}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setDrawerOpen(false)}
|
||||
aria-label="Zamknij menu"
|
||||
aria-label={t('topbar.closeMenu')}
|
||||
className="-m-2 cursor-pointer p-2 text-dim hover:text-ink"
|
||||
>
|
||||
<X className="h-5 w-5" />
|
||||
@@ -284,8 +291,8 @@ export default function Layout() {
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleCollapsed}
|
||||
aria-label="Rozwiń menu"
|
||||
title="Rozwiń menu"
|
||||
aria-label={t('nav.expandMenu')}
|
||||
title={t('nav.expandMenu')}
|
||||
className="grid h-7 w-7 flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink"
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
@@ -295,14 +302,14 @@ export default function Layout() {
|
||||
<div className="flex min-w-0 items-center gap-2.5">
|
||||
<Brandmark size={26} />
|
||||
<span className="font-display text-[1.05rem] font-bold tracking-[-0.02em]">
|
||||
FitOS Admin
|
||||
{t('appName')}
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleCollapsed}
|
||||
aria-label="Zwiń menu"
|
||||
title="Zwiń menu"
|
||||
aria-label={t('nav.collapseMenu')}
|
||||
title={t('nav.collapseMenu')}
|
||||
className="ml-auto grid h-7 w-7 flex-none cursor-pointer place-items-center rounded-[10px] border border-line bg-card text-dim shadow-card transition-colors hover:text-ink"
|
||||
>
|
||||
<Menu className="h-4 w-4" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Search, X } from 'lucide-react';
|
||||
import type { User } from '../api/types';
|
||||
|
||||
@@ -11,9 +12,9 @@ export function UserPicker({
|
||||
users,
|
||||
value,
|
||||
onChange,
|
||||
ariaLabel = 'Szukaj użytkownika',
|
||||
listLabel = 'Lista użytkowników',
|
||||
emptyLabel = 'Brak użytkowników',
|
||||
ariaLabel,
|
||||
listLabel,
|
||||
emptyLabel,
|
||||
}: {
|
||||
users: User[];
|
||||
value: string;
|
||||
@@ -22,8 +23,10 @@ export function UserPicker({
|
||||
listLabel?: string;
|
||||
emptyLabel?: string;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [query, setQuery] = useState('');
|
||||
const [open, setOpen] = useState(false);
|
||||
const aria = ariaLabel ?? t('picker.userAria');
|
||||
const selected = users.find((u) => u.id === value);
|
||||
const q = query.trim().toLowerCase();
|
||||
const filtered = q
|
||||
@@ -49,9 +52,9 @@ export function UserPicker({
|
||||
<input
|
||||
role="combobox"
|
||||
aria-expanded={open}
|
||||
aria-label={ariaLabel}
|
||||
aria-label={aria}
|
||||
className="w-full bg-transparent py-2.5 text-[0.95rem] focus:outline-none"
|
||||
placeholder={selected && !open ? '' : `${ariaLabel}…`}
|
||||
placeholder={selected && !open ? '' : `${aria}…`}
|
||||
value={open ? query : selected ? userLabel(selected) : ''}
|
||||
onChange={(e) => {
|
||||
setQuery(e.target.value);
|
||||
@@ -62,7 +65,7 @@ export function UserPicker({
|
||||
{selected && !open && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Wyczyść wybór użytkownika"
|
||||
aria-label={t('picker.userClear')}
|
||||
onClick={() => onChange('')}
|
||||
className="shrink-0 cursor-pointer text-dim hover:text-ink"
|
||||
>
|
||||
@@ -73,12 +76,14 @@ export function UserPicker({
|
||||
{open && (
|
||||
<div
|
||||
role="listbox"
|
||||
aria-label={listLabel}
|
||||
aria-label={listLabel ?? t('picker.userList')}
|
||||
className="absolute z-20 mt-1.5 max-h-56 w-full overflow-y-auto rounded-xl border border-line bg-card shadow-xl"
|
||||
>
|
||||
{filtered.length === 0 ? (
|
||||
<div className="px-3.5 py-3 text-[0.875rem] text-dim">
|
||||
{q ? `Brak użytkowników dla „${query.trim()}”` : emptyLabel}
|
||||
{q
|
||||
? t('picker.userNoResults', { query: query.trim() })
|
||||
: (emptyLabel ?? t('picker.userEmpty'))}
|
||||
</div>
|
||||
) : (
|
||||
filtered.map((u) => (
|
||||
|
||||
@@ -2,11 +2,19 @@ import type { ReactNode } from 'react';
|
||||
import { cn } from '../../lib/utils';
|
||||
|
||||
function ErrorText({ children, className }: { children: ReactNode; className?: string }) {
|
||||
return <div data-slot="alert" className={cn('mt-2 text-[0.9rem] text-danger', className)}>{children}</div>;
|
||||
return (
|
||||
<div data-slot="alert" className={cn('mt-2 text-[0.9rem] text-danger', className)}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SuccessText({ children, className }: { children: ReactNode; className?: string }) {
|
||||
return <div data-slot="alert" className={cn('mt-2 text-[0.9rem] text-accent-text', className)}>{children}</div>;
|
||||
return (
|
||||
<div data-slot="alert" className={cn('mt-2 text-[0.9rem] text-accent-text', className)}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { ErrorText, SuccessText };
|
||||
|
||||
@@ -21,7 +21,8 @@ const badgeVariants = cva(
|
||||
);
|
||||
|
||||
export interface BadgeProps
|
||||
extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>,
|
||||
extends
|
||||
Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>,
|
||||
VariantProps<typeof badgeVariants> {}
|
||||
|
||||
function Badge({ className, color, ...props }: BadgeProps) {
|
||||
|
||||
@@ -26,7 +26,8 @@ const buttonVariants = cva(
|
||||
);
|
||||
|
||||
export interface ButtonProps
|
||||
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
extends
|
||||
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||
Omit<VariantProps<typeof buttonVariants>, 'size'> {
|
||||
size?: 'md' | 'sm';
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElemen
|
||||
<div
|
||||
ref={ref}
|
||||
data-slot="card"
|
||||
className={cn('bg-(image:--card-grad) border border-line rounded-xl shadow-card p-5 sm:p-6 mb-4', className)}
|
||||
className={cn(
|
||||
'bg-(image:--card-grad) border border-line rounded-xl shadow-card p-5 sm:p-6 mb-4',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ArrowLeft, X } from 'lucide-react';
|
||||
import { buttonVariants } from './button';
|
||||
import { H2, H3, Muted } from './typography';
|
||||
@@ -138,7 +139,7 @@ export function ListRow({
|
||||
export function Chip({
|
||||
children,
|
||||
onRemove,
|
||||
removeLabel = 'Usuń',
|
||||
removeLabel,
|
||||
className = '',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
@@ -146,6 +147,7 @@ export function Chip({
|
||||
removeLabel?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<span
|
||||
data-slot="chip"
|
||||
@@ -156,7 +158,7 @@ export function Chip({
|
||||
<button
|
||||
type="button"
|
||||
onClick={onRemove}
|
||||
aria-label={removeLabel}
|
||||
aria-label={removeLabel ?? t('remove')}
|
||||
className="text-dim hover:text-danger cursor-pointer"
|
||||
>
|
||||
<X className="w-3.5 h-3.5" />
|
||||
|
||||
@@ -52,12 +52,23 @@ const DialogContent = React.forwardRef<
|
||||
DialogContent.displayName = 'DialogContent';
|
||||
|
||||
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
||||
<div data-slot="dialog-header" className={cn('mb-4 flex items-center justify-between gap-3', className)} {...props} />
|
||||
<div
|
||||
data-slot="dialog-header"
|
||||
className={cn('mb-4 flex items-center justify-between gap-3', className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
DialogHeader.displayName = 'DialogHeader';
|
||||
|
||||
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
||||
<div data-slot="dialog-footer" className={cn('mt-5 flex flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-end', className)} {...props} />
|
||||
<div
|
||||
data-slot="dialog-footer"
|
||||
className={cn(
|
||||
'mt-5 flex flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-end',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
DialogFooter.displayName = 'DialogFooter';
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { X } from 'lucide-react';
|
||||
import { Button } from './button';
|
||||
import {
|
||||
@@ -32,7 +33,10 @@ export function Modal({
|
||||
<h3 className="text-[1.05rem] font-semibold">{title}</h3>
|
||||
</DialogTitle>
|
||||
<DialogClose asChild>
|
||||
<button aria-label="Zamknij" className="p-1.5 -m-1.5 text-dim hover:text-ink cursor-pointer">
|
||||
<button
|
||||
aria-label="Zamknij"
|
||||
className="p-1.5 -m-1.5 text-dim hover:text-ink cursor-pointer"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
</DialogClose>
|
||||
@@ -53,7 +57,7 @@ export function ConfirmDialog({
|
||||
onConfirm,
|
||||
title,
|
||||
description,
|
||||
confirmLabel = 'Potwierdź',
|
||||
confirmLabel,
|
||||
danger,
|
||||
busy,
|
||||
}: {
|
||||
@@ -66,15 +70,21 @@ export function ConfirmDialog({
|
||||
danger?: boolean;
|
||||
busy?: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Modal open={open} onClose={onClose} title={title}>
|
||||
<p className="text-dim text-[0.95rem]">{description}</p>
|
||||
<div className="flex flex-col-reverse sm:flex-row sm:items-center sm:justify-end gap-3 mt-5">
|
||||
<Button variant="secondary" onClick={onClose} className="w-full sm:w-auto">
|
||||
Anuluj
|
||||
{t('cancel')}
|
||||
</Button>
|
||||
<Button variant={danger ? 'danger' : 'primary'} onClick={onConfirm} disabled={busy} className="w-full sm:w-auto">
|
||||
{confirmLabel}
|
||||
<Button
|
||||
variant={danger ? 'danger' : 'primary'}
|
||||
onClick={onConfirm}
|
||||
disabled={busy}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
{confirmLabel ?? t('confirm')}
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -18,12 +18,19 @@ const inputVariants = cva(
|
||||
);
|
||||
|
||||
export interface InputProps
|
||||
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>,
|
||||
extends
|
||||
Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>,
|
||||
VariantProps<typeof inputVariants> {}
|
||||
|
||||
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||
({ className, size, type, ...props }, ref) => (
|
||||
<input type={type} data-slot="input" className={cn(inputVariants({ size }), className)} ref={ref} {...props} />
|
||||
<input
|
||||
type={type}
|
||||
data-slot="input"
|
||||
className={cn(inputVariants({ size }), className)}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
);
|
||||
Input.displayName = 'Input';
|
||||
|
||||
@@ -6,7 +6,10 @@ const Label = React.forwardRef<HTMLLabelElement, React.LabelHTMLAttributes<HTMLL
|
||||
<label
|
||||
ref={ref}
|
||||
data-slot="label"
|
||||
className={cn('block mb-1.5 text-dim text-[11px] font-bold uppercase tracking-[0.1em]', className)}
|
||||
className={cn(
|
||||
'block mb-1.5 text-dim text-[11px] font-bold uppercase tracking-[0.1em]',
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
|
||||
@@ -2,7 +2,10 @@ import { cn } from '../../lib/utils';
|
||||
|
||||
function Progress({ percent, className }: { percent: number; className?: string }) {
|
||||
return (
|
||||
<div data-slot="progress" className={cn('h-2 overflow-hidden rounded-full bg-input', className)}>
|
||||
<div
|
||||
data-slot="progress"
|
||||
className={cn('h-2 overflow-hidden rounded-full bg-input', className)}
|
||||
>
|
||||
<div
|
||||
className="h-full rounded-full bg-(image:--progress-grad) transition-[width] duration-300"
|
||||
style={{ width: `${Math.max(0, Math.min(100, percent))}%` }}
|
||||
|
||||
@@ -2,7 +2,9 @@ import * as React from 'react';
|
||||
import { cn } from '../../lib/utils';
|
||||
|
||||
function Skeleton({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
|
||||
return <div data-slot="skeleton" className={cn('skeleton-shimmer rounded-xl', className)} {...props} />;
|
||||
return (
|
||||
<div data-slot="skeleton" className={cn('skeleton-shimmer rounded-xl', className)} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
export { Skeleton };
|
||||
|
||||
@@ -18,12 +18,18 @@ const textareaVariants = cva(
|
||||
);
|
||||
|
||||
export interface TextareaProps
|
||||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
||||
extends
|
||||
React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
||||
VariantProps<typeof textareaVariants> {}
|
||||
|
||||
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ className, size, ...props }, ref) => (
|
||||
<textarea data-slot="textarea" className={cn(textareaVariants({ size }), className)} ref={ref} {...props} />
|
||||
<textarea
|
||||
data-slot="textarea"
|
||||
className={cn(textareaVariants({ size }), className)}
|
||||
ref={ref}
|
||||
{...props}
|
||||
/>
|
||||
),
|
||||
);
|
||||
Textarea.displayName = 'Textarea';
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { cn } from '../../lib/utils';
|
||||
|
||||
export function H1({ className, children }: { className?: string; children: ReactNode }) {
|
||||
return <h1 className={cn('text-[1.75rem] font-bold tracking-[-0.02em] mb-4', className)}>{children}</h1>;
|
||||
return (
|
||||
<h1 className={cn('text-[1.75rem] font-bold tracking-[-0.02em] mb-4', className)}>
|
||||
{children}
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
export function H2({ className, children }: { className?: string; children: ReactNode }) {
|
||||
return <h2 className={cn('text-[1.25rem] font-bold tracking-[-0.01em] mb-3', className)}>{children}</h2>;
|
||||
return (
|
||||
<h2 className={cn('text-[1.25rem] font-bold tracking-[-0.01em] mb-3', className)}>
|
||||
{children}
|
||||
</h2>
|
||||
);
|
||||
}
|
||||
|
||||
export function H3({ className, children }: { className?: string; children: ReactNode }) {
|
||||
@@ -17,6 +26,7 @@ export function Muted({ className, children }: { className?: string; children: R
|
||||
return <span className={cn('text-dim', className)}>{children}</span>;
|
||||
}
|
||||
|
||||
export function Loading({ children = 'Ładowanie…' }: { children?: ReactNode }) {
|
||||
return <div className="text-dim">{children}</div>;
|
||||
export function Loading({ children }: { children?: ReactNode }) {
|
||||
const { t } = useTranslation();
|
||||
return <div className="text-dim">{children ?? t('loading')}</div>;
|
||||
}
|
||||
|
||||
@@ -10,17 +10,62 @@ import plCommon from './locales/pl/common.json';
|
||||
import plAuth from './locales/pl/auth.json';
|
||||
import plErrors from './locales/pl/errors.json';
|
||||
import plBody from './locales/pl/body.json';
|
||||
import plGyms from './locales/pl/gyms.json';
|
||||
import plUsers from './locales/pl/users.json';
|
||||
import plCatalog from './locales/pl/catalog.json';
|
||||
import plLogs from './locales/pl/logs.json';
|
||||
import plVerifications from './locales/pl/verifications.json';
|
||||
import plAnnouncements from './locales/pl/announcements.json';
|
||||
import enCommon from './locales/en/common.json';
|
||||
import enAuth from './locales/en/auth.json';
|
||||
import enErrors from './locales/en/errors.json';
|
||||
import enBody from './locales/en/body.json';
|
||||
import enGyms from './locales/en/gyms.json';
|
||||
import enUsers from './locales/en/users.json';
|
||||
import enCatalog from './locales/en/catalog.json';
|
||||
import enLogs from './locales/en/logs.json';
|
||||
import enVerifications from './locales/en/verifications.json';
|
||||
import enAnnouncements from './locales/en/announcements.json';
|
||||
|
||||
export const NAMESPACES = ['common', 'auth', 'errors', 'body'] as const;
|
||||
export const NAMESPACES = [
|
||||
'common',
|
||||
'auth',
|
||||
'errors',
|
||||
'body',
|
||||
'gyms',
|
||||
'users',
|
||||
'catalog',
|
||||
'logs',
|
||||
'verifications',
|
||||
'announcements',
|
||||
] as const;
|
||||
export type Namespace = (typeof NAMESPACES)[number];
|
||||
|
||||
const resources = {
|
||||
pl: { common: plCommon, auth: plAuth, errors: plErrors, body: plBody },
|
||||
en: { common: enCommon, auth: enAuth, errors: enErrors, body: enBody },
|
||||
pl: {
|
||||
common: plCommon,
|
||||
auth: plAuth,
|
||||
errors: plErrors,
|
||||
body: plBody,
|
||||
gyms: plGyms,
|
||||
users: plUsers,
|
||||
catalog: plCatalog,
|
||||
logs: plLogs,
|
||||
verifications: plVerifications,
|
||||
announcements: plAnnouncements,
|
||||
},
|
||||
en: {
|
||||
common: enCommon,
|
||||
auth: enAuth,
|
||||
errors: enErrors,
|
||||
body: enBody,
|
||||
gyms: enGyms,
|
||||
users: enUsers,
|
||||
catalog: enCatalog,
|
||||
logs: enLogs,
|
||||
verifications: enVerifications,
|
||||
announcements: enAnnouncements,
|
||||
},
|
||||
} as const;
|
||||
|
||||
const initial = detectInitialLanguage();
|
||||
|
||||
25
admin/src/i18n/locales/en/announcements.json
Normal file
25
admin/src/i18n/locales/en/announcements.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"kindManual": "Manual",
|
||||
"kindHoursChange": "Hours change",
|
||||
"kindException": "Exception",
|
||||
"platform": "Platform",
|
||||
"newAnnouncement": "New announcement",
|
||||
"noTitle": "No announcements",
|
||||
"noDesc": "No announcements. Add the first one using the “New announcement” button in the context menu.",
|
||||
"noResultsDesc": "No results for the given query.",
|
||||
"editAria": "Edit {{name}}",
|
||||
"removeAria": "Remove {{name}}",
|
||||
"editTitle": "Edit announcement",
|
||||
"recipients": "Recipients",
|
||||
"recipientsAll": "All users (platform)",
|
||||
"recipientsGym": "Gym: {{name}}",
|
||||
"recipientsPrefix": "Recipients: ",
|
||||
"recipientsAllLower": "all users (platform)",
|
||||
"titleLabel": "Title",
|
||||
"titlePh": "e.g. Platform maintenance break",
|
||||
"bodyLabel": "Body",
|
||||
"bodyPh": "Announcement body…",
|
||||
"publish": "Publish",
|
||||
"deleteTitle": "Delete announcement",
|
||||
"deleteDesc": "Are you sure you want to delete \"{{title}}\"?"
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
"password": "Password",
|
||||
"rememberMe": "Remember me",
|
||||
"login": "Log in",
|
||||
"loginError": "Login error",
|
||||
"notAdmin": "Access restricted to administrators",
|
||||
"loginLoading": "Logging in…",
|
||||
"claimTitle": "The whole platform in one panel.",
|
||||
"claimSubtitle": "For the platform administrator.",
|
||||
|
||||
97
admin/src/i18n/locales/en/catalog.json
Normal file
97
admin/src/i18n/locales/en/catalog.json
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"intro": "Catalog of machines and equipment. Assign them to exercise types and gyms.",
|
||||
"newDevice": "New equipment",
|
||||
"editDevice": "Edit equipment",
|
||||
"noDevicesTitle": "No equipment",
|
||||
"noDevicesDesc": "No equipment yet. Add the first ones using “New equipment” in the context menu.",
|
||||
"noResultsDesc": "No results for the given query.",
|
||||
"editAria": "Edit {{name}}",
|
||||
"removeAria": "Remove {{name}}",
|
||||
"nameLabel": "Name",
|
||||
"namePh": "e.g. Barbell",
|
||||
"nameLabelEn": "Name (EN)",
|
||||
"kindLabel": "Type",
|
||||
"descLabel": "Description (optional)",
|
||||
"descPh": "e.g. Barbell with plates.",
|
||||
"minKgLabel": "Min load (kg)",
|
||||
"minKgPh": "e.g. 2.5",
|
||||
"maxKgLabel": "Max load (kg)",
|
||||
"maxKgPh": "e.g. 25",
|
||||
"maxLoadKgLabel": "Maximum load (kg)",
|
||||
"maxLoadKgPh": "e.g. 100",
|
||||
"maxSpeedLabel": "Max speed (km/h, optional)",
|
||||
"maxSpeedPh": "e.g. 16",
|
||||
"maxInclineLabel": "Max incline (%, optional)",
|
||||
"maxInclinePh": "e.g. 15",
|
||||
"deleteTitle": "Delete equipment",
|
||||
"countExercises": "{{n}} exercises",
|
||||
"countGyms": "{{n}} gyms",
|
||||
"countPlans": "{{n}} plans",
|
||||
"deleteDescWithCounts": "Delete “{{name}}”? It will be detached from {{exercises}} exercises and {{gyms}} gyms.",
|
||||
"deleteDescSimple": "Delete “{{name}}”? It will be detached from exercises and gyms.",
|
||||
"introEx": "Exercise types and the machines/equipment assigned to them.",
|
||||
"newExercise": "New exercise",
|
||||
"editExercise": "Edit exercise",
|
||||
"noExercisesTitle": "No exercises",
|
||||
"noExercisesDesc": "No exercises yet. Add the first ones using “New exercise” in the context menu.",
|
||||
"namePhEx": "e.g. Barbell bench press",
|
||||
"primaryMuscle": "Primary muscle",
|
||||
"secondaryMuscles": "Secondary muscles",
|
||||
"noAreasHint": "No areas in the catalog. Add them in the “Focus areas” section.",
|
||||
"noEquipmentHint": "No equipment in the catalog. Add them in the “Equipment” section.",
|
||||
"exerciseType": "Exercise type",
|
||||
"savedValues": "Saved values",
|
||||
"machines": "Machines / equipment",
|
||||
"noMachines": "no machines",
|
||||
"descPhEx": "Short exercise description shown in the app.",
|
||||
"howToLabel": "How to perform (optional)",
|
||||
"howToPh": "Execution instructions.",
|
||||
"mistakesLabel": "Common mistakes (optional)",
|
||||
"mistakesPh": "What to avoid when performing.",
|
||||
"chooseOption": "— select —",
|
||||
"muscleNotInCatalog": "{{name}} (not in area catalog)",
|
||||
"typeStrength": "Strength",
|
||||
"typeCardio": "Cardio",
|
||||
"typeCustom": "Custom",
|
||||
"sourceBuiltin": "built-in",
|
||||
"sourceGymCustom": "gym's",
|
||||
"sourceTrainerCustom": "trainer's",
|
||||
"flagHasReps": "Reps",
|
||||
"flagHasLoad": "Load",
|
||||
"flagHasRest": "Rest",
|
||||
"flagHasSets": "Sets",
|
||||
"flagHasRir": "RIR",
|
||||
"flagHasDifficulty": "Difficulty",
|
||||
"flagHasCardio": "Cardio",
|
||||
"flagHasTime": "Time",
|
||||
"flagHasSpeed": "Speed",
|
||||
"chipCardio": "cardio",
|
||||
"chipTime": "time",
|
||||
"chipSpeed": "speed",
|
||||
"chipReps": "reps",
|
||||
"chipLoad": "load",
|
||||
"chipRir": "RIR",
|
||||
"deleteExerciseTitle": "Delete exercise",
|
||||
"deleteExerciseDesc": "Delete “{{name}}”? Exercises used in plans cannot be deleted.",
|
||||
"flagChangeTitle": "You are changing the exercise type",
|
||||
"flagChangeDesc": "“{{name}}” is used in {{count}} plan(s). Changing saved values (sets/load/time...) will affect ongoing plans. Continue?",
|
||||
"introAreas": "Catalog of training focus areas — users and trainers pick priorities and exclusions from it.",
|
||||
"newArea": "New area",
|
||||
"editArea": "Edit area",
|
||||
"noAreasTitle": "No areas",
|
||||
"noAreasDesc": "No areas yet. Add the first one using “New area” in the context menu.",
|
||||
"setsPerWeek": "{{min}}–{{max}} sets/week",
|
||||
"namePhArea": "e.g. Chest",
|
||||
"muscleKey": "Muscle key",
|
||||
"muscleKeyPh": "e.g. chest",
|
||||
"descPhArea": "e.g. Presses, flyes, push-ups",
|
||||
"setsMinLabel": "Recommended sets min./week",
|
||||
"setsMinPh": "e.g. 10",
|
||||
"setsMaxLabel": "Recommended sets max./week",
|
||||
"setsMaxPh": "e.g. 20",
|
||||
"setsOrderError": "Minimum sets must be less than or equal to maximum sets.",
|
||||
"muscleChangeTitle": "You are changing the muscle key",
|
||||
"muscleChangeDesc": "The “{{name}}” area has {{count}} exercises assigned with the current key. After the change they will no longer match the priority chain. Continue?",
|
||||
"deleteAreaTitle": "Delete area",
|
||||
"deleteAreaDesc": "Delete “{{name}}”? Users will no longer be able to select it."
|
||||
}
|
||||
@@ -1,10 +1,188 @@
|
||||
{
|
||||
"appName": "FitOS Admin",
|
||||
"errorPrefix": "Error: ",
|
||||
"error": "Error",
|
||||
"cancel": "Cancel",
|
||||
"confirm": "Confirm",
|
||||
"save": "Save",
|
||||
"saving": "Saving…",
|
||||
"edit": "Edit",
|
||||
"add": "Add",
|
||||
"close": "Close",
|
||||
"closeNotification": "Close notification",
|
||||
"toggleTheme": "Toggle theme",
|
||||
"toggleLanguage": "Change language"
|
||||
"toggleLanguage": "Change language",
|
||||
"remove": "Remove",
|
||||
"back": "Back",
|
||||
"showMore": "Show more",
|
||||
"ok": "OK",
|
||||
"yes": "yes",
|
||||
"no": "no",
|
||||
"loading": "Loading…",
|
||||
"searchShort": "Search…",
|
||||
"all": "All",
|
||||
"noData": "No data",
|
||||
"nav": {
|
||||
"gyms": "Gyms",
|
||||
"users": "Users",
|
||||
"announcements": "Announcements",
|
||||
"exercises": "Exercise types",
|
||||
"equipment": "Equipment",
|
||||
"focusAreas": "Focus areas",
|
||||
"logs": "Logs",
|
||||
"verifications": "Verifications",
|
||||
"management": "Management",
|
||||
"dictionaries": "Dictionaries",
|
||||
"system": "System",
|
||||
"application": "App",
|
||||
"logout": "Log out",
|
||||
"mainNav": "Main navigation",
|
||||
"expandMenu": "Expand menu",
|
||||
"collapseMenu": "Collapse menu",
|
||||
"roleAdmin": "Admin",
|
||||
"roleTrainer": "Trainer",
|
||||
"roleMember": "Member"
|
||||
},
|
||||
"topbar": {
|
||||
"openMenu": "Open menu",
|
||||
"closeMenu": "Close menu",
|
||||
"filters": "Filters",
|
||||
"add": "Add",
|
||||
"actions": "Actions",
|
||||
"search": "Search",
|
||||
"searchGyms": "Search gyms",
|
||||
"searchUsers": "Search user",
|
||||
"searchAnnouncements": "Search announcement",
|
||||
"searchFocusAreas": "Search focus area",
|
||||
"searchExercises": "Search exercises",
|
||||
"searchEquipment": "Search equipment",
|
||||
"searchLogs": "Search user",
|
||||
"prevMonth": "Previous month",
|
||||
"nextMonth": "Next month",
|
||||
"prevMonthWithData": "Previous month with data",
|
||||
"nextMonthWithData": "Next month with data"
|
||||
},
|
||||
"weekShort": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
||||
"picker": {
|
||||
"userAria": "Search user",
|
||||
"userList": "User list",
|
||||
"userEmpty": "No users",
|
||||
"userClear": "Clear user selection",
|
||||
"userNoResults": "No users for “{{query}}”",
|
||||
"gymAria": "Search gym",
|
||||
"gymPh": "Search gym…",
|
||||
"gymClear": "Clear gym selection",
|
||||
"gymList": "Gym list",
|
||||
"gymNoResults": "No gyms named “{{query}}”",
|
||||
"gymEmpty": "No gyms available"
|
||||
},
|
||||
"equipmentKind": {
|
||||
"DUMBBELL": "Dumbbells",
|
||||
"KETTLEBELL": "Kettlebell",
|
||||
"BARBELL": "Barbell",
|
||||
"CABLE": "Cable",
|
||||
"MACHINE": "Machine",
|
||||
"BENCH": "Bench",
|
||||
"CARDIO": "Cardio",
|
||||
"BODYWEIGHT": "Bodyweight",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"roles": {
|
||||
"member": {
|
||||
"label": "Member",
|
||||
"summary": "Regular gym member — trains and follows plans.",
|
||||
"g0": "Creating plans and running workouts",
|
||||
"g1": "Access to gym feed and statistics"
|
||||
},
|
||||
"trainer": {
|
||||
"label": "Trainer",
|
||||
"summary": "Coaches trainees and writes their training plans.",
|
||||
"g0": "Inviting and looking after trainees",
|
||||
"g1": "Creating and editing their plans",
|
||||
"g2": "Insight into trainees' progress"
|
||||
},
|
||||
"owner": {
|
||||
"label": "Owner",
|
||||
"summary": "Manages the gym — a permission, not a membership itself.",
|
||||
"g0": "Gym details, hours and address",
|
||||
"g1": "Equipment, photos and schedule",
|
||||
"g2": "Inviting people and assigning their roles"
|
||||
},
|
||||
"admin": {
|
||||
"label": "Administrator",
|
||||
"summary": "Access to the whole FitOS admin panel.",
|
||||
"g0": "Managing all users and gyms",
|
||||
"g1": "Reviewing gym applications",
|
||||
"g2": "Catalogs, announcements and system logs"
|
||||
},
|
||||
"picker": {
|
||||
"hint": "Select a role to see what it gives exactly. Member = trains, Trainer = coaches trainees, Owner = manages the gym."
|
||||
}
|
||||
},
|
||||
"avail": {
|
||||
"available": "available",
|
||||
"from": "from",
|
||||
"to": "to"
|
||||
},
|
||||
"muscles": {
|
||||
"chest": "Chest",
|
||||
"back": "Back",
|
||||
"legs": "Legs",
|
||||
"shoulders": "Shoulders",
|
||||
"biceps": "Biceps",
|
||||
"triceps": "Triceps",
|
||||
"core": "Core",
|
||||
"glutes": "Glutes",
|
||||
"forearms": "Forearms",
|
||||
"calves": "Calves"
|
||||
},
|
||||
"socialMedia": {
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"counters": {
|
||||
"daysCount_one": "{{count}} day",
|
||||
"daysCount_other": "{{count}} days",
|
||||
"exercises_one": "{{count}} exercise",
|
||||
"exercises_other": "{{count}} exercises",
|
||||
"weeks_one": "{{count}} week",
|
||||
"weeks_other": "{{count}} weeks",
|
||||
"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",
|
||||
"members_one": "{{count}} member",
|
||||
"members_other": "{{count}} members",
|
||||
"gyms_one": "{{count}} gym",
|
||||
"gyms_other": "{{count}} gyms",
|
||||
"plans_one": "{{count}} plan",
|
||||
"plans_other": "{{count}} plans"
|
||||
},
|
||||
"fmt": {
|
||||
"justNow": "just now",
|
||||
"minAgo_one": "{{count}} min ago",
|
||||
"minAgo_other": "{{count}} min ago",
|
||||
"hourAgo_one": "{{count}} hr ago",
|
||||
"hourAgo_other": "{{count}} hr ago",
|
||||
"yesterday": "yesterday",
|
||||
"daysAgo_one": "{{count}} day ago",
|
||||
"daysAgo_other": "{{count}} days ago",
|
||||
"lt1m": "<1 min",
|
||||
"mins": "{{count}} min",
|
||||
"hoursMins": "{{h}} h {{m}} min",
|
||||
"hours": "{{h}} h",
|
||||
"remainingSets_one": "{{count}} set left",
|
||||
"remainingSets_other": "{{count}} sets left"
|
||||
},
|
||||
"statuses": {
|
||||
"session": {
|
||||
"IN_PROGRESS": "In progress",
|
||||
"COMPLETED": "Completed",
|
||||
"ABANDONED": "Abandoned"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
142
admin/src/i18n/locales/en/gyms.json
Normal file
142
admin/src/i18n/locales/en/gyms.json
Normal file
@@ -0,0 +1,142 @@
|
||||
{
|
||||
"spec": {
|
||||
"upToKg": "up to {{v}} kg",
|
||||
"fromKg": "from {{v}} kg",
|
||||
"upToKmh": "up to {{v}} km/h",
|
||||
"inclineUpTo": "incline up to {{v}}%"
|
||||
},
|
||||
"equipment": {
|
||||
"specRangeError": "Provide the load range (min and max in kg).",
|
||||
"specMaxLoadError": "Provide the maximum load (kg).",
|
||||
"specCardioError": "Provide the equipment parameters (speed or incline)."
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"virtual": "Virtual",
|
||||
"private": "Private",
|
||||
"open": "Open →",
|
||||
"allGyms": "All gyms",
|
||||
"newGym": "New gym",
|
||||
"noResults": "No results",
|
||||
"noResultsDesc": "No results for the given query.",
|
||||
"noGymsTitle": "No gyms",
|
||||
"noGymsDesc": "No gyms yet. Add the first one using “New gym” in the context menu.",
|
||||
"nameLabel": "Name",
|
||||
"membersCapacity": "{{members}}/{{capacity}} members",
|
||||
"owner": "Owner",
|
||||
"capacity": "Capacity",
|
||||
"availability": "Availability",
|
||||
"addressSection": "Address",
|
||||
"searchOwner": "Search owner",
|
||||
"noUsers": "No users",
|
||||
"loading": "Loading…",
|
||||
"ownerHint": "Assign an owner — they will get the OWNER role and access to gym management.",
|
||||
"create": "Create gym",
|
||||
"closed": "closed",
|
||||
"today": "today",
|
||||
"noPhotos": "No photos.",
|
||||
"photosMore_one": "+{{count}} photo",
|
||||
"photosMore_other": "+{{count}} photos",
|
||||
"noEquipment": "No equipment.",
|
||||
"addExceptionTitle": "Add exception — date and day mode",
|
||||
"exceptionDateAria": "Exception date",
|
||||
"closedBtn": "Closed",
|
||||
"otherHours": "Other hours",
|
||||
"fromHourAria": "From hour",
|
||||
"toHourAria": "To hour",
|
||||
"adding": "Adding…",
|
||||
"add": "Add",
|
||||
"noExceptions": "No exceptions.",
|
||||
"existingLocation": "Current location: “{{location}}”. Providing an address will overwrite it with a structured address.",
|
||||
"saved": "Changes saved.",
|
||||
"noOwnerTitle": "No owner",
|
||||
"noOwnerDesc": "Assign a person who will manage the gym in the app.",
|
||||
"revokeAria": "Revoke role",
|
||||
"revokeTitle": "Revoke owner role",
|
||||
"searchFutureOwner": "Search future owner",
|
||||
"noOwnerCandidates": "No candidates — all users are already owners",
|
||||
"granting": "Granting…",
|
||||
"grantOwner": "Grant owner",
|
||||
"ownerRoleHint": "The owner manages the gym in the app: equipment, gallery and schedule.",
|
||||
"groupEdit": "Editing",
|
||||
"basicInfo": "Basic information",
|
||||
"groupGallery": "Gallery",
|
||||
"groupEquipment": "Equipment",
|
||||
"groupOwners": "Owners",
|
||||
"groupAnnouncements": "Announcements",
|
||||
"announceOnBehalf": "Announce on behalf of the gym",
|
||||
"deleteGym": "Delete gym",
|
||||
"deleteGymDesc": "Delete this gym? Memberships will be removed, user plans will be kept.",
|
||||
"notFound": "Gym not found.",
|
||||
"gallerySection": "Photo gallery",
|
||||
"equipmentDesc": "Machines and equipment available at this gym.",
|
||||
"hours": "Opening hours",
|
||||
"exceptions": "Exceptions",
|
||||
"data": "Details",
|
||||
"kindLabel": "Type",
|
||||
"kindReal": "Real",
|
||||
"kindVirtual": "Virtual",
|
||||
"privateLabel": "Private",
|
||||
"capacityLabel": "Capacity",
|
||||
"streetLabel": "Street",
|
||||
"cityCodeLabel": "Code and city",
|
||||
"countryLabel": "Country",
|
||||
"locationLabel": "Location",
|
||||
"ownersLabel": "Owners",
|
||||
"exceptionsTitle": "Schedule exceptions",
|
||||
"exceptionsDesc": "One-off changes for a specific day (closure or other hours).",
|
||||
"manageGallery": "Manage gallery",
|
||||
"manageEquipment": "Manage equipment",
|
||||
"manageOwners": "Manage owners",
|
||||
"announcementsTitle": "Announcements on behalf of the gym",
|
||||
"announcementSendTo": "The announcement will reach all members of “{{name}}”.",
|
||||
"announcementTitleLabel": "Title",
|
||||
"announcementTitlePh": "e.g. Power outage — gym closed",
|
||||
"announcementBodyLabel": "Body",
|
||||
"announcementBodyPh": "Announcement body…",
|
||||
"publishing": "Publishing…",
|
||||
"publish": "Publish",
|
||||
"noAnnouncements": "No announcements for this gym.",
|
||||
"removeAria": "Remove {{name}}",
|
||||
"positionsInStock": "In stock ({{count}})",
|
||||
"noStockDesc": "No equipment — add the first ones from the catalog below.",
|
||||
"qtyAria": "Quantity: {{name}}",
|
||||
"addFromCatalog": "Add equipment from catalog",
|
||||
"addDeviceAria": "Add equipment",
|
||||
"chooseDevice": "Choose equipment…",
|
||||
"inStockOption": "(in stock: {{count}})",
|
||||
"qty": "Quantity",
|
||||
"parameters": "Parameters",
|
||||
"specRequired": "Provide equipment parameters (speed or incline).",
|
||||
"minLoad": "Min. load (kg)",
|
||||
"maxLoad": "Max. load (kg)",
|
||||
"maxLoadFull": "Maximum load (kg)",
|
||||
"maxSpeed": "Max. speed (km/h)",
|
||||
"maxIncline": "Max. incline (%)",
|
||||
"galleryDesc": "Photos of this gym. The first item is the cover (shown in the list).",
|
||||
"photoAlt": "Photo {{n}}",
|
||||
"coverBadge": "Cover",
|
||||
"coverLabel": "cover",
|
||||
"setCover": "Set as cover",
|
||||
"removePhotoAria": "Remove photo",
|
||||
"uploading": "Uploading…",
|
||||
"addPhotos": "Add photos",
|
||||
"photoTypesError": "Allowed files: JPEG, PNG, WEBP (max 5 MB).",
|
||||
"photoMaxFilesError": "Maximum {{count}} files at once.",
|
||||
"confirmDeletePhoto": "Delete this photo?"
|
||||
}
|
||||
65
admin/src/i18n/locales/en/logs.json
Normal file
65
admin/src/i18n/locales/en/logs.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"filterAria": "Filter by action",
|
||||
"allActions": "All actions",
|
||||
"noEventsTitle": "No events",
|
||||
"noResultsDesc": "No results for the given query.",
|
||||
"noEventsFiltered": "No events for the selected filters.",
|
||||
"noEventsDesc": "Changes made by users will appear here.",
|
||||
"colDate": "Date",
|
||||
"colUser": "User",
|
||||
"colAction": "Action",
|
||||
"colEntity": "Entity",
|
||||
"colDetails": "Details",
|
||||
"showMoreRemaining": "Show more ({{n}} remaining)",
|
||||
"entities": {
|
||||
"user": "User",
|
||||
"plan": "Plan",
|
||||
"session": "Session",
|
||||
"gym": "Gym",
|
||||
"coaching": "Coaching"
|
||||
},
|
||||
"details": {
|
||||
"email": "e-mail",
|
||||
"fields": "fields",
|
||||
"value": "value",
|
||||
"name": "name",
|
||||
"title": "title",
|
||||
"startDate": "start",
|
||||
"targetEmail": "invited",
|
||||
"traineeId": "trainee"
|
||||
},
|
||||
"actions": {
|
||||
"user": { "registered": "Registration" },
|
||||
"profile": { "updated": "Profile updated" },
|
||||
"weight": { "added": "Weight added", "removed": "Weight removed" },
|
||||
"circumference": { "added": "Circumference added", "removed": "Circumference removed" },
|
||||
"plan": {
|
||||
"created": "Plan created",
|
||||
"updated": "Plan updated",
|
||||
"deleted": "Plan deleted",
|
||||
"activated": "Plan activated",
|
||||
"abandoned": "Plan abandoned",
|
||||
"completed": "Plan completed",
|
||||
"reopened": "Plan reopened"
|
||||
},
|
||||
"session": {
|
||||
"started": "Session started",
|
||||
"completed": "Session finished",
|
||||
"abandoned": "Session abandoned",
|
||||
"reopened": "Session reopened"
|
||||
},
|
||||
"gym": {
|
||||
"created": "Gym created",
|
||||
"updated": "Gym updated",
|
||||
"deleted": "Gym deleted",
|
||||
"joined": "Joined gym"
|
||||
},
|
||||
"coaching": {
|
||||
"invited": "Invitation sent",
|
||||
"accepted": "Invitation accepted",
|
||||
"declined": "Invitation declined",
|
||||
"withdrawn": "Invitation withdrawn",
|
||||
"archived": "Relationship archived"
|
||||
}
|
||||
}
|
||||
}
|
||||
140
admin/src/i18n/locales/en/users.json
Normal file
140
admin/src/i18n/locales/en/users.json
Normal file
@@ -0,0 +1,140 @@
|
||||
{
|
||||
"newUser": "New user",
|
||||
"ageWord": "age: {{age}}",
|
||||
"statusSuspended": "Suspended",
|
||||
"statusBanned": "Banned",
|
||||
"adminBadge": "Admin",
|
||||
"gymsShort": "{{count}} gyms",
|
||||
"noUsersTitle": "No users",
|
||||
"noUsersDesc": "No users.",
|
||||
"noResultsDesc": "No results for the given query.",
|
||||
"userFallback": "User",
|
||||
"notFound": "User not found.",
|
||||
"suspend": "Suspend",
|
||||
"ban": "Ban",
|
||||
"deleteConfirmTitle": "Delete user?",
|
||||
"deleteConfirmDesc": "Their plans and sessions will be deleted. This operation cannot be undone.",
|
||||
"createdOn": "Created {{date}}",
|
||||
"until": " until {{dt}}",
|
||||
"statKillstreak": "Killstreak",
|
||||
"statVolume7d": "7-day volume",
|
||||
"statSessions": "Sessions",
|
||||
"ageValue": "{{age}} years",
|
||||
"personalInfo": "Personal details",
|
||||
"bodyParams": "Body parameters",
|
||||
"trainingHistory": "Training history",
|
||||
"progress": "Progress",
|
||||
"membershipsTitle": "Gym memberships",
|
||||
"claims": "Requests",
|
||||
"noData": "no data",
|
||||
"none": "none",
|
||||
"weightSummary": "{{value}} kg · {{date}}",
|
||||
"noMeasurements": "no measurements",
|
||||
"sessionsWordOne": "session",
|
||||
"sessionsWordFew": "sessions",
|
||||
"sessionsWordMany": "sessions",
|
||||
"lastSession": "last {{date}}",
|
||||
"noSessions": "no sessions",
|
||||
"pendingClaims": "{{count}} pending",
|
||||
"resolvedClaims": "{{count}} resolved",
|
||||
"exercisesWordOne": "exercise",
|
||||
"exercisesWordFew": "exercises",
|
||||
"exercisesWordMany": "exercises",
|
||||
"profileFallback": "Profile",
|
||||
"profileTitle": "Profile {{name}}",
|
||||
"affiliations": "Affiliations",
|
||||
"noMemberships": "No memberships.",
|
||||
"accessTitle": "Account access",
|
||||
"statusLabel": "Account status",
|
||||
"statusActive": "Active",
|
||||
"suspendedUntilLabel": "Suspended until",
|
||||
"reasonLabel": "Reason",
|
||||
"reasonAria": "Penalty reason",
|
||||
"reasonPhBanned": "e.g. account sharing",
|
||||
"optionalPh": "optional",
|
||||
"errUntilRequired": "Provide the date until which the account should be suspended.",
|
||||
"errUntilFuture": "The suspension date must be in the future.",
|
||||
"errReasonRequired": "Provide the reason for banning the account.",
|
||||
"saveError": "Save error",
|
||||
"claimStatusPending": "Pending",
|
||||
"claimStatusApproved": "Approved",
|
||||
"claimStatusRejected": "Rejected",
|
||||
"noClaimsTitle": "No requests",
|
||||
"noClaimsDesc": "The user has not submitted any gym requests yet.",
|
||||
"typeNew": "New gym",
|
||||
"typeVerification": "Verification",
|
||||
"submittedOn": "submitted {{date}}",
|
||||
"details": "Details",
|
||||
"reasonPrefix": "Reason: ",
|
||||
"noSessionsTitle": "No sessions",
|
||||
"noSessionsMonthTitle": "No sessions in the selected month",
|
||||
"noSessionsMonthDesc": "Choose another month or clear the filter to see the full history.",
|
||||
"noSessionsDesc": "The user has no training sessions yet.",
|
||||
"noProgressTitle": "No progress",
|
||||
"noProgressDesc": "Progress will appear after the user's first completed workout.",
|
||||
"progressWord": "Progress",
|
||||
"changeSinceFirst": "{{diff}} {{unit}} since first",
|
||||
"noChange": "no change",
|
||||
"secondMeasurementHint": "a second measurement will show the change",
|
||||
"firstToLast": "{{n}} · first → last",
|
||||
"measurementWordOne": "measurement",
|
||||
"measurementWordFew": "measurements",
|
||||
"measurementWordMany": "measurements",
|
||||
"chartNotEnough": "Not enough data for a chart (min. 2 measurements).",
|
||||
"bpNoMeasurements": "No measurements",
|
||||
"bpNoMeasurementsDesc": "Measurements will appear here when the user adds weight or circumference in the app.",
|
||||
"editUser": "Edit user",
|
||||
"emailRequired": "Provide an email address.",
|
||||
"passMin8": "Password must be at least 8 characters long.",
|
||||
"newPassMin8": "New password must be at least 8 characters long.",
|
||||
"passMismatch": "Passwords must match.",
|
||||
"fallbackThis": "this",
|
||||
"roleNoGym": "You cannot add someone to a gym without a role. Select a role for \"{{name}}\" or remove this row.",
|
||||
"rolesNeedGym": "Roles ({{labels}}) require a selected gym. Choose a gym or deselect the roles.",
|
||||
"stepData": "Details",
|
||||
"stepRoles": "Roles",
|
||||
"firstName": "First name",
|
||||
"lastName": "Last name",
|
||||
"newPasswordOpt": "New password (optional)",
|
||||
"passwordMin8": "Password (min. 8)",
|
||||
"repeatNewPassword": "Repeat new password",
|
||||
"repeatPassword": "Repeat password",
|
||||
"age": "Age",
|
||||
"adminPlatformTitle": "Platform administrator",
|
||||
"ariaShowAdmin": "Show admin permissions",
|
||||
"ariaHideAdmin": "Hide admin permissions",
|
||||
"noGymsYet": "No gyms yet",
|
||||
"noGymsYetDesc": "Add the first gym and select a role — memberships are granted and changed only here.",
|
||||
"addFirstGym": "Add the first gym",
|
||||
"addNextGym": "Add another gym",
|
||||
"removeGymAria": "Remove {{name}}",
|
||||
"removeGymRowAria": "Remove gym {{n}}",
|
||||
"gymLabel": "Gym",
|
||||
"gymFallback": "gym {{n}}",
|
||||
"cannotSave": "Cannot save",
|
||||
"understand": "Got it",
|
||||
"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 priorities and exclusions.",
|
||||
"chainNoFocus": "no focus in the plan",
|
||||
"chainNotInPlan": "not in the active plan",
|
||||
"accountCard": "Account",
|
||||
"fullAccess": "Full access",
|
||||
"accountNone": "None",
|
||||
"createdLabel": "Created",
|
||||
"basicData": "Basic details",
|
||||
"height": "Height",
|
||||
"phone": "Phone",
|
||||
"nick": "Nickname",
|
||||
"availabilityLabel": "Availability",
|
||||
"noAvailability": "No availability set",
|
||||
"prioritiesTitle": "Priorities and exclusions",
|
||||
"nothingAdded": "nothing added",
|
||||
"socialMediaTitle": "Social media",
|
||||
"noSocialProfiles": "No profiles added."
|
||||
}
|
||||
42
admin/src/i18n/locales/en/verifications.json
Normal file
42
admin/src/i18n/locales/en/verifications.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"statusPending": "Pending",
|
||||
"statusApproved": "Approved",
|
||||
"statusRejected": "Rejected",
|
||||
"typeVerification": "Verification",
|
||||
"typeNew": "New gym",
|
||||
"docsBadge": "{{n}} docs",
|
||||
"noClaimsTitle": "No requests",
|
||||
"noClaimsDesc": "No gym requests.",
|
||||
"notFound": "Request not found.",
|
||||
"claimData": "Request details",
|
||||
"gymLabel": "Gym",
|
||||
"kindVirtual": "Virtual",
|
||||
"kindReal": "Real",
|
||||
"privateBadge": "Private",
|
||||
"addressOverride": "Address (overrides location)",
|
||||
"gymNameLabel": "Gym name",
|
||||
"locationLabel": "Location",
|
||||
"availabilityLabel": "Availability",
|
||||
"capacityLabel": "Capacity",
|
||||
"descLabel": "Description",
|
||||
"companyNameLabel": "Company name",
|
||||
"nipLabel": "Tax ID",
|
||||
"phoneLabel": "Phone",
|
||||
"emailLabel": "Email",
|
||||
"applicantTitle": "Applicant",
|
||||
"fullNameLabel": "Full name",
|
||||
"documentsTitle": "Documents",
|
||||
"noDocuments": "No attached documents.",
|
||||
"download": "Download",
|
||||
"rejectReasonTitle": "Rejection reason",
|
||||
"decisionTitle": "Decision",
|
||||
"approve": "Approve",
|
||||
"rejecting": "Rejecting…",
|
||||
"reject": "Reject",
|
||||
"rejectReasonField": "Rejection reason (optional)",
|
||||
"reasonPh": "e.g. Missing proof of the gym's operating address",
|
||||
"approveConfirmTitle": "Approve the request?",
|
||||
"approveConfirmVerification": "The gym will become real (REAL) and public, and the applicant will receive the owner role.",
|
||||
"approveConfirmNew": "A new real gym will be created, and the applicant will receive the owner role.",
|
||||
"downloadError": "Download error"
|
||||
}
|
||||
25
admin/src/i18n/locales/pl/announcements.json
Normal file
25
admin/src/i18n/locales/pl/announcements.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"kindManual": "Ręczne",
|
||||
"kindHoursChange": "Zmiana godzin",
|
||||
"kindException": "Wyjątek",
|
||||
"platform": "Platforma",
|
||||
"newAnnouncement": "Nowe ogłoszenie",
|
||||
"noTitle": "Brak ogłoszeń",
|
||||
"noDesc": "Brak ogłoszeń. Dodaj pierwsze przyciskiem „Nowe ogłoszenie” w menu kontekstowym.",
|
||||
"noResultsDesc": "Brak wyników dla podanego zapytania.",
|
||||
"editAria": "Edytuj {{name}}",
|
||||
"removeAria": "Usuń {{name}}",
|
||||
"editTitle": "Edytuj ogłoszenie",
|
||||
"recipients": "Adresaci",
|
||||
"recipientsAll": "Wszyscy użytkownicy (platforma)",
|
||||
"recipientsGym": "Siłownia: {{name}}",
|
||||
"recipientsPrefix": "Adresaci: ",
|
||||
"recipientsAllLower": "wszyscy użytkownicy (platforma)",
|
||||
"titleLabel": "Tytuł",
|
||||
"titlePh": "np. Przerwa techniczna platformy",
|
||||
"bodyLabel": "Treść",
|
||||
"bodyPh": "Treść ogłoszenia…",
|
||||
"publish": "Opublikuj",
|
||||
"deleteTitle": "Usuń ogłoszenie",
|
||||
"deleteDesc": "Na pewno usunąć „{{title}}”?"
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
"password": "Hasło",
|
||||
"rememberMe": "Zapamiętaj mnie",
|
||||
"login": "Zaloguj",
|
||||
"loginError": "Błąd logowania",
|
||||
"notAdmin": "Dostęp tylko dla administratorów",
|
||||
"loginLoading": "Logowanie…",
|
||||
"claimTitle": "Cała platforma w jednym panelu.",
|
||||
"claimSubtitle": "Dla administratora platformy.",
|
||||
|
||||
97
admin/src/i18n/locales/pl/catalog.json
Normal file
97
admin/src/i18n/locales/pl/catalog.json
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"intro": "Katalog maszyn i urządzeń. Przypisuj je do rodzajów ćwiczeń i siłowni.",
|
||||
"newDevice": "Nowe urządzenie",
|
||||
"editDevice": "Edytuj urządzenie",
|
||||
"noDevicesTitle": "Brak urządzeń",
|
||||
"noDevicesDesc": "Brak urządzeń. Dodaj pierwsze przyciskiem „Nowe urządzenie” w menu kontekstowym.",
|
||||
"noResultsDesc": "Brak wyników dla podanego zapytania.",
|
||||
"editAria": "Edytuj {{name}}",
|
||||
"removeAria": "Usuń {{name}}",
|
||||
"nameLabel": "Nazwa",
|
||||
"namePh": "np. Sztanga",
|
||||
"nameLabelEn": "Nazwa (EN)",
|
||||
"kindLabel": "Rodzaj",
|
||||
"descLabel": "Opis (opcjonalnie)",
|
||||
"descPh": "np. Sztanga z talerzami.",
|
||||
"minKgLabel": "Obciążenie min (kg)",
|
||||
"minKgPh": "np. 2.5",
|
||||
"maxKgLabel": "Obciążenie max (kg)",
|
||||
"maxKgPh": "np. 25",
|
||||
"maxLoadKgLabel": "Maksymalne obciążenie (kg)",
|
||||
"maxLoadKgPh": "np. 100",
|
||||
"maxSpeedLabel": "Maks. prędkość (km/h, opcjonalnie)",
|
||||
"maxSpeedPh": "np. 16",
|
||||
"maxInclineLabel": "Maks. nachylenie (% opcjonalnie)",
|
||||
"maxInclinePh": "np. 15",
|
||||
"deleteTitle": "Usuń urządzenie",
|
||||
"countExercises": "{{n}} ćwiczeń",
|
||||
"countGyms": "{{n}} siłowni",
|
||||
"countPlans": "{{n}} planów",
|
||||
"deleteDescWithCounts": "Na pewno usunąć „{{name}}”? Zostanie odczepione od {{exercises}} ćwiczeń i {{gyms}} siłowni.",
|
||||
"deleteDescSimple": "Na pewno usunąć „{{name}}”? Zostanie odczepione od ćwiczeń i siłowni.",
|
||||
"introEx": "Rodzaje ćwiczeń i przypisane do nich maszyny/urządzenia.",
|
||||
"newExercise": "Nowe ćwiczenie",
|
||||
"editExercise": "Edytuj ćwiczenie",
|
||||
"noExercisesTitle": "Brak ćwiczeń",
|
||||
"noExercisesDesc": "Brak ćwiczeń. Dodaj pierwsze przyciskiem „Nowe ćwiczenie” w menu kontekstowym.",
|
||||
"namePhEx": "np. Wyciskanie sztangi leżąc",
|
||||
"primaryMuscle": "Główny mięsień",
|
||||
"secondaryMuscles": "Mięśnie pomocnicze",
|
||||
"noAreasHint": "Brak obszarów w katalogu. Dodaj je w sekcji „Obszary treningowe”.",
|
||||
"noEquipmentHint": "Brak urządzeń w katalogu. Dodaj je w sekcji „Urządzenia”.",
|
||||
"exerciseType": "Typ ćwiczenia",
|
||||
"savedValues": "Zapisywane wartości",
|
||||
"machines": "Maszyny / urządzenia",
|
||||
"noMachines": "brak maszyn",
|
||||
"descPhEx": "Krótki opis ćwiczenia widoczny w aplikacji.",
|
||||
"howToLabel": "Jak wykonać (opcjonalnie)",
|
||||
"howToPh": "Instrukcja wykonania.",
|
||||
"mistakesLabel": "Najczęstsze błędy (opcjonalnie)",
|
||||
"mistakesPh": "Czego unikać przy wykonaniu.",
|
||||
"chooseOption": "— wybierz —",
|
||||
"muscleNotInCatalog": "{{name}} (brak w katalogu obszarów)",
|
||||
"typeStrength": "Siłowe",
|
||||
"typeCardio": "Cardio",
|
||||
"typeCustom": "Własne",
|
||||
"sourceBuiltin": "wbudowane",
|
||||
"sourceGymCustom": "siłowni",
|
||||
"sourceTrainerCustom": "trenera",
|
||||
"flagHasReps": "Powtórzenia",
|
||||
"flagHasLoad": "Obciążenie",
|
||||
"flagHasRest": "Przerwa",
|
||||
"flagHasSets": "Serie",
|
||||
"flagHasRir": "RIR",
|
||||
"flagHasDifficulty": "Trudność",
|
||||
"flagHasCardio": "Cardio",
|
||||
"flagHasTime": "Czas",
|
||||
"flagHasSpeed": "Prędkość",
|
||||
"chipCardio": "cardio",
|
||||
"chipTime": "czas",
|
||||
"chipSpeed": "prędkość",
|
||||
"chipReps": "powt.",
|
||||
"chipLoad": "obciążenie",
|
||||
"chipRir": "RIR",
|
||||
"deleteExerciseTitle": "Usuń ćwiczenie",
|
||||
"deleteExerciseDesc": "Na pewno usunąć „{{name}}”? Nie można usunąć ćwiczenia używanego w planach.",
|
||||
"flagChangeTitle": "Zmieniasz typ ćwiczenia",
|
||||
"flagChangeDesc": "„{{name}}” jest używane w {{count}} planie/planach. Zmiana zapisywanych wartości (serie/obciążenie/czas...) wpłynie na trwające plany. Kontynuować?",
|
||||
"introAreas": "Katalog obszarów treningowych — z niego użytkownicy i trenerzy wybierają priorytety i wykluczenia.",
|
||||
"newArea": "Nowy obszar",
|
||||
"editArea": "Edytuj obszar",
|
||||
"noAreasTitle": "Brak obszarów",
|
||||
"noAreasDesc": "Brak obszarów. Dodaj pierwszy przyciskiem „Nowy obszar” w menu kontekstowym.",
|
||||
"setsPerWeek": "{{min}}–{{max}} serii/tydz.",
|
||||
"namePhArea": "np. Klatka piersiowa",
|
||||
"muscleKey": "Klucz mięśnia",
|
||||
"muscleKeyPh": "np. chest",
|
||||
"descPhArea": "np. Wyciskanie, rozpiętki, pompki",
|
||||
"setsMinLabel": "Zalecane serie min./tydz.",
|
||||
"setsMinPh": "np. 10",
|
||||
"setsMaxLabel": "Zalecane serie max./tydz.",
|
||||
"setsMaxPh": "np. 20",
|
||||
"setsOrderError": "Minimalna liczba serii musi być mniejsza lub równa maksymalnej.",
|
||||
"muscleChangeTitle": "Zmieniasz klucz mięśnia",
|
||||
"muscleChangeDesc": "Obszar „{{name}}” ma przypisane {{count}} ćwiczeń z dotychczasowym kluczem. Po zmianie przestaną one pasować do łańcucha priorytetów. Kontynuować?",
|
||||
"deleteAreaTitle": "Usuń obszar",
|
||||
"deleteAreaDesc": "Na pewno usunąć „{{name}}”? Użytkownicy nie będą mogli go wybierać."
|
||||
}
|
||||
@@ -1,10 +1,207 @@
|
||||
{
|
||||
"appName": "FitOS Admin",
|
||||
"errorPrefix": "Błąd: ",
|
||||
"error": "Błąd",
|
||||
"cancel": "Anuluj",
|
||||
"confirm": "Potwierdź",
|
||||
"save": "Zapisz",
|
||||
"saving": "Zapisywanie…",
|
||||
"edit": "Edytuj",
|
||||
"add": "Dodaj",
|
||||
"close": "Zamknij",
|
||||
"closeNotification": "Zamknij powiadomienie",
|
||||
"toggleTheme": "Przełącz motyw",
|
||||
"toggleLanguage": "Zmień język"
|
||||
"toggleLanguage": "Zmień język",
|
||||
"remove": "Usuń",
|
||||
"back": "Wstecz",
|
||||
"showMore": "Pokaż więcej",
|
||||
"ok": "OK",
|
||||
"yes": "tak",
|
||||
"no": "nie",
|
||||
"loading": "Ładowanie…",
|
||||
"searchShort": "Szukaj…",
|
||||
"all": "Wszystkie",
|
||||
"noData": "Brak danych",
|
||||
"nav": {
|
||||
"gyms": "Siłownie",
|
||||
"users": "Użytkownicy",
|
||||
"announcements": "Ogłoszenia",
|
||||
"exercises": "Rodzaje ćwiczeń",
|
||||
"equipment": "Urządzenia",
|
||||
"focusAreas": "Obszary treningowe",
|
||||
"logs": "Logi",
|
||||
"verifications": "Weryfikacje",
|
||||
"management": "Zarządzanie",
|
||||
"dictionaries": "Słowniki",
|
||||
"system": "System",
|
||||
"application": "Aplikacja",
|
||||
"logout": "Wyloguj",
|
||||
"mainNav": "Nawigacja główna",
|
||||
"expandMenu": "Rozwiń menu",
|
||||
"collapseMenu": "Zwiń menu",
|
||||
"roleAdmin": "Admin",
|
||||
"roleTrainer": "Trener",
|
||||
"roleMember": "Ćwiczący"
|
||||
},
|
||||
"topbar": {
|
||||
"openMenu": "Otwórz menu",
|
||||
"closeMenu": "Zamknij menu",
|
||||
"filters": "Filtry",
|
||||
"add": "Dodawanie",
|
||||
"actions": "Akcje",
|
||||
"search": "Wyszukiwarka",
|
||||
"searchGyms": "Szukaj siłowni",
|
||||
"searchUsers": "Szukaj użytkownika",
|
||||
"searchAnnouncements": "Szukaj ogłoszenia",
|
||||
"searchFocusAreas": "Szukaj obszaru",
|
||||
"searchExercises": "Szukaj ćwiczenia",
|
||||
"searchEquipment": "Szukaj urządzenia",
|
||||
"searchLogs": "Szukaj użytkownika",
|
||||
"prevMonth": "Poprzedni miesiąc",
|
||||
"nextMonth": "Następny miesiąc",
|
||||
"prevMonthWithData": "Poprzedni miesiąc z danymi",
|
||||
"nextMonthWithData": "Następny miesiąc z danymi"
|
||||
},
|
||||
"weekShort": ["Pon", "Wt", "Śr", "Czw", "Pt", "Sob", "Niedz"],
|
||||
"picker": {
|
||||
"userAria": "Szukaj użytkownika",
|
||||
"userList": "Lista użytkowników",
|
||||
"userEmpty": "Brak użytkowników",
|
||||
"userClear": "Wyczyść wybór użytkownika",
|
||||
"userNoResults": "Brak użytkowników dla „{{query}}”",
|
||||
"gymAria": "Szukaj siłowni",
|
||||
"gymPh": "Szukaj siłowni…",
|
||||
"gymClear": "Wyczyść wybór siłowni",
|
||||
"gymList": "Lista siłowni",
|
||||
"gymNoResults": "Brak siłowni o nazwie „{{query}}”",
|
||||
"gymEmpty": "Brak dostępnych siłowni"
|
||||
},
|
||||
"equipmentKind": {
|
||||
"DUMBBELL": "Hantle",
|
||||
"KETTLEBELL": "Kettlebell",
|
||||
"BARBELL": "Sztanga",
|
||||
"CABLE": "Wyciąg",
|
||||
"MACHINE": "Maszyna",
|
||||
"BENCH": "Ławka",
|
||||
"CARDIO": "Cardio",
|
||||
"BODYWEIGHT": "Masa ciała",
|
||||
"OTHER": "Inne"
|
||||
},
|
||||
"roles": {
|
||||
"member": {
|
||||
"label": "Ćwiczący",
|
||||
"summary": "Zwykły członek siłowni — trenuje i korzysta z planów.",
|
||||
"g0": "Tworzenie planów i prowadzenie treningów",
|
||||
"g1": "Dostęp do feedu i statystyk siłowni"
|
||||
},
|
||||
"trainer": {
|
||||
"label": "Trener",
|
||||
"summary": "Prowadzi podopiecznych i układa im plany treningowe.",
|
||||
"g0": "Zapraszanie podopiecznych i opieka nad nimi",
|
||||
"g1": "Tworzenie i edycja ich planów",
|
||||
"g2": "Wgląd w postępy podopiecznych"
|
||||
},
|
||||
"owner": {
|
||||
"label": "Właściciel",
|
||||
"summary": "Zarządza siłownią — to uprawnienie, nie samo członkostwo.",
|
||||
"g0": "Dane, godziny i adres siłowni",
|
||||
"g1": "Sprzęt, zdjęcia i grafik",
|
||||
"g2": "Zapraszanie ludzi i nadawanie im ról"
|
||||
},
|
||||
"admin": {
|
||||
"label": "Administrator",
|
||||
"summary": "Dostęp do całego panelu administratora FitOS.",
|
||||
"g0": "Zarządzanie wszystkimi użytkownikami i siłowniami",
|
||||
"g1": "Weryfikacja zgłoszeń siłowni",
|
||||
"g2": "Katalogi, komunikaty i logi systemowe"
|
||||
},
|
||||
"picker": {
|
||||
"hint": "Wybierz rolę, aby zobaczyć, co dokładnie daje. Ćwiczący = trenuje, Trener = prowadzi podopiecznych, Właściciel = zarządza siłownią."
|
||||
}
|
||||
},
|
||||
"avail": {
|
||||
"available": "dostępny",
|
||||
"from": "od",
|
||||
"to": "do"
|
||||
},
|
||||
"muscles": {
|
||||
"chest": "Klatka",
|
||||
"back": "Plecy",
|
||||
"legs": "Nogi",
|
||||
"shoulders": "Barki",
|
||||
"biceps": "Biceps",
|
||||
"triceps": "Triceps",
|
||||
"core": "Core",
|
||||
"glutes": "Pośladki",
|
||||
"forearms": "Przedramię",
|
||||
"calves": "Łydki"
|
||||
},
|
||||
"socialMedia": {
|
||||
"OTHER": "Inne"
|
||||
},
|
||||
"counters": {
|
||||
"daysCount_one": "{{count}} dzień",
|
||||
"daysCount_few": "{{count}} dni",
|
||||
"daysCount_many": "{{count}} dni",
|
||||
"daysCount_other": "{{count}} dni",
|
||||
"exercises_one": "{{count}} ćwiczenie",
|
||||
"exercises_few": "{{count}} ćwiczenia",
|
||||
"exercises_many": "{{count}} ćwiczeń",
|
||||
"exercises_other": "{{count}} ćwiczeń",
|
||||
"weeks_one": "{{count}} tydzień",
|
||||
"weeks_few": "{{count}} tygodnie",
|
||||
"weeks_many": "{{count}} tygodni",
|
||||
"weeks_other": "{{count}} tygodni",
|
||||
"setCount_one": "{{count}} seria",
|
||||
"setCount_few": "{{count}} serii",
|
||||
"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ń",
|
||||
"devices_other": "{{count}} urządzeń",
|
||||
"members_one": "{{count}} członek",
|
||||
"members_few": "{{count}} członków",
|
||||
"members_many": "{{count}} członków",
|
||||
"members_other": "{{count}} członków",
|
||||
"gyms_one": "{{count}} siłownia",
|
||||
"gyms_few": "{{count}} siłownie",
|
||||
"gyms_many": "{{count}} siłowni",
|
||||
"gyms_other": "{{count}} siłowni",
|
||||
"plans_one": "{{count}} plan",
|
||||
"plans_few": "{{count}} plany",
|
||||
"plans_many": "{{count}} planów",
|
||||
"plans_other": "{{count}} planów"
|
||||
},
|
||||
"fmt": {
|
||||
"justNow": "przed chwilą",
|
||||
"minAgo": "{{count}} min temu",
|
||||
"hourAgo": "{{count}} godz. temu",
|
||||
"yesterday": "wczoraj",
|
||||
"daysAgo": "{{count}} dni temu",
|
||||
"lt1m": "<1 min",
|
||||
"mins": "{{count}} min",
|
||||
"hoursMins": "{{h}} h {{m}} min",
|
||||
"hours": "{{h}} h",
|
||||
"remainingSets_one": "została {{count}} seria",
|
||||
"remainingSets_few": "zostały {{count}} serie",
|
||||
"remainingSets_many": "zostało {{count}} serii",
|
||||
"remainingSets_other": "zostało {{count}} serii"
|
||||
},
|
||||
"statuses": {
|
||||
"session": {
|
||||
"IN_PROGRESS": "W trakcie",
|
||||
"COMPLETED": "Ukończona",
|
||||
"ABANDONED": "Porzucona"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
144
admin/src/i18n/locales/pl/gyms.json
Normal file
144
admin/src/i18n/locales/pl/gyms.json
Normal file
@@ -0,0 +1,144 @@
|
||||
{
|
||||
"spec": {
|
||||
"upToKg": "do {{v}} kg",
|
||||
"fromKg": "od {{v}} kg",
|
||||
"upToKmh": "do {{v}} km/h",
|
||||
"inclineUpTo": "nachylenie do {{v}}%"
|
||||
},
|
||||
"equipment": {
|
||||
"specRangeError": "Podaj zakres obciążeń (min i max w kg).",
|
||||
"specMaxLoadError": "Podaj maksymalne obciążenie (kg).",
|
||||
"specCardioError": "Podaj parametry urządzenia (prędkość lub nachylenie)."
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"virtual": "Wirtualna",
|
||||
"private": "Prywatna",
|
||||
"open": "Otwórz →",
|
||||
"allGyms": "Wszystkie siłownie",
|
||||
"newGym": "Nowa siłownia",
|
||||
"noResults": "Brak wyników",
|
||||
"noResultsDesc": "Brak wyników dla podanego zapytania.",
|
||||
"noGymsTitle": "Brak siłowni",
|
||||
"noGymsDesc": "Brak siłowni. Dodaj pierwszą przyciskiem „Nowa siłownia” w menu kontekstowym.",
|
||||
"nameLabel": "Nazwa",
|
||||
"membersCapacity": "{{members}}/{{capacity}} członków",
|
||||
"owner": "Właściciel",
|
||||
"capacity": "Ilość miejsc",
|
||||
"availability": "Dostępność",
|
||||
"addressSection": "Adres",
|
||||
"searchOwner": "Szukaj właściciela",
|
||||
"noUsers": "Brak użytkowników",
|
||||
"loading": "Wczytywanie…",
|
||||
"ownerHint": "Wyznacz właściciela — otrzyma on rolę OWNER i dostęp do zarządzania siłownią.",
|
||||
"create": "Utwórz siłownię",
|
||||
"closed": "zamknięte",
|
||||
"today": "dziś",
|
||||
"noPhotos": "Brak zdjęć.",
|
||||
"photosMore_one": "+{{count}} zdjęcie",
|
||||
"photosMore_few": "+{{count}} zdjęcia",
|
||||
"photosMore_many": "+{{count}} zdjęć",
|
||||
"photosMore_other": "+{{count}} zdjęć",
|
||||
"noEquipment": "Brak urządzeń.",
|
||||
"addExceptionTitle": "Dodaj wyjątek — data i tryb dnia",
|
||||
"exceptionDateAria": "Data wyjątku",
|
||||
"closedBtn": "Zamknięte",
|
||||
"otherHours": "Inne godziny",
|
||||
"fromHourAria": "Od godziny",
|
||||
"toHourAria": "Do godziny",
|
||||
"adding": "Dodawanie…",
|
||||
"add": "Dodaj",
|
||||
"noExceptions": "Brak wyjątków.",
|
||||
"existingLocation": "Dotychczasowa lokalizacja: „{{location}}”. Podanie adresu nadpisze ją adresem strukturalnym.",
|
||||
"saved": "Zapisano zmiany.",
|
||||
"noOwnerTitle": "Brak właściciela",
|
||||
"noOwnerDesc": "Wyznacz osobę, która będzie zarządzać siłownią w aplikacji.",
|
||||
"revokeAria": "Odbierz rolę",
|
||||
"revokeTitle": "Odbierz rolę właściciela",
|
||||
"searchFutureOwner": "Szukaj przyszłego właściciela",
|
||||
"noOwnerCandidates": "Brak kandydatów — wszyscy użytkownicy są już właścicielami",
|
||||
"granting": "Nadawanie…",
|
||||
"grantOwner": "Nadaj właściciela",
|
||||
"ownerRoleHint": "Właściciel zarządza siłownią w aplikacji: urządzeniami, galerią i harmonogramem.",
|
||||
"groupEdit": "Edycja",
|
||||
"basicInfo": "Podstawowe informacje",
|
||||
"groupGallery": "Galeria",
|
||||
"groupEquipment": "Urządzenia",
|
||||
"groupOwners": "Właściciele",
|
||||
"groupAnnouncements": "Ogłoszenia",
|
||||
"announceOnBehalf": "Ogłoś w imieniu siłowni",
|
||||
"deleteGym": "Usuń siłownię",
|
||||
"deleteGymDesc": "Usunąć siłownię? Członkostwa zostaną usunięte, plany użytkowników zachowane.",
|
||||
"notFound": "Nie znaleziono siłowni.",
|
||||
"gallerySection": "Galeria zdjęć",
|
||||
"equipmentDesc": "Maszyny i urządzenia dostępne w tej siłowni.",
|
||||
"hours": "Godziny otwarcia",
|
||||
"exceptions": "Wyjątki",
|
||||
"data": "Dane",
|
||||
"kindLabel": "Rodzaj",
|
||||
"kindReal": "Realna",
|
||||
"kindVirtual": "Wirtualna",
|
||||
"privateLabel": "Prywatna",
|
||||
"capacityLabel": "Pojemność",
|
||||
"streetLabel": "Ulica",
|
||||
"cityCodeLabel": "Kod i miasto",
|
||||
"countryLabel": "Kraj",
|
||||
"locationLabel": "Lokalizacja",
|
||||
"ownersLabel": "Właściciele",
|
||||
"exceptionsTitle": "Wyjątki w harmonogramie",
|
||||
"exceptionsDesc": "Jednorazowe zmiany na konkretny dzień (zamknięcie lub inne godziny).",
|
||||
"manageGallery": "Zarządzaj galerią",
|
||||
"manageEquipment": "Zarządzaj urządzeniami",
|
||||
"manageOwners": "Zarządzaj właścicielami",
|
||||
"announcementsTitle": "Ogłoszenia w imieniu siłowni",
|
||||
"announcementSendTo": "Ogłoszenie trafi do wszystkich członków siłowni „{{name}}”.",
|
||||
"announcementTitleLabel": "Tytuł",
|
||||
"announcementTitlePh": "np. Awarida prądu — siłownia nieczynna",
|
||||
"announcementBodyLabel": "Treść",
|
||||
"announcementBodyPh": "Treść ogłoszenia…",
|
||||
"publishing": "Publikowanie…",
|
||||
"publish": "Opublikuj",
|
||||
"noAnnouncements": "Brak ogłoszeń tej siłowni.",
|
||||
"removeAria": "Usuń {{name}}",
|
||||
"positionsInStock": "Pozycje na stanie ({{count}})",
|
||||
"noStockDesc": "Brak urządzeń — dodaj pierwsze z katalogu poniżej.",
|
||||
"qtyAria": "Ilość: {{name}}",
|
||||
"addFromCatalog": "Dodaj urządzenie z katalogu",
|
||||
"addDeviceAria": "Dodaj urządzenie",
|
||||
"chooseDevice": "Wybierz urządzenie…",
|
||||
"inStockOption": "(na stanie: {{count}})",
|
||||
"qty": "Ilość",
|
||||
"parameters": "Parametry",
|
||||
"specRequired": "Podaj parametry urządzenia (prędkość lub nachylenie).",
|
||||
"minLoad": "Min. obciążenie (kg)",
|
||||
"maxLoad": "Max. obciążenie (kg)",
|
||||
"maxLoadFull": "Maksymalne obciążenie (kg)",
|
||||
"maxSpeed": "Maks. prędkość (km/h)",
|
||||
"maxIncline": "Maks. nachylenie (%)",
|
||||
"galleryDesc": "Zdjęcia tej siłowni. Pierwsza pozycja to okładka (widoczna na liście).",
|
||||
"photoAlt": "Zdjęcie {{n}}",
|
||||
"coverBadge": "Okładka",
|
||||
"coverLabel": "okładka",
|
||||
"setCover": "Ustaw jako okładkę",
|
||||
"removePhotoAria": "Usuń zdjęcie",
|
||||
"uploading": "Wgrywanie…",
|
||||
"addPhotos": "Dodaj zdjęcia",
|
||||
"photoTypesError": "Dozwolone pliki: JPEG, PNG, WEBP (max 5 MB).",
|
||||
"photoMaxFilesError": "Maksymalnie {{count}} plików naraz.",
|
||||
"confirmDeletePhoto": "Usunąć to zdjęcie?"
|
||||
}
|
||||
65
admin/src/i18n/locales/pl/logs.json
Normal file
65
admin/src/i18n/locales/pl/logs.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"filterAria": "Filtruj po akcji",
|
||||
"allActions": "Wszystkie akcje",
|
||||
"noEventsTitle": "Brak zdarzeń",
|
||||
"noResultsDesc": "Brak wyników dla podanego zapytania.",
|
||||
"noEventsFiltered": "Brak zdarzeń dla wybranych filtrów.",
|
||||
"noEventsDesc": "Zmiany wprowadzane przez użytkowników pojawią się tutaj.",
|
||||
"colDate": "Data",
|
||||
"colUser": "Użytkownik",
|
||||
"colAction": "Akcja",
|
||||
"colEntity": "Obiekt",
|
||||
"colDetails": "Szczegóły",
|
||||
"showMoreRemaining": "Pokaż więcej ({{n}} pozostało)",
|
||||
"entities": {
|
||||
"user": "Użytkownik",
|
||||
"plan": "Plan",
|
||||
"session": "Sesja",
|
||||
"gym": "Siłownia",
|
||||
"coaching": "Coaching"
|
||||
},
|
||||
"details": {
|
||||
"email": "e-mail",
|
||||
"fields": "pola",
|
||||
"value": "wartość",
|
||||
"name": "nazwa",
|
||||
"title": "tytuł",
|
||||
"startDate": "start",
|
||||
"targetEmail": "zaproszono",
|
||||
"traineeId": "podopieczny"
|
||||
},
|
||||
"actions": {
|
||||
"user": { "registered": "Rejestracja" },
|
||||
"profile": { "updated": "Zmiana profilu" },
|
||||
"weight": { "added": "Waga dodana", "removed": "Waga usunięta" },
|
||||
"circumference": { "added": "Obwód dodany", "removed": "Obwód usunięty" },
|
||||
"plan": {
|
||||
"created": "Plan utworzony",
|
||||
"updated": "Plan zaktualizowany",
|
||||
"deleted": "Plan usunięty",
|
||||
"activated": "Plan aktywowany",
|
||||
"abandoned": "Plan porzucony",
|
||||
"completed": "Plan ukończony",
|
||||
"reopened": "Plan wznowiony"
|
||||
},
|
||||
"session": {
|
||||
"started": "Sesja rozpoczęta",
|
||||
"completed": "Sesja zakończona",
|
||||
"abandoned": "Sesja porzucona",
|
||||
"reopened": "Sesja wznowiona"
|
||||
},
|
||||
"gym": {
|
||||
"created": "Siłownia utworzona",
|
||||
"updated": "Siłownia zaktualizowana",
|
||||
"deleted": "Siłownia usunięta",
|
||||
"joined": "Dołączono do siłowni"
|
||||
},
|
||||
"coaching": {
|
||||
"invited": "Zaproszenie wysłane",
|
||||
"accepted": "Zaproszenie przyjęte",
|
||||
"declined": "Zaproszenie odrzucone",
|
||||
"withdrawn": "Zaproszenie wycofane",
|
||||
"archived": "Relacja zarchiwizowana"
|
||||
}
|
||||
}
|
||||
}
|
||||
140
admin/src/i18n/locales/pl/users.json
Normal file
140
admin/src/i18n/locales/pl/users.json
Normal file
@@ -0,0 +1,140 @@
|
||||
{
|
||||
"newUser": "Nowy użytkownik",
|
||||
"ageWord": "wiek: {{age}}",
|
||||
"statusSuspended": "Zawieszone",
|
||||
"statusBanned": "Zablokowane",
|
||||
"adminBadge": "Admin",
|
||||
"gymsShort": "{{count}} sił.",
|
||||
"noUsersTitle": "Brak użytkowników",
|
||||
"noUsersDesc": "Brak użytkowników.",
|
||||
"noResultsDesc": "Brak wyników dla podanego zapytania.",
|
||||
"userFallback": "Użytkownik",
|
||||
"notFound": "Nie znaleziono użytkownika.",
|
||||
"suspend": "Zawieś",
|
||||
"ban": "Zbanuj",
|
||||
"deleteConfirmTitle": "Usunąć użytkownika?",
|
||||
"deleteConfirmDesc": "Jego plany i sesje zostaną usunięte. Tej operacji nie da się cofnąć.",
|
||||
"createdOn": "Utworzony {{date}}",
|
||||
"until": " do {{dt}}",
|
||||
"statKillstreak": "Killstreak",
|
||||
"statVolume7d": "Objętość 7 dni",
|
||||
"statSessions": "Sesje",
|
||||
"ageValue": "{{age}} lat",
|
||||
"personalInfo": "Dane osobowe",
|
||||
"bodyParams": "Parametry ciała",
|
||||
"trainingHistory": "Historia treningów",
|
||||
"progress": "Postępy",
|
||||
"membershipsTitle": "Członkostwa w siłowniach",
|
||||
"claims": "Wnioski",
|
||||
"noData": "brak danych",
|
||||
"none": "brak",
|
||||
"weightSummary": "{{value}} kg · {{date}}",
|
||||
"noMeasurements": "brak pomiarów",
|
||||
"sessionsWordOne": "sesja",
|
||||
"sessionsWordFew": "sesje",
|
||||
"sessionsWordMany": "sesji",
|
||||
"lastSession": "ostatnia {{date}}",
|
||||
"noSessions": "brak sesji",
|
||||
"pendingClaims": "{{count}} oczekujących",
|
||||
"resolvedClaims": "{{count}} rozstrzygniętych",
|
||||
"exercisesWordOne": "ćwiczenie",
|
||||
"exercisesWordFew": "ćwiczenia",
|
||||
"exercisesWordMany": "ćwiczeń",
|
||||
"profileFallback": "Profil",
|
||||
"profileTitle": "Profil {{name}}",
|
||||
"affiliations": "Przynależności",
|
||||
"noMemberships": "Brak członkostw.",
|
||||
"accessTitle": "Dostęp do konta",
|
||||
"statusLabel": "Status konta",
|
||||
"statusActive": "Aktywne",
|
||||
"suspendedUntilLabel": "Zawieszone do",
|
||||
"reasonLabel": "Powód",
|
||||
"reasonAria": "Powód kary",
|
||||
"reasonPhBanned": "np. udostępnianie konta",
|
||||
"optionalPh": "opcjonalnie",
|
||||
"errUntilRequired": "Podaj datę, do kiedy konto ma być zawieszone.",
|
||||
"errUntilFuture": "Data zawieszenia musi być w przyszłości.",
|
||||
"errReasonRequired": "Podaj powód blokady konta.",
|
||||
"saveError": "Błąd zapisu",
|
||||
"claimStatusPending": "Oczekuje",
|
||||
"claimStatusApproved": "Zatwierdzony",
|
||||
"claimStatusRejected": "Odrzucony",
|
||||
"noClaimsTitle": "Brak wniosków",
|
||||
"noClaimsDesc": "Użytkownik nie złożył jeszcze żadnych wniosków o siłownię.",
|
||||
"typeNew": "Nowa siłownia",
|
||||
"typeVerification": "Weryfikacja",
|
||||
"submittedOn": "złożono {{date}}",
|
||||
"details": "Szczegóły",
|
||||
"reasonPrefix": "Powód: ",
|
||||
"noSessionsTitle": "Brak sesji",
|
||||
"noSessionsMonthTitle": "Brak sesji w wybranym miesiącu",
|
||||
"noSessionsMonthDesc": "Wybierz inny miesiąc lub odznacz filtr, aby zobaczyć pełną historię.",
|
||||
"noSessionsDesc": "Użytkownik nie ma jeszcze żadnych sesji treningowych.",
|
||||
"noProgressTitle": "Brak postępów",
|
||||
"noProgressDesc": "Postępy pojawią się po pierwszym ukończonym treningu użytkownika.",
|
||||
"progressWord": "Postęp",
|
||||
"changeSinceFirst": "{{diff}} {{unit}} od pierwszego",
|
||||
"noChange": "bez zmian",
|
||||
"secondMeasurementHint": "drugi pomiar pokaże zmianę",
|
||||
"firstToLast": "{{n}} · pierwszy → ostatni",
|
||||
"measurementWordOne": "pomiar",
|
||||
"measurementWordFew": "pomiary",
|
||||
"measurementWordMany": "pomiarów",
|
||||
"chartNotEnough": "Za mało danych na wykres (min. 2 pomiary).",
|
||||
"bpNoMeasurements": "Brak pomiarów",
|
||||
"bpNoMeasurementsDesc": "Pomiary pojawią się tutaj, gdy użytkownik doda wagę lub obwód w aplikacji.",
|
||||
"editUser": "Edycja użytkownika",
|
||||
"emailRequired": "Podaj adres e-mail.",
|
||||
"passMin8": "Hasło musi mieć co najmniej 8 znaków.",
|
||||
"newPassMin8": "Nowe hasło musi mieć co najmniej 8 znaków.",
|
||||
"passMismatch": "Podane hasła muszą być takie same.",
|
||||
"fallbackThis": "tego",
|
||||
"roleNoGym": "Nie wolno dodać kogoś do siłowni bez roli. Zaznacz rolę dla „{{name}}” albo usuń ten wiersz.",
|
||||
"rolesNeedGym": "Role ({{labels}}) wymagają wybranej siłowni. Wybierz siłownię albo odznacz role.",
|
||||
"stepData": "Dane",
|
||||
"stepRoles": "Role",
|
||||
"firstName": "Imię",
|
||||
"lastName": "Nazwisko",
|
||||
"newPasswordOpt": "Nowe hasło (opcjonalnie)",
|
||||
"passwordMin8": "Hasło (min. 8)",
|
||||
"repeatNewPassword": "Powtórz nowe hasło",
|
||||
"repeatPassword": "Powtórz hasło",
|
||||
"age": "Wiek",
|
||||
"adminPlatformTitle": "Administrator platformy",
|
||||
"ariaShowAdmin": "Pokaż uprawnienia admina",
|
||||
"ariaHideAdmin": "Zwiń uprawnienia admina",
|
||||
"noGymsYet": "Jeszcze bez siłowni",
|
||||
"noGymsYetDesc": "Dodaj pierwszą siłownię i zaznacz rolę — członkostwa nadajesz i zmieniasz tylko tutaj.",
|
||||
"addFirstGym": "Dodaj pierwszą siłownię",
|
||||
"addNextGym": "Dodaj kolejną siłownię",
|
||||
"removeGymAria": "Usuń {{name}}",
|
||||
"removeGymRowAria": "Usuń siłownię {{n}}",
|
||||
"gymLabel": "Siłownia",
|
||||
"gymFallback": "siłownia {{n}}",
|
||||
"cannotSave": "Nie można zapisać",
|
||||
"understand": "Rozumiem",
|
||||
"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 priorytetów i wykluczeń.",
|
||||
"chainNoFocus": "brak akcentów w planie",
|
||||
"chainNotInPlan": "brak w aktywnym planie",
|
||||
"accountCard": "Konto",
|
||||
"fullAccess": "Pełny dostęp",
|
||||
"accountNone": "Brak",
|
||||
"createdLabel": "Utworzony",
|
||||
"basicData": "Podstawowe dane",
|
||||
"height": "Wzrost",
|
||||
"phone": "Telefon",
|
||||
"nick": "Nick",
|
||||
"availabilityLabel": "Dostępność",
|
||||
"noAvailability": "Brak ustawionej dostępności",
|
||||
"prioritiesTitle": "Priorytety i wykluczenia",
|
||||
"nothingAdded": "nic nie dodano",
|
||||
"socialMediaTitle": "Social media",
|
||||
"noSocialProfiles": "Brak dodanych profili."
|
||||
}
|
||||
42
admin/src/i18n/locales/pl/verifications.json
Normal file
42
admin/src/i18n/locales/pl/verifications.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"statusPending": "Oczekuje",
|
||||
"statusApproved": "Zatwierdzony",
|
||||
"statusRejected": "Odrzucony",
|
||||
"typeVerification": "Weryfikacja",
|
||||
"typeNew": "Nowa siłownia",
|
||||
"docsBadge": "{{n}} dok.",
|
||||
"noClaimsTitle": "Brak wniosków",
|
||||
"noClaimsDesc": "Brak wniosków o siłownie.",
|
||||
"notFound": "Nie znaleziono wniosku.",
|
||||
"claimData": "Dane wniosku",
|
||||
"gymLabel": "Siłownia",
|
||||
"kindVirtual": "Wirtualna",
|
||||
"kindReal": "Realna",
|
||||
"privateBadge": "Prywatna",
|
||||
"addressOverride": "Adres (nadpisuje lokalizację)",
|
||||
"gymNameLabel": "Nazwa siłowni",
|
||||
"locationLabel": "Lokalizacja",
|
||||
"availabilityLabel": "Dostępność",
|
||||
"capacityLabel": "Pojemność",
|
||||
"descLabel": "Opis",
|
||||
"companyNameLabel": "Nazwa firmy",
|
||||
"nipLabel": "NIP",
|
||||
"phoneLabel": "Telefon",
|
||||
"emailLabel": "E-mail",
|
||||
"applicantTitle": "Wnioskodawca",
|
||||
"fullNameLabel": "Imię i nazwisko",
|
||||
"documentsTitle": "Dokumenty",
|
||||
"noDocuments": "Brak załączonych dokumentów.",
|
||||
"download": "Pobierz",
|
||||
"rejectReasonTitle": "Powód odrzucenia",
|
||||
"decisionTitle": "Rozstrzygnięcie",
|
||||
"approve": "Zatwierdź",
|
||||
"rejecting": "Odrzucanie…",
|
||||
"reject": "Odrzuć",
|
||||
"rejectReasonField": "Powód odrzucenia (opcjonalny)",
|
||||
"reasonPh": "np. Brak potwierdzenia adresu prowadzenia siłowni",
|
||||
"approveConfirmTitle": "Zatwierdzić wniosek?",
|
||||
"approveConfirmVerification": "Siłownia stanie się realną (REAL) i publiczną, a wnioskodawca otrzyma rolę właściciela.",
|
||||
"approveConfirmNew": "Zostanie utworzona nowa realna siłownia, a wnioskodawca otrzyma rolę właściciela.",
|
||||
"downloadError": "Błąd pobierania"
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { Availability, DayAvailability } from '../api/types.js';
|
||||
import i18n from '../i18n';
|
||||
import { dayName } from './format';
|
||||
|
||||
export const DAY_NAMES = ['Pon', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob', 'Niedz'] as const;
|
||||
export const DAY_NAMES_FULL = [
|
||||
'Poniedziałek',
|
||||
'Wtorek',
|
||||
'Środa',
|
||||
'Czwartek',
|
||||
'Piątek',
|
||||
'Sobota',
|
||||
'Niedziela',
|
||||
] as const;
|
||||
export function dayShort(i: number): string {
|
||||
const list = i18n.t('weekShort', { returnObjects: true }) as string[];
|
||||
return list[i] ?? String(i);
|
||||
}
|
||||
|
||||
export function dayFull(i: number): string {
|
||||
return dayName(i + 1);
|
||||
}
|
||||
|
||||
/** 30-minute slots from 05:00 to 23:00. */
|
||||
export const TIME_SLOTS: string[] = (() => {
|
||||
@@ -52,7 +52,7 @@ export function formatAvailabilityParts(value: unknown): string[] {
|
||||
}
|
||||
let j = i + 1;
|
||||
while (j < 7 && arr[j] && arr[j]!.start === day.start && arr[j]!.end === day.end) j++;
|
||||
const days = j - i > 1 ? `${DAY_NAMES[i]}–${DAY_NAMES[j - 1]}` : DAY_NAMES[i];
|
||||
const days = j - i > 1 ? `${dayShort(i)}–${dayShort(j - 1)}` : dayShort(i);
|
||||
parts.push(`${days} ${day.start}–${day.end}`);
|
||||
i = j;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import type { Equipment, EquipmentKind, EquipmentSpec } from '../api/types';
|
||||
import i18n from '../i18n';
|
||||
import { localizedName } from './localizedName';
|
||||
|
||||
export const EQUIPMENT_KIND_LABELS: Record<EquipmentKind, string> = {
|
||||
DUMBBELL: 'Hantle',
|
||||
KETTLEBELL: 'Kettlebell',
|
||||
BARBELL: 'Sztanga',
|
||||
CABLE: 'Wyciąg',
|
||||
MACHINE: 'Maszyna',
|
||||
BENCH: 'Ławka',
|
||||
CARDIO: 'Cardio',
|
||||
BODYWEIGHT: 'Masa ciała',
|
||||
OTHER: 'Inne',
|
||||
};
|
||||
export const EQUIPMENT_KINDS: EquipmentKind[] = [
|
||||
'DUMBBELL',
|
||||
'KETTLEBELL',
|
||||
'BARBELL',
|
||||
'CABLE',
|
||||
'MACHINE',
|
||||
'BENCH',
|
||||
'CARDIO',
|
||||
'BODYWEIGHT',
|
||||
'OTHER',
|
||||
];
|
||||
|
||||
export function equipmentKindLabel(kind: EquipmentKind): string {
|
||||
return i18n.t(`equipmentKind.${kind}`);
|
||||
}
|
||||
|
||||
function fmtKg(value: number): string {
|
||||
return Number.isInteger(value) ? String(value) : value.toFixed(1).replace(/\.0$/, '');
|
||||
@@ -34,12 +39,14 @@ export function formatEquipmentSpec(spec: EquipmentSpec | null | undefined): str
|
||||
? `${fmtKg(spec.minKg)} kg`
|
||||
: `${fmtKg(spec.minKg)}–${fmtKg(spec.maxKg)} kg`,
|
||||
);
|
||||
} else if (spec.maxKg != null) parts.push(`do ${fmtKg(spec.maxKg)} kg`);
|
||||
else parts.push(`od ${fmtKg(spec.minKg!)} kg`);
|
||||
} else if (spec.maxKg != null) parts.push(i18n.t('gyms:spec.upToKg', { v: fmtKg(spec.maxKg) }));
|
||||
else parts.push(i18n.t('gyms:spec.fromKg', { v: fmtKg(spec.minKg!) }));
|
||||
}
|
||||
if (spec.maxLoadKg != null) parts.push(`do ${fmtKg(spec.maxLoadKg)} kg`);
|
||||
if (spec.maxSpeedKmh != null) parts.push(`do ${fmtKg(spec.maxSpeedKmh)} km/h`);
|
||||
if (spec.maxInclinePct != null) parts.push(`nachylenie do ${fmtKg(spec.maxInclinePct)}%`);
|
||||
if (spec.maxLoadKg != null) parts.push(i18n.t('gyms:spec.upToKg', { v: fmtKg(spec.maxLoadKg) }));
|
||||
if (spec.maxSpeedKmh != null)
|
||||
parts.push(i18n.t('gyms:spec.upToKmh', { v: fmtKg(spec.maxSpeedKmh) }));
|
||||
if (spec.maxInclinePct != null)
|
||||
parts.push(i18n.t('gyms:spec.inclineUpTo', { v: fmtKg(spec.maxInclinePct) }));
|
||||
return parts.length ? parts.join(', ') : null;
|
||||
}
|
||||
|
||||
@@ -90,12 +97,12 @@ export function specFromFields(
|
||||
if (LOAD_RANGE_KINDS.includes(kind)) {
|
||||
const minKg = parseNum(f.minKg);
|
||||
const maxKg = parseNum(f.maxKg);
|
||||
if (minKg == null || maxKg == null) return { error: 'Podaj zakres obciążeń (min i max w kg).' };
|
||||
if (minKg == null || maxKg == null) return { error: i18n.t('gyms:equipment.specRangeError') };
|
||||
return { spec: { minKg, maxKg } };
|
||||
}
|
||||
if (MAX_LOAD_KINDS.includes(kind)) {
|
||||
const maxLoadKg = parseNum(f.maxLoadKg);
|
||||
if (maxLoadKg == null) return { error: 'Podaj maksymalne obciążenie (kg).' };
|
||||
if (maxLoadKg == null) return { error: i18n.t('gyms:equipment.specMaxLoadError') };
|
||||
return { spec: { maxLoadKg } };
|
||||
}
|
||||
if (kind === 'CARDIO') {
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
import i18n from '../i18n';
|
||||
import { resolveLocaleTag } from '../i18n/language';
|
||||
|
||||
const t = (key: string, options?: Record<string, unknown>) => i18n.t(key, options);
|
||||
|
||||
function currentTag(): Intl.LocalesArgument {
|
||||
return resolveLocaleTag(i18n.language) as Intl.LocalesArgument;
|
||||
}
|
||||
|
||||
/** Nickname jako główna nazwa, z fallbackiem na imię + nazwisko. */
|
||||
export function displayName(
|
||||
u: { nickname?: string | null; firstName?: string | null; lastName?: string | null },
|
||||
@@ -8,7 +17,7 @@ export function displayName(
|
||||
|
||||
export function fmtDate(iso: string | null | undefined): string {
|
||||
if (!iso) return '—';
|
||||
return new Date(iso).toLocaleDateString('pl-PL', {
|
||||
return new Date(iso).toLocaleDateString(currentTag(), {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
@@ -17,7 +26,7 @@ export function fmtDate(iso: string | null | undefined): string {
|
||||
|
||||
export function fmtDateTime(iso: string | null | undefined): string {
|
||||
if (!iso) return '—';
|
||||
return new Date(iso).toLocaleString('pl-PL', {
|
||||
return new Date(iso).toLocaleString(currentTag(), {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
@@ -26,43 +35,40 @@ export function fmtDateTime(iso: string | null | undefined): string {
|
||||
});
|
||||
}
|
||||
|
||||
/** Czas względny po polsku: „przed chwilą”, „5 min temu”, „wczoraj”, potem data. */
|
||||
/** Czas względny: „przed chwilą”, „5 min temu”, „wczoraj”, potem data. */
|
||||
export function timeAgo(iso: string | null | undefined): string {
|
||||
if (!iso) return '—';
|
||||
const diffMin = Math.floor((Date.now() - new Date(iso).getTime()) / 60000);
|
||||
if (diffMin < 1) return 'przed chwilą';
|
||||
if (diffMin < 60) return `${diffMin} min temu`;
|
||||
if (diffMin < 1) return t('fmt.justNow');
|
||||
if (diffMin < 60) return t('fmt.minAgo', { count: diffMin });
|
||||
const h = Math.floor(diffMin / 60);
|
||||
if (h < 24) return `${h} godz. temu`;
|
||||
if (h < 24) return t('fmt.hourAgo', { count: h });
|
||||
const d = Math.floor(h / 24);
|
||||
if (d === 1) return 'wczoraj';
|
||||
if (d < 7) return `${d} dni temu`;
|
||||
if (d === 1) return t('fmt.yesterday');
|
||||
if (d < 7) return t('fmt.daysAgo', { count: d });
|
||||
return fmtDate(iso);
|
||||
}
|
||||
|
||||
/** Polska odmiana: „została 1 seria”, „zostały 2 serie”, „zostało 5 serii”. */
|
||||
/** Odmiana: „została 1 seria”, „zostały 2 serie”, „zostało 5 serii”. */
|
||||
export function setsPlural(n: number): string {
|
||||
if (n === 1) return 'została 1 seria';
|
||||
const last = n % 10;
|
||||
const lastTwo = n % 100;
|
||||
if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) return `zostały ${n} serie`;
|
||||
return `zostało ${n} serii`;
|
||||
return t('fmt.remainingSets', { count: n });
|
||||
}
|
||||
|
||||
/** Objętość w kg → „t” powyżej tysiąca (12 400 kg → „12,4 t”). */
|
||||
export function fmtVolume(kg: number): string {
|
||||
if (kg >= 1000) return `${(kg / 1000).toLocaleString('pl-PL', { maximumFractionDigits: 1 })} t`;
|
||||
return `${Math.round(kg).toLocaleString('pl-PL')} kg`;
|
||||
if (kg >= 1000)
|
||||
return `${(kg / 1000).toLocaleString(currentTag(), { maximumFractionDigits: 1 })} t`;
|
||||
return `${Math.round(kg).toLocaleString(currentTag())} kg`;
|
||||
}
|
||||
|
||||
/** Czas trwania sesji: „45 min”, „1 h 30 min”. */
|
||||
export function fmtDuration(startIso: string, endIso: string): string {
|
||||
const min = Math.round((new Date(endIso).getTime() - new Date(startIso).getTime()) / 60000);
|
||||
if (min < 1) return '<1 min';
|
||||
if (min < 60) return `${min} min`;
|
||||
if (min < 1) return t('fmt.lt1m');
|
||||
if (min < 60) return t('fmt.mins', { count: min });
|
||||
const h = Math.floor(min / 60);
|
||||
const m = min % 60;
|
||||
return m > 0 ? `${h} h ${m} min` : `${h} h`;
|
||||
return m > 0 ? t('fmt.hoursMins', { h, m }) : t('fmt.hours', { h });
|
||||
}
|
||||
|
||||
export function todayStr(): string {
|
||||
@@ -73,3 +79,28 @@ export function todayStr(): string {
|
||||
export function monthStr(d: Date): string {
|
||||
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function capitalize(s: string): string {
|
||||
return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
||||
}
|
||||
|
||||
/** Krótkie nazwy do siatki miesięcy w panelu selektora (Intl, bez kropki). */
|
||||
export function monthShort(i: number): string {
|
||||
const s = new Date(2024, i, 1).toLocaleDateString(currentTag(), { month: 'short' });
|
||||
return capitalize(s.replace(/\.$/, ''));
|
||||
}
|
||||
|
||||
/** `2026-08` → `Sierpień 2026` (Intl, wielka litera). */
|
||||
export function formatMonth(month: string): string {
|
||||
const [y, m] = month.split('-').map(Number);
|
||||
const name = capitalize(
|
||||
new Date(y, m - 1, 1).toLocaleDateString(currentTag(), { month: 'long' }),
|
||||
);
|
||||
return `${name} ${y}`;
|
||||
}
|
||||
|
||||
/** Pełna nazwa dnia tygodnia wg konwencji API (1 = poniedziałek … 7 = niedziela). */
|
||||
export function dayName(dow: number): string {
|
||||
const d = new Date(2024, 0, 1 + (dow - 1)); // 2024-01-01 = poniedziałek
|
||||
return capitalize(d.toLocaleDateString(currentTag(), { weekday: 'long' }));
|
||||
}
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
import i18n from '../i18n';
|
||||
import type { BadgeColor } from '../components/ui';
|
||||
import type { HistorySession, SocialMediaPlatform } from '../api/types';
|
||||
|
||||
export const MUSCLE_NAMES: Record<string, string> = {
|
||||
chest: 'Klatka',
|
||||
back: 'Plecy',
|
||||
legs: 'Nogi',
|
||||
shoulders: 'Barki',
|
||||
biceps: 'Biceps',
|
||||
triceps: 'Triceps',
|
||||
core: 'Core',
|
||||
glutes: 'Pośladki',
|
||||
forearms: 'Przedramię',
|
||||
calves: 'Łydki',
|
||||
};
|
||||
export function muscleName(muscle: string): string {
|
||||
const key = `muscles.${muscle}`;
|
||||
return i18n.exists(key) ? i18n.t(key) : muscle;
|
||||
}
|
||||
|
||||
export const MUSCLE_COLORS: Record<string, BadgeColor> = {
|
||||
chest: 'red',
|
||||
@@ -28,11 +21,11 @@ export const MUSCLE_COLORS: Record<string, BadgeColor> = {
|
||||
|
||||
export const SESSION_STATUS: Record<
|
||||
HistorySession['status'],
|
||||
{ label: string; color: BadgeColor }
|
||||
{ labelKey: string; color: BadgeColor }
|
||||
> = {
|
||||
IN_PROGRESS: { label: 'W trakcie', color: 'yellow' },
|
||||
COMPLETED: { label: 'Ukończona', color: 'green' },
|
||||
ABANDONED: { label: 'Porzucona', color: 'red' },
|
||||
IN_PROGRESS: { labelKey: 'statuses.session.IN_PROGRESS', color: 'yellow' },
|
||||
COMPLETED: { labelKey: 'statuses.session.COMPLETED', color: 'green' },
|
||||
ABANDONED: { labelKey: 'statuses.session.ABANDONED', color: 'red' },
|
||||
};
|
||||
|
||||
export const SOCIAL_MEDIA_LABELS: Record<SocialMediaPlatform, string> = {
|
||||
@@ -41,5 +34,5 @@ export const SOCIAL_MEDIA_LABELS: Record<SocialMediaPlatform, string> = {
|
||||
YOUTUBE: 'YouTube',
|
||||
FACEBOOK: 'Facebook',
|
||||
X: 'X',
|
||||
OTHER: 'Inne',
|
||||
OTHER: '', // label tłumaczony przy renderze (common:socialMedia.OTHER)
|
||||
};
|
||||
|
||||
@@ -2,12 +2,12 @@ import type { GymRole } from '../api/types';
|
||||
|
||||
/** Opis roli — używany wszędzie tam, gdzie admin przydziela rolę, żeby wybór był oczywisty. */
|
||||
export interface RoleMeta {
|
||||
/** Etykieta ról (pigułka / nagłówek). */
|
||||
label: string;
|
||||
/** Czym rola jest — jedno zdanie widoczne przy wyborze. */
|
||||
summary: string;
|
||||
/** Co dokładnie daje — konkrety do wyświetlenia w wyjaśnieniu. */
|
||||
grants: string[];
|
||||
/** Etykieta ról (pigułka / nagłówek) — klucz i18n. */
|
||||
labelKey: string;
|
||||
/** Czym rola jest — jedno zdanie widoczne przy wyborze — klucz i18n. */
|
||||
summaryKey: string;
|
||||
/** Co dokładnie daje — konkrety do wyświetlenia w wyjaśnieniu — klucze i18n. */
|
||||
grantKeys: string[];
|
||||
}
|
||||
|
||||
/** Kolejność ról siłowni w interfejsie: od najniższej do najważniejszej. */
|
||||
@@ -15,39 +15,27 @@ export const GYM_ROLE_ORDER: GymRole[] = ['MEMBER', 'TRAINER', 'OWNER'];
|
||||
|
||||
export const GYM_ROLE_META: Record<GymRole, RoleMeta> = {
|
||||
MEMBER: {
|
||||
label: 'Ćwiczący',
|
||||
summary: 'Zwykły członek siłowni — trenuje i korzysta z planów.',
|
||||
grants: ['Tworzenie planów i prowadzenie treningów', 'Dostęp do feedu i statystyk siłowni'],
|
||||
labelKey: 'roles.member.label',
|
||||
summaryKey: 'roles.member.summary',
|
||||
grantKeys: ['roles.member.g0', 'roles.member.g1'],
|
||||
},
|
||||
TRAINER: {
|
||||
label: 'Trener',
|
||||
summary: 'Prowadzi podopiecznych i układa im plany treningowe.',
|
||||
grants: [
|
||||
'Zapraszanie podopiecznych i opieka nad nimi',
|
||||
'Tworzenie i edycja ich planów',
|
||||
'Wgląd w postępy podopiecznych',
|
||||
],
|
||||
labelKey: 'roles.trainer.label',
|
||||
summaryKey: 'roles.trainer.summary',
|
||||
grantKeys: ['roles.trainer.g0', 'roles.trainer.g1', 'roles.trainer.g2'],
|
||||
},
|
||||
OWNER: {
|
||||
label: 'Właściciel',
|
||||
summary: 'Zarządza siłownią — to uprawnienie, nie samo członkostwo.',
|
||||
grants: [
|
||||
'Dane, godziny i adres siłowni',
|
||||
'Sprzęt, zdjęcia i grafik',
|
||||
'Zapraszanie ludzi i nadawanie im ról',
|
||||
],
|
||||
labelKey: 'roles.owner.label',
|
||||
summaryKey: 'roles.owner.summary',
|
||||
grantKeys: ['roles.owner.g0', 'roles.owner.g1', 'roles.owner.g2'],
|
||||
},
|
||||
};
|
||||
|
||||
/** Rola administratora platformy (poza systemem ról siłowni). */
|
||||
export const ADMIN_ROLE_META: RoleMeta = {
|
||||
label: 'Administrator',
|
||||
summary: 'Dostęp do całego panelu administratora FitOS.',
|
||||
grants: [
|
||||
'Zarządzanie wszystkimi użytkownikami i siłowniami',
|
||||
'Weryfikacja zgłoszeń siłowni',
|
||||
'Katalogi, komunikaty i logi systemowe',
|
||||
],
|
||||
labelKey: 'roles.admin.label',
|
||||
summaryKey: 'roles.admin.summary',
|
||||
grantKeys: ['roles.admin.g0', 'roles.admin.g1', 'roles.admin.g2'],
|
||||
};
|
||||
|
||||
/** Tona koloru pigułki aktywnej roli — spójna z `UserMemberships`. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Building2, Library, Users } from 'lucide-react';
|
||||
import { useAuth } from '../store/auth';
|
||||
import {
|
||||
@@ -16,6 +17,7 @@ import { Brandmark } from '../components/Brandmark';
|
||||
const REMEMBER_KEY = 'fitos-remembered-email';
|
||||
|
||||
export default function Login() {
|
||||
const { t } = useTranslation('auth');
|
||||
const { login } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const [email, setEmail] = useState(() => localStorage.getItem(REMEMBER_KEY) ?? '');
|
||||
@@ -34,7 +36,9 @@ export default function Login() {
|
||||
else localStorage.removeItem(REMEMBER_KEY);
|
||||
navigate('/');
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd logowania');
|
||||
setError(
|
||||
err instanceof Error ? err.message : t('loginError'),
|
||||
);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -67,32 +71,31 @@ export default function Login() {
|
||||
<div className="relative flex items-center gap-2.5">
|
||||
<Brandmark size={30} />
|
||||
<h1 className="font-display text-[1.25rem] font-bold tracking-[-0.02em]">
|
||||
FitOS Admin
|
||||
{t('common:appName')}
|
||||
</h1>
|
||||
</div>
|
||||
<div className="relative font-display text-[1.7rem] font-bold leading-[1.14] tracking-[-0.025em] md:text-[1.95rem]">
|
||||
Cała platforma
|
||||
<br />w jednym panelu.
|
||||
{t('claimTitle')}
|
||||
</div>
|
||||
<p className="relative m-0 max-w-[34ch] text-[0.875rem] leading-relaxed text-dim">
|
||||
Dla administratora platformy.
|
||||
{t('claimSubtitle')}
|
||||
</p>
|
||||
<ul aria-label="Zakres panelu" className="relative mt-auto flex flex-col gap-3 pt-4">
|
||||
<ul aria-label={t('scopeLabel')} className="relative mt-auto flex flex-col gap-3 pt-4">
|
||||
{[
|
||||
{
|
||||
icon: Users,
|
||||
title: 'Konta i dostęp',
|
||||
desc: 'Użytkownicy, role, członkostwa.',
|
||||
title: t('scopeAccountsTitle'),
|
||||
desc: t('scopeAccountsDesc'),
|
||||
},
|
||||
{
|
||||
icon: Building2,
|
||||
title: 'Siłownie',
|
||||
desc: 'Publiczne i prywatne, właściciele, trenerzy.',
|
||||
title: t('scopeGymsTitle'),
|
||||
desc: t('scopeGymsDesc'),
|
||||
},
|
||||
{
|
||||
icon: Library,
|
||||
title: 'Słowniki',
|
||||
desc: 'Ćwiczenia, urządzenia, obszary skupienia.',
|
||||
title: t('scopeCatalogTitle'),
|
||||
desc: t('scopeCatalogDesc'),
|
||||
},
|
||||
].map(({ icon: Icon, title, desc }) => (
|
||||
<li key={title} className="flex items-start gap-2.5">
|
||||
@@ -111,7 +114,7 @@ export default function Login() {
|
||||
</div>
|
||||
<Card className="m-0 flex flex-col justify-center rounded-none border-0 p-7 shadow-none md:p-8">
|
||||
<form onSubmit={submit}>
|
||||
<Field label="E-mail">
|
||||
<Field label={t('email')}>
|
||||
<Input
|
||||
type="email"
|
||||
value={email}
|
||||
@@ -120,7 +123,7 @@ export default function Login() {
|
||||
autoComplete="email"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Hasło">
|
||||
<Field label={t('password')}>
|
||||
<Input
|
||||
type="password"
|
||||
value={password}
|
||||
@@ -136,11 +139,11 @@ export default function Login() {
|
||||
onChange={(e) => setRemember(e.target.checked)}
|
||||
className="[--checkbox-size:1.25rem]"
|
||||
/>
|
||||
Zapamiętaj mnie
|
||||
{t('rememberMe')}
|
||||
</label>
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
<Button type="submit" disabled={loading} className="w-full">
|
||||
{loading ? 'Logowanie…' : 'Zaloguj'}
|
||||
{loading ? t('loginLoading') : t('login')}
|
||||
</Button>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { ScrollText } from 'lucide-react';
|
||||
import { useTopbar } from '../topbar';
|
||||
@@ -7,46 +8,43 @@ import { api } from '../api/client';
|
||||
import type { ActivityLog, ActivityLogPage } from '../api/types';
|
||||
import { Badge, EmptyState, ErrorText, Loading, Select, type BadgeColor } from '../components/ui';
|
||||
import { useListSearch } from '../store/list-search';
|
||||
import i18n from '../i18n';
|
||||
import { fmtDateTime } from '../lib/format';
|
||||
|
||||
export const ACTION_LABELS: Record<string, string> = {
|
||||
'user.registered': 'Rejestracja',
|
||||
'profile.updated': 'Zmiana profilu',
|
||||
'weight.added': 'Waga dodana',
|
||||
'weight.removed': 'Waga usunięta',
|
||||
'circumference.added': 'Obwód dodany',
|
||||
'circumference.removed': 'Obwód usunięty',
|
||||
'plan.created': 'Plan utworzony',
|
||||
'plan.updated': 'Plan zaktualizowany',
|
||||
'plan.deleted': 'Plan usunięty',
|
||||
'plan.activated': 'Plan aktywowany',
|
||||
'plan.abandoned': 'Plan porzucony',
|
||||
'plan.completed': 'Plan ukończony',
|
||||
'plan.reopened': 'Plan wznowiony',
|
||||
'session.started': 'Sesja rozpoczęta',
|
||||
'session.completed': 'Sesja zakończona',
|
||||
'session.abandoned': 'Sesja porzucona',
|
||||
'session.reopened': 'Sesja wznowiona',
|
||||
'gym.created': 'Siłownia utworzona',
|
||||
'gym.updated': 'Siłownia zaktualizowana',
|
||||
'gym.deleted': 'Siłownia usunięta',
|
||||
'gym.joined': 'Dołączono do siłowni',
|
||||
'coaching.invited': 'Zaproszenie wysłane',
|
||||
'coaching.accepted': 'Zaproszenie przyjęte',
|
||||
'coaching.declined': 'Zaproszenie odrzucone',
|
||||
'coaching.withdrawn': 'Zaproszenie wycofane',
|
||||
'coaching.archived': 'Relacja zarchiwizowana',
|
||||
};
|
||||
const t = (key: string, options?: Record<string, unknown>) =>
|
||||
i18n.t(`logs:${key}`, options as never);
|
||||
|
||||
const ENTITY_LABELS: Record<string, string> = {
|
||||
user: 'Użytkownik',
|
||||
plan: 'Plan',
|
||||
session: 'Sesja',
|
||||
gym: 'Siłownia',
|
||||
coaching: 'Coaching',
|
||||
};
|
||||
export const ACTION_KEYS = [
|
||||
'user.registered',
|
||||
'profile.updated',
|
||||
'weight.added',
|
||||
'weight.removed',
|
||||
'circumference.added',
|
||||
'circumference.removed',
|
||||
'plan.created',
|
||||
'plan.updated',
|
||||
'plan.deleted',
|
||||
'plan.activated',
|
||||
'plan.abandoned',
|
||||
'plan.completed',
|
||||
'plan.reopened',
|
||||
'session.started',
|
||||
'session.completed',
|
||||
'session.abandoned',
|
||||
'session.reopened',
|
||||
'gym.created',
|
||||
'gym.updated',
|
||||
'gym.deleted',
|
||||
'gym.joined',
|
||||
'coaching.invited',
|
||||
'coaching.accepted',
|
||||
'coaching.declined',
|
||||
'coaching.withdrawn',
|
||||
'coaching.archived',
|
||||
];
|
||||
|
||||
export function actionLabel(action: string) {
|
||||
return ACTION_LABELS[action] ?? action;
|
||||
return t(`actions.${action}`, { defaultValue: action });
|
||||
}
|
||||
|
||||
function actionColor(action: string): BadgeColor {
|
||||
@@ -57,10 +55,8 @@ function actionColor(action: string): BadgeColor {
|
||||
return 'yellow';
|
||||
}
|
||||
|
||||
const DATE_FORMAT = new Intl.DateTimeFormat('pl-PL', { dateStyle: 'medium', timeStyle: 'short' });
|
||||
|
||||
export function formatLogDate(iso: string) {
|
||||
return DATE_FORMAT.format(new Date(iso));
|
||||
return fmtDateTime(iso);
|
||||
}
|
||||
|
||||
function actorName(log: ActivityLog) {
|
||||
@@ -75,18 +71,6 @@ function entityName(log: ActivityLog) {
|
||||
return (d.title ?? d.name ?? d.gymName ?? null) as string | null;
|
||||
}
|
||||
|
||||
/** Polskie etykiety dla znanych kluczy szczegółów. */
|
||||
const DETAIL_LABELS: Record<string, string> = {
|
||||
email: 'e-mail',
|
||||
fields: 'pola',
|
||||
value: 'wartość',
|
||||
name: 'nazwa',
|
||||
title: 'tytuł',
|
||||
startDate: 'start',
|
||||
targetEmail: 'zaproszono',
|
||||
traineeId: 'podopieczny',
|
||||
};
|
||||
|
||||
/** Klucze pokazywane w innych kolumnach (aktor w „Użytkownik", nazwa w „Obiekt"). */
|
||||
const HIDDEN_DETAIL_KEYS = new Set(['actorId', 'title', 'name', 'gymName']);
|
||||
|
||||
@@ -116,13 +100,14 @@ function detailsText(log: ActivityLog) {
|
||||
if (!d) return null;
|
||||
const parts = Object.entries(d)
|
||||
.filter(([k]) => !HIDDEN_DETAIL_KEYS.has(k))
|
||||
.map(([k, v]) => `${DETAIL_LABELS[k] ?? k}: ${formatDetailValue(log, k, v)}`);
|
||||
.map(([k, v]) => `${t(`details.${k}`, { defaultValue: k })}: ${formatDetailValue(log, k, v)}`);
|
||||
return parts.length > 0 ? parts.join(' · ') : null;
|
||||
}
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
|
||||
export default function Logs() {
|
||||
const { t: tr } = useTranslation('logs');
|
||||
const [action, setAction] = useState('');
|
||||
const [month, setMonth] = useState('');
|
||||
const [limit, setLimit] = useState(PAGE_SIZE);
|
||||
@@ -155,7 +140,7 @@ export default function Logs() {
|
||||
}, [data?.logs]);
|
||||
|
||||
useTopbar({
|
||||
title: 'Logi',
|
||||
title: tr('common:nav.logs'),
|
||||
search: 'logs',
|
||||
dateFilter: (
|
||||
<MonthPickerCore
|
||||
@@ -173,17 +158,17 @@ export default function Logs() {
|
||||
<Select
|
||||
size="sm"
|
||||
className="h-9"
|
||||
aria-label="Filtruj po akcji"
|
||||
aria-label={tr('filterAria')}
|
||||
value={action}
|
||||
onChange={(e) => {
|
||||
setAction(e.target.value);
|
||||
setLimit(PAGE_SIZE);
|
||||
}}
|
||||
>
|
||||
<option value="">Wszystkie akcje</option>
|
||||
{Object.entries(ACTION_LABELS).map(([value, label]) => (
|
||||
<option value="">{tr('allActions')}</option>
|
||||
{ACTION_KEYS.map((value) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
{tr(`actions.${value}`)}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
@@ -209,18 +194,19 @@ export default function Logs() {
|
||||
return (
|
||||
<>
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{tr('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
{!isLoading && !error && filtered.length === 0 && (
|
||||
<EmptyState
|
||||
icon={ScrollText}
|
||||
title="Brak zdarzeń"
|
||||
title={tr('noEventsTitle')}
|
||||
description={
|
||||
query
|
||||
? 'Brak wyników dla podanego zapytania.'
|
||||
: hasFilters
|
||||
? 'Brak zdarzeń dla wybranych filtrów.'
|
||||
: 'Zmiany wprowadzane przez użytkowników pojawią się tutaj.'
|
||||
query ? tr('noResultsDesc') : hasFilters ? tr('noEventsFiltered') : tr('noEventsDesc')
|
||||
}
|
||||
/>
|
||||
)}
|
||||
@@ -231,19 +217,19 @@ export default function Logs() {
|
||||
<thead>
|
||||
<tr className="border-b border-line text-left text-dim">
|
||||
<th className="px-4 py-3 text-[10.5px] font-bold uppercase tracking-[0.11em]">
|
||||
Data
|
||||
{tr('colDate')}
|
||||
</th>
|
||||
<th className="px-4 py-3 text-[10.5px] font-bold uppercase tracking-[0.11em]">
|
||||
Użytkownik
|
||||
{tr('colUser')}
|
||||
</th>
|
||||
<th className="px-4 py-3 text-[10.5px] font-bold uppercase tracking-[0.11em]">
|
||||
Akcja
|
||||
{tr('colAction')}
|
||||
</th>
|
||||
<th className="px-4 py-3 text-[10.5px] font-bold uppercase tracking-[0.11em]">
|
||||
Obiekt
|
||||
{tr('colEntity')}
|
||||
</th>
|
||||
<th className="px-4 py-3 text-[10.5px] font-bold uppercase tracking-[0.11em]">
|
||||
Szczegóły
|
||||
{tr('colDetails')}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -267,7 +253,7 @@ export default function Logs() {
|
||||
<Badge color={actionColor(log.action)}>{actionLabel(log.action)}</Badge>
|
||||
</td>
|
||||
<td className="px-4 py-3">
|
||||
<div>{ENTITY_LABELS[log.entityType] ?? log.entityType}</div>
|
||||
<div>{tr(`entities.${log.entityType}`, { defaultValue: log.entityType })}</div>
|
||||
{entityName(log) && (
|
||||
<div className="text-[0.875rem] text-dim">{entityName(log)}</div>
|
||||
)}
|
||||
@@ -287,7 +273,7 @@ export default function Logs() {
|
||||
onClick={() => setLimit((l) => l + PAGE_SIZE)}
|
||||
className="text-[0.9rem] font-semibold text-accent-text hover:underline cursor-pointer"
|
||||
>
|
||||
Pokaż więcej ({total - logs.length} pozostało)
|
||||
{tr('showMoreRemaining', { n: total - logs.length })}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { Download, ShieldCheck } from 'lucide-react';
|
||||
import { api, apiBlob } from '../api/client';
|
||||
@@ -23,12 +24,17 @@ import {
|
||||
import type { BadgeColor } from '../components/ui';
|
||||
import { Avatar } from '../components/Avatar';
|
||||
import { formatAvailability } from '../lib/availability';
|
||||
import { fmtDate } from '../lib/format';
|
||||
import i18n from '../i18n';
|
||||
import { useTopbar } from '../topbar';
|
||||
|
||||
const STATUS_META: Record<ClaimStatus, { label: string; color: BadgeColor }> = {
|
||||
PENDING: { label: 'Oczekuje', color: 'yellow' },
|
||||
APPROVED: { label: 'Zatwierdzony', color: 'green' },
|
||||
REJECTED: { label: 'Odrzucony', color: 'red' },
|
||||
const t = (key: string, options?: Record<string, unknown>) =>
|
||||
i18n.t(`verifications:${key}`, options as never);
|
||||
|
||||
const STATUS_META: Record<ClaimStatus, { labelKey: string; color: BadgeColor }> = {
|
||||
PENDING: { labelKey: 'statusPending', color: 'yellow' },
|
||||
APPROVED: { labelKey: 'statusApproved', color: 'green' },
|
||||
REJECTED: { labelKey: 'statusRejected', color: 'red' },
|
||||
};
|
||||
|
||||
function claimTitle(claim: GymClaim) {
|
||||
@@ -36,7 +42,7 @@ function claimTitle(claim: GymClaim) {
|
||||
}
|
||||
|
||||
function claimTypeLabel(claim: GymClaim) {
|
||||
return claim.type === 'verification' ? 'Weryfikacja' : 'Nowa siłownia';
|
||||
return t(claim.type === 'verification' ? 'typeVerification' : 'typeNew');
|
||||
}
|
||||
|
||||
function applicantName(claim: GymClaim) {
|
||||
@@ -67,7 +73,8 @@ function InfoItem({ label, children }: { label: string; children: React.ReactNod
|
||||
}
|
||||
|
||||
export default function VerificationsList() {
|
||||
useTopbar({ title: 'Weryfikacje' });
|
||||
const { t: tr } = useTranslation('verifications');
|
||||
useTopbar({ title: tr('common:nav.verifications') });
|
||||
const navigate = useNavigate();
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['gyms-claims'],
|
||||
@@ -79,7 +86,12 @@ export default function VerificationsList() {
|
||||
return (
|
||||
<>
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{tr('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
<Card>
|
||||
<div className="divide-y divide-line">
|
||||
@@ -102,14 +114,18 @@ export default function VerificationsList() {
|
||||
</Link>
|
||||
</span>
|
||||
}
|
||||
meta={`${applicantName(c)} · ${new Date(c.createdAt).toLocaleDateString('pl-PL')}`}
|
||||
meta={`${applicantName(c)} · ${fmtDate(c.createdAt)}`}
|
||||
actions={
|
||||
<>
|
||||
<Badge color={c.type === 'verification' ? 'blue' : 'gray'}>
|
||||
{claimTypeLabel(c)}
|
||||
</Badge>
|
||||
{c.documentCount ? <Badge color="gray">{c.documentCount} dok.</Badge> : null}
|
||||
<Badge color={STATUS_META[c.status].color}>{STATUS_META[c.status].label}</Badge>
|
||||
{c.documentCount ? (
|
||||
<Badge color="gray">{tr('docsBadge', { n: c.documentCount })}</Badge>
|
||||
) : null}
|
||||
<Badge color={STATUS_META[c.status].color}>
|
||||
{tr(STATUS_META[c.status].labelKey)}
|
||||
</Badge>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
@@ -122,8 +138,8 @@ export default function VerificationsList() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={ShieldCheck}
|
||||
title="Brak wniosków"
|
||||
description="Brak wniosków o siłownie."
|
||||
title={tr('noClaimsTitle')}
|
||||
description={tr('noClaimsDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
@@ -132,7 +148,8 @@ export default function VerificationsList() {
|
||||
}
|
||||
|
||||
export function VerificationDetail() {
|
||||
useTopbar({ title: 'Weryfikacje', back: '/verifications' });
|
||||
const { t: tr } = useTranslation('verifications');
|
||||
useTopbar({ title: tr('common:nav.verifications'), back: '/verifications' });
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -164,7 +181,7 @@ export function VerificationDetail() {
|
||||
await invalidate();
|
||||
navigate('/verifications');
|
||||
} catch (e) {
|
||||
setActionError(e instanceof Error ? e.message : 'Błąd');
|
||||
setActionError(e instanceof Error ? e.message : tr('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -182,7 +199,7 @@ export function VerificationDetail() {
|
||||
await invalidate();
|
||||
navigate('/verifications');
|
||||
} catch (e) {
|
||||
setActionError(e instanceof Error ? e.message : 'Błąd');
|
||||
setActionError(e instanceof Error ? e.message : tr('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -193,17 +210,23 @@ export function VerificationDetail() {
|
||||
try {
|
||||
await downloadFile(`/admin/gyms/claims/${claim.id}/documents/${docId}`, name);
|
||||
} catch (e) {
|
||||
alert(e instanceof Error ? e.message : 'Błąd pobierania');
|
||||
alert(e instanceof Error ? e.message : tr('downloadError'));
|
||||
}
|
||||
};
|
||||
|
||||
if (isLoading) return <Loading />;
|
||||
if (error) return <ErrorText>Błąd: {(error as Error).message}</ErrorText>;
|
||||
if (error)
|
||||
return (
|
||||
<ErrorText>
|
||||
{tr('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
);
|
||||
if (!claim) {
|
||||
return (
|
||||
<>
|
||||
<BackButton to="/verifications" className="mb-4" />
|
||||
<ErrorText>Nie znaleziono wniosku.</ErrorText>
|
||||
<ErrorText>{tr('notFound')}</ErrorText>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -219,66 +242,70 @@ export function VerificationDetail() {
|
||||
<Badge color={claim.type === 'verification' ? 'blue' : 'gray'}>
|
||||
{claimTypeLabel(claim)}
|
||||
</Badge>
|
||||
<Badge color={STATUS_META[claim.status].color}>{STATUS_META[claim.status].label}</Badge>
|
||||
<Badge color={STATUS_META[claim.status].color}>
|
||||
{tr(STATUS_META[claim.status].labelKey)}
|
||||
</Badge>
|
||||
</>
|
||||
}
|
||||
actions={<BackButton to="/verifications" />}
|
||||
/>
|
||||
|
||||
<Card>
|
||||
<SectionHeader title="Dane wniosku" />
|
||||
<SectionHeader title={tr('claimData')} />
|
||||
<div className="grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-2">
|
||||
{claim.type === 'verification' ? (
|
||||
<>
|
||||
<InfoItem label="Siłownia">
|
||||
<InfoItem label={tr('gymLabel')}>
|
||||
{claim.gym?.name ?? '—'}
|
||||
{claim.gym && (
|
||||
<span className="ml-2 inline-flex gap-1.5">
|
||||
<Badge color={claim.gym.kind === 'VIRTUAL' ? 'blue' : 'gray'}>
|
||||
{claim.gym.kind === 'VIRTUAL' ? 'Wirtualna' : 'Realna'}
|
||||
{claim.gym.kind === 'VIRTUAL' ? tr('kindVirtual') : tr('kindReal')}
|
||||
</Badge>
|
||||
{claim.gym.isPrivate && <Badge color="gray">Prywatna</Badge>}
|
||||
{claim.gym.isPrivate && <Badge color="gray">{tr('privateBadge')}</Badge>}
|
||||
</span>
|
||||
)}
|
||||
</InfoItem>
|
||||
<InfoItem label="Adres (nadpisuje lokalizację)">{claim.address || '—'}</InfoItem>
|
||||
<InfoItem label={tr('addressOverride')}>{claim.address || '—'}</InfoItem>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<InfoItem label="Nazwa siłowni">{claim.gymName || '—'}</InfoItem>
|
||||
<InfoItem label="Lokalizacja">{claim.gymLocation || '—'}</InfoItem>
|
||||
<InfoItem label="Dostępność">
|
||||
<InfoItem label={tr('gymNameLabel')}>{claim.gymName || '—'}</InfoItem>
|
||||
<InfoItem label={tr('locationLabel')}>{claim.gymLocation || '—'}</InfoItem>
|
||||
<InfoItem label={tr('availabilityLabel')}>
|
||||
{formatAvailability(claim.gymAvailability) || '—'}
|
||||
</InfoItem>
|
||||
<InfoItem label="Pojemność">{claim.gymCapacity ?? '—'}</InfoItem>
|
||||
<InfoItem label={tr('capacityLabel')}>{claim.gymCapacity ?? '—'}</InfoItem>
|
||||
</>
|
||||
)}
|
||||
<InfoItem label="Opis">{claim.description || '—'}</InfoItem>
|
||||
<InfoItem label="Nazwa firmy">{claim.companyName || '—'}</InfoItem>
|
||||
<InfoItem label="NIP">{claim.nip || '—'}</InfoItem>
|
||||
<InfoItem label="Telefon">{claim.phone || '—'}</InfoItem>
|
||||
<InfoItem label="E-mail">{claim.email || '—'}</InfoItem>
|
||||
<InfoItem label={tr('descLabel')}>{claim.description || '—'}</InfoItem>
|
||||
<InfoItem label={tr('companyNameLabel')}>{claim.companyName || '—'}</InfoItem>
|
||||
<InfoItem label={tr('nipLabel')}>{claim.nip || '—'}</InfoItem>
|
||||
<InfoItem label={tr('phoneLabel')}>{claim.phone || '—'}</InfoItem>
|
||||
<InfoItem label={tr('emailLabel')}>{claim.email || '—'}</InfoItem>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<SectionHeader title="Wnioskodawca" />
|
||||
<SectionHeader title={tr('applicantTitle')} />
|
||||
<div className="grid grid-cols-1 gap-x-4 gap-y-3 sm:grid-cols-2">
|
||||
<InfoItem label="Imię i nazwisko">
|
||||
<InfoItem label={tr('fullNameLabel')}>
|
||||
<span className="flex items-center gap-2.5">
|
||||
<Avatar name={applicantName(claim)} size={28} />
|
||||
{applicantName(claim)}
|
||||
</span>
|
||||
</InfoItem>
|
||||
<InfoItem label="E-mail">{claim.user.email}</InfoItem>
|
||||
{claim.user.phone != null && <InfoItem label="Telefon">{claim.user.phone}</InfoItem>}
|
||||
<InfoItem label={tr('emailLabel')}>{claim.user.email}</InfoItem>
|
||||
{claim.user.phone != null && (
|
||||
<InfoItem label={tr('phoneLabel')}>{claim.user.phone}</InfoItem>
|
||||
)}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<SectionHeader title="Dokumenty" />
|
||||
<SectionHeader title={tr('documentsTitle')} />
|
||||
{claim.documents.length === 0 ? (
|
||||
<Muted className="text-[0.875rem]">Brak załączonych dokumentów.</Muted>
|
||||
<Muted className="text-[0.875rem]">{tr('noDocuments')}</Muted>
|
||||
) : (
|
||||
<div className="divide-y divide-line">
|
||||
{claim.documents.map((d) => (
|
||||
@@ -292,7 +319,7 @@ export function VerificationDetail() {
|
||||
onClick={() => void download(d.id, d.originalName)}
|
||||
>
|
||||
<Download className="h-4 w-4" />
|
||||
Pobierz
|
||||
{tr('download')}
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
@@ -303,29 +330,29 @@ export function VerificationDetail() {
|
||||
|
||||
{claim.status === 'REJECTED' && claim.rejectReason && (
|
||||
<Card>
|
||||
<SectionHeader title="Powód odrzucenia" />
|
||||
<SectionHeader title={tr('rejectReasonTitle')} />
|
||||
<p className="text-[0.95rem]">{claim.rejectReason}</p>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{isPending && (
|
||||
<Card>
|
||||
<SectionHeader title="Rozstrzygnięcie" />
|
||||
<SectionHeader title={tr('decisionTitle')} />
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<Button onClick={() => setConfirmOpen(true)} disabled={busy}>
|
||||
<ShieldCheck className="h-4 w-4" />
|
||||
Zatwierdź
|
||||
{tr('approve')}
|
||||
</Button>
|
||||
<Button variant="danger" onClick={reject} disabled={busy}>
|
||||
{busy ? 'Odrzucanie…' : 'Odrzuć'}
|
||||
{busy ? tr('rejecting') : tr('reject')}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<Field label="Powód odrzucenia (opcjonalny)">
|
||||
<Field label={tr('rejectReasonField')}>
|
||||
<Textarea
|
||||
value={reason}
|
||||
onChange={(e) => setReason(e.target.value)}
|
||||
placeholder="np. Brak potwierdzenia adresu prowadzenia siłowni"
|
||||
placeholder={tr('reasonPh')}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
@@ -337,13 +364,11 @@ export function VerificationDetail() {
|
||||
open={confirmOpen}
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
onConfirm={() => void approve()}
|
||||
title="Zatwierdzić wniosek?"
|
||||
title={tr('approveConfirmTitle')}
|
||||
description={
|
||||
claim.type === 'verification'
|
||||
? 'Siłownia stanie się realną (REAL) i publiczną, a wnioskodawca otrzyma rolę właściciela.'
|
||||
: 'Zostanie utworzona nowa realna siłownia, a wnioskodawca otrzyma rolę właściciela.'
|
||||
claim.type === 'verification' ? tr('approveConfirmVerification') : tr('approveConfirmNew')
|
||||
}
|
||||
confirmLabel="Zatwierdź"
|
||||
confirmLabel={tr('approve')}
|
||||
busy={busy}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { Megaphone, Pencil, Plus, Trash2 } from 'lucide-react';
|
||||
import { api } from '../../api/client';
|
||||
@@ -22,13 +23,13 @@ import {
|
||||
Textarea,
|
||||
} from '../../components/ui';
|
||||
|
||||
const KIND_LABELS: Record<
|
||||
const KIND_META: Record<
|
||||
AdminAnnouncement['kind'],
|
||||
{ label: string; color: 'blue' | 'yellow' | 'gray' }
|
||||
{ labelKey: string; color: 'blue' | 'yellow' | 'gray' }
|
||||
> = {
|
||||
MANUAL: { label: 'Ręczne', color: 'blue' },
|
||||
HOURS_CHANGE: { label: 'Zmiana godzin', color: 'yellow' },
|
||||
EXCEPTION: { label: 'Wyjątek', color: 'yellow' },
|
||||
MANUAL: { labelKey: 'kindManual', color: 'blue' },
|
||||
HOURS_CHANGE: { labelKey: 'kindHoursChange', color: 'yellow' },
|
||||
EXCEPTION: { labelKey: 'kindException', color: 'yellow' },
|
||||
};
|
||||
|
||||
interface FormState {
|
||||
@@ -41,6 +42,7 @@ interface FormState {
|
||||
const EMPTY: FormState = { title: '', body: '', gymId: '' };
|
||||
|
||||
export default function Announcements() {
|
||||
const { t } = useTranslation('announcements');
|
||||
const qc = useQueryClient();
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['admin-announcements'],
|
||||
@@ -57,7 +59,7 @@ export default function Announcements() {
|
||||
|
||||
const filtered = query
|
||||
? announcements.filter((a) =>
|
||||
[a.title, a.body, a.gymName ?? 'Platforma'].some((s) =>
|
||||
[a.title, a.body, a.gymName ?? t('platform')].some((s) =>
|
||||
s.toLowerCase().includes(query.toLowerCase()),
|
||||
),
|
||||
)
|
||||
@@ -119,15 +121,20 @@ export default function Announcements() {
|
||||
}
|
||||
|
||||
useTopbar({
|
||||
title: 'Ogłoszenia',
|
||||
title: t('common:nav.announcements'),
|
||||
search: 'announcements',
|
||||
actions: [{ label: 'Nowe ogłoszenie', onClick: openCreate, icon: Plus }],
|
||||
actions: [{ label: t('newAnnouncement'), onClick: openCreate, icon: Plus }],
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
<div className="flex flex-col gap-3">
|
||||
{filtered.map((a) => (
|
||||
@@ -136,8 +143,8 @@ export default function Announcements() {
|
||||
<div className="min-w-0">
|
||||
<div className="text-[1.05rem] font-semibold">{a.title}</div>
|
||||
<div className="mt-1 flex flex-wrap items-center gap-1.5">
|
||||
<Badge color={a.gymId ? 'gray' : 'green'}>{a.gymName ?? 'Platforma'}</Badge>
|
||||
<Badge color={KIND_LABELS[a.kind].color}>{KIND_LABELS[a.kind].label}</Badge>
|
||||
<Badge color={a.gymId ? 'gray' : 'green'}>{a.gymName ?? t('platform')}</Badge>
|
||||
<Badge color={KIND_META[a.kind].color}>{t(KIND_META[a.kind].labelKey)}</Badge>
|
||||
<span className="text-[0.75rem] tabular-nums text-dim">
|
||||
{fmtDateTime(a.createdAt)}
|
||||
</span>
|
||||
@@ -150,7 +157,7 @@ export default function Announcements() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => openEdit(a)}
|
||||
aria-label={`Edytuj ${a.title}`}
|
||||
aria-label={t('editAria', { name: a.title })}
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -159,7 +166,7 @@ export default function Announcements() {
|
||||
size="sm"
|
||||
className="text-danger hover:text-danger"
|
||||
onClick={() => setDeleting(a)}
|
||||
aria-label={`Usuń ${a.title}`}
|
||||
aria-label={t('removeAria', { name: a.title })}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -174,12 +181,8 @@ export default function Announcements() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={Megaphone}
|
||||
title="Brak ogłoszeń"
|
||||
description={
|
||||
query
|
||||
? 'Brak wyników dla podanego zapytania.'
|
||||
: 'Brak ogłoszeń. Dodaj pierwsze przyciskiem „Nowe ogłoszenie” w menu kontekstowym.'
|
||||
}
|
||||
title={t('noTitle')}
|
||||
description={query ? t('noResultsDesc') : t('noDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
@@ -187,19 +190,19 @@ export default function Announcements() {
|
||||
<Modal
|
||||
open={formOpen}
|
||||
onClose={() => setFormOpen(false)}
|
||||
title={editing ? 'Edytuj ogłoszenie' : 'Nowe ogłoszenie'}
|
||||
title={editing ? t('editTitle') : t('newAnnouncement')}
|
||||
>
|
||||
<div className="flex flex-col gap-3.5">
|
||||
{!editing && (
|
||||
<Field label="Adresaci">
|
||||
<Field label={t('recipients')}>
|
||||
<Select
|
||||
value={form.gymId}
|
||||
onChange={(e) => setForm((f) => ({ ...f, gymId: e.target.value }))}
|
||||
>
|
||||
<option value="">Wszyscy użytkownicy (platforma)</option>
|
||||
<option value="">{t('recipientsAll')}</option>
|
||||
{gyms.map((g) => (
|
||||
<option key={g.id} value={g.id}>
|
||||
Siłownia: {g.name}
|
||||
{t('recipientsGym', { name: g.name })}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
@@ -207,36 +210,37 @@ export default function Announcements() {
|
||||
)}
|
||||
{editing && (
|
||||
<Muted className="block">
|
||||
Adresaci: {editing.gymName ?? 'wszyscy użytkownicy (platforma)'}
|
||||
{t('recipientsPrefix')}
|
||||
{editing.gymName ?? t('recipientsAllLower')}
|
||||
</Muted>
|
||||
)}
|
||||
<Field label="Tytuł">
|
||||
<Field label={t('titleLabel')}>
|
||||
<Input
|
||||
value={form.title}
|
||||
onChange={(e) => setForm((f) => ({ ...f, title: e.target.value }))}
|
||||
maxLength={120}
|
||||
placeholder="np. Przerwa techniczna platformy"
|
||||
placeholder={t('titlePh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Treść">
|
||||
<Field label={t('bodyLabel')}>
|
||||
<Textarea
|
||||
value={form.body}
|
||||
onChange={(e) => setForm((f) => ({ ...f, body: e.target.value }))}
|
||||
maxLength={2000}
|
||||
rows={4}
|
||||
placeholder="Treść ogłoszenia…"
|
||||
placeholder={t('bodyPh')}
|
||||
/>
|
||||
</Field>
|
||||
{formError && <ErrorText>{formError}</ErrorText>}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="secondary" onClick={() => setFormOpen(false)}>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => save.mutate()}
|
||||
disabled={save.isPending || !form.title.trim() || !form.body.trim()}
|
||||
>
|
||||
{editing ? 'Zapisz' : 'Opublikuj'}
|
||||
{editing ? t('common:save') : t('publish')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,9 +250,9 @@ export default function Announcements() {
|
||||
open={deleting != null}
|
||||
onClose={() => setDeleting(null)}
|
||||
onConfirm={() => deleting && remove.mutate(deleting.id)}
|
||||
title="Usuń ogłoszenie"
|
||||
description={`Na pewno usunąć „${deleting?.title}”?`}
|
||||
confirmLabel="Usuń"
|
||||
title={t('deleteTitle')}
|
||||
description={t('deleteDesc', { title: deleting?.title })}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={remove.isPending}
|
||||
/>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { Pencil, Plus, Trash2, Wrench } from 'lucide-react';
|
||||
import { api } from '../../api/client';
|
||||
import type { Equipment, EquipmentKind } from '../../api/types';
|
||||
import { EQUIPMENT_KIND_LABELS, formatEquipmentSpec } from '../../lib/equipment';
|
||||
import { equipmentKindLabel, EQUIPMENT_KINDS, formatEquipmentSpec } from '../../lib/equipment';
|
||||
import { localizedName } from '../../lib/localizedName';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { useListSearch } from '../../store/list-search';
|
||||
@@ -75,7 +75,7 @@ function parseNum(value: string): number | undefined {
|
||||
|
||||
export default function EquipmentCatalog() {
|
||||
const qc = useQueryClient();
|
||||
const { i18n } = useTranslation();
|
||||
const { t, i18n } = useTranslation('catalog');
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['equipment'],
|
||||
queryFn: () => api<{ equipment: Equipment[] }>('/admin/equipment'),
|
||||
@@ -86,7 +86,7 @@ export default function EquipmentCatalog() {
|
||||
|
||||
const filtered = query
|
||||
? items.filter((e) =>
|
||||
[e.name, e.nameEn, e.description, EQUIPMENT_KIND_LABELS[e.kind]]
|
||||
[e.name, e.nameEn, e.description, equipmentKindLabel(e.kind)]
|
||||
.filter(Boolean)
|
||||
.some((s) => s!.toLowerCase().includes(query.toLowerCase())),
|
||||
)
|
||||
@@ -111,11 +111,11 @@ export default function EquipmentCatalog() {
|
||||
const minKg = parseNum(form.minKg);
|
||||
const maxKg = parseNum(form.maxKg);
|
||||
if (minKg == null || maxKg == null)
|
||||
throw new Error('Podaj zakres obciążeń (min i max w kg).');
|
||||
throw new Error(i18n.t('gyms:equipment.specRangeError'));
|
||||
spec = { minKg, maxKg };
|
||||
} else if (MAX_LOAD_KINDS.includes(kind)) {
|
||||
const maxLoadKg = parseNum(form.maxLoadKg);
|
||||
if (maxLoadKg == null) throw new Error('Podaj maksymalne obciążenie (kg).');
|
||||
if (maxLoadKg == null) throw new Error(i18n.t('gyms:equipment.specMaxLoadError'));
|
||||
spec = { maxLoadKg };
|
||||
} else if (kind === 'CARDIO') {
|
||||
const maxSpeedKmh = parseNum(form.maxSpeedKmh);
|
||||
@@ -167,9 +167,9 @@ export default function EquipmentCatalog() {
|
||||
|
||||
// menu top: akcja „Nowe urządzenie” otwiera modal w treści strony
|
||||
useTopbar({
|
||||
title: 'Urządzenia',
|
||||
title: t('common:nav.equipment'),
|
||||
search: 'equipment',
|
||||
actions: [{ label: 'Nowe urządzenie', onClick: openCreate, icon: Plus }],
|
||||
actions: [{ label: t('newDevice'), onClick: openCreate, icon: Plus }],
|
||||
});
|
||||
|
||||
function openEdit(item: Equipment) {
|
||||
@@ -186,24 +186,24 @@ export default function EquipmentCatalog() {
|
||||
if (LOAD_RANGE_KINDS.includes(kind)) {
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Field label="Obciążenie min (kg)">
|
||||
<Field label={t('minKgLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
step="0.5"
|
||||
min="0"
|
||||
value={form.minKg}
|
||||
onChange={(e) => set('minKg', e.target.value)}
|
||||
placeholder="np. 2.5"
|
||||
placeholder={t('minKgPh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Obciążenie max (kg)">
|
||||
<Field label={t('maxKgLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
step="0.5"
|
||||
min="0"
|
||||
value={form.maxKg}
|
||||
onChange={(e) => set('maxKg', e.target.value)}
|
||||
placeholder="np. 25"
|
||||
placeholder={t('maxKgPh')}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
@@ -211,14 +211,14 @@ export default function EquipmentCatalog() {
|
||||
}
|
||||
if (MAX_LOAD_KINDS.includes(kind)) {
|
||||
return (
|
||||
<Field label="Maksymalne obciążenie (kg)">
|
||||
<Field label={t('maxLoadKgLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
step="0.5"
|
||||
min="0"
|
||||
value={form.maxLoadKg}
|
||||
onChange={(e) => set('maxLoadKg', e.target.value)}
|
||||
placeholder="np. 100"
|
||||
placeholder={t('maxLoadKgPh')}
|
||||
/>
|
||||
</Field>
|
||||
);
|
||||
@@ -226,17 +226,17 @@ export default function EquipmentCatalog() {
|
||||
if (kind === 'CARDIO') {
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Field label="Maks. prędkość (km/h, opcjonalnie)">
|
||||
<Field label={t('maxSpeedLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
step="0.1"
|
||||
min="0"
|
||||
value={form.maxSpeedKmh}
|
||||
onChange={(e) => set('maxSpeedKmh', e.target.value)}
|
||||
placeholder="np. 16"
|
||||
placeholder={t('maxSpeedPh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Maks. nachylenie (% opcjonalnie)">
|
||||
<Field label={t('maxInclineLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
step="1"
|
||||
@@ -244,7 +244,7 @@ export default function EquipmentCatalog() {
|
||||
max="40"
|
||||
value={form.maxInclinePct}
|
||||
onChange={(e) => set('maxInclinePct', e.target.value)}
|
||||
placeholder="np. 15"
|
||||
placeholder={t('maxInclinePh')}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
@@ -255,12 +255,15 @@ export default function EquipmentCatalog() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Muted className="mb-4 block">
|
||||
Katalog maszyn i urządzeń. Przypisuj je do rodzajów ćwiczeń i siłowni.
|
||||
</Muted>
|
||||
<Muted className="mb-4 block">{t('intro')}</Muted>
|
||||
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
{filtered.map((item) => (
|
||||
@@ -270,7 +273,7 @@ export default function EquipmentCatalog() {
|
||||
<div className="text-[1.05rem] font-semibold">
|
||||
{localizedName(item, i18n.language)}
|
||||
<span className="ml-2 text-[0.875rem] text-dim font-normal">
|
||||
{EQUIPMENT_KIND_LABELS[item.kind]}
|
||||
{equipmentKindLabel(item.kind)}
|
||||
</span>
|
||||
</div>
|
||||
{item.nameEn && (
|
||||
@@ -282,7 +285,8 @@ export default function EquipmentCatalog() {
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-0.5 text-[0.875rem] text-dim">
|
||||
{item.exercisesCount ?? 0} ćwiczeń · {item.gymsCount ?? 0} siłowni
|
||||
{t('countExercises', { n: item.exercisesCount ?? 0 })} ·{' '}
|
||||
{t('countGyms', { n: item.gymsCount ?? 0 })}
|
||||
</div>
|
||||
{item.description && (
|
||||
<p className="mt-1 text-dim text-[0.875rem]">{item.description}</p>
|
||||
@@ -293,7 +297,7 @@ export default function EquipmentCatalog() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => openEdit(item)}
|
||||
aria-label={`Edytuj ${localizedName(item, i18n.language)}`}
|
||||
aria-label={t('editAria', { name: localizedName(item, i18n.language) })}
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -302,7 +306,7 @@ export default function EquipmentCatalog() {
|
||||
size="sm"
|
||||
className="text-danger hover:text-danger"
|
||||
onClick={() => setDeleting(item)}
|
||||
aria-label={`Usuń ${localizedName(item, i18n.language)}`}
|
||||
aria-label={t('removeAria', { name: localizedName(item, i18n.language) })}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -316,12 +320,8 @@ export default function EquipmentCatalog() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={Wrench}
|
||||
title="Brak urządzeń"
|
||||
description={
|
||||
query
|
||||
? 'Brak wyników dla podanego zapytania.'
|
||||
: 'Brak urządzeń. Dodaj pierwsze przyciskiem „Nowe urządzenie” w menu kontekstowym.'
|
||||
}
|
||||
title={t('noDevicesTitle')}
|
||||
description={query ? t('noResultsDesc') : t('noDevicesDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
@@ -329,51 +329,51 @@ export default function EquipmentCatalog() {
|
||||
<Modal
|
||||
open={formOpen}
|
||||
onClose={() => setFormOpen(false)}
|
||||
title={editing ? 'Edytuj urządzenie' : 'Nowe urządzenie'}
|
||||
title={editing ? t('editDevice') : t('newDevice')}
|
||||
>
|
||||
<div className="flex flex-col gap-3.5">
|
||||
<Field label="Nazwa">
|
||||
<Field label={t('nameLabel')}>
|
||||
<Input
|
||||
value={form.name}
|
||||
onChange={(e) => setForm((f) => ({ ...f, name: e.target.value }))}
|
||||
placeholder="np. Sztanga"
|
||||
placeholder={t('namePh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nazwa (EN)">
|
||||
<Field label={t('nameLabelEn')}>
|
||||
<Input
|
||||
value={form.nameEn}
|
||||
onChange={(e) => setForm((f) => ({ ...f, nameEn: e.target.value }))}
|
||||
placeholder="e.g. Barbell"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Rodzaj">
|
||||
<Field label={t('kindLabel')}>
|
||||
<Select
|
||||
value={form.kind}
|
||||
onChange={(e) => setForm((f) => ({ ...f, kind: e.target.value as EquipmentKind }))}
|
||||
>
|
||||
{(Object.keys(EQUIPMENT_KIND_LABELS) as EquipmentKind[]).map((k) => (
|
||||
{EQUIPMENT_KINDS.map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{EQUIPMENT_KIND_LABELS[k]}
|
||||
{equipmentKindLabel(k)}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
</Field>
|
||||
{specFields(form.kind, (key, value) => setForm((f) => ({ ...f, [key]: value })))}
|
||||
<Field label="Opis (opcjonalnie)">
|
||||
<Field label={t('descLabel')}>
|
||||
<Textarea
|
||||
value={form.description}
|
||||
onChange={(e) => setForm((f) => ({ ...f, description: e.target.value }))}
|
||||
placeholder="np. Sztanga z talerzami."
|
||||
placeholder={t('descPh')}
|
||||
rows={3}
|
||||
/>
|
||||
</Field>
|
||||
{formError && <ErrorText>{formError}</ErrorText>}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="secondary" onClick={() => setFormOpen(false)}>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button onClick={() => save.mutate()} disabled={save.isPending || !form.name}>
|
||||
{editing ? 'Zapisz' : 'Dodaj'}
|
||||
{editing ? t('common:save') : t('common:add')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -383,13 +383,17 @@ export default function EquipmentCatalog() {
|
||||
open={deleting != null}
|
||||
onClose={() => setDeleting(null)}
|
||||
onConfirm={() => deleting && remove.mutate(deleting.id)}
|
||||
title="Usuń urządzenie"
|
||||
title={t('deleteTitle')}
|
||||
description={
|
||||
deleting && ((deleting.exercisesCount ?? 0) > 0 || (deleting.gymsCount ?? 0) > 0)
|
||||
? `Na pewno usunąć „${deleting.name}”? Zostanie odczepione od ${deleting.exercisesCount ?? 0} ćwiczeń i ${deleting.gymsCount ?? 0} siłowni.`
|
||||
: `Na pewno usunąć „${deleting?.name}”? Zostanie odczepione od ćwiczeń i siłowni.`
|
||||
? t('deleteDescWithCounts', {
|
||||
name: deleting.name,
|
||||
exercises: deleting.exercisesCount ?? 0,
|
||||
gyms: deleting.gymsCount ?? 0,
|
||||
})
|
||||
: t('deleteDescSimple', { name: deleting?.name })
|
||||
}
|
||||
confirmLabel="Usuń"
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={remove.isPending}
|
||||
/>
|
||||
|
||||
@@ -38,25 +38,25 @@ type FlagKey = (typeof FLAG_KEYS)[number];
|
||||
type Flags = Record<FlagKey, boolean>;
|
||||
|
||||
const FLAG_LABELS: Record<FlagKey, string> = {
|
||||
hasReps: 'Powtórzenia',
|
||||
hasLoad: 'Obciążenie',
|
||||
hasRest: 'Przerwa',
|
||||
hasSets: 'Serie',
|
||||
hasRir: 'RIR',
|
||||
hasDifficulty: 'Trudność',
|
||||
hasCardio: 'Cardio',
|
||||
hasTime: 'Czas',
|
||||
hasSpeed: 'Prędkość',
|
||||
hasReps: 'flagHasReps',
|
||||
hasLoad: 'flagHasLoad',
|
||||
hasRest: 'flagHasRest',
|
||||
hasSets: 'flagHasSets',
|
||||
hasRir: 'flagHasRir',
|
||||
hasDifficulty: 'flagHasDifficulty',
|
||||
hasCardio: 'flagHasCardio',
|
||||
hasTime: 'flagHasTime',
|
||||
hasSpeed: 'flagHasSpeed',
|
||||
};
|
||||
|
||||
/** Chipy na karcie — tylko najbardziej wyróżniające flagi. */
|
||||
const CARD_FLAG_CHIPS: Partial<Record<FlagKey, string>> = {
|
||||
hasCardio: 'cardio',
|
||||
hasTime: 'czas',
|
||||
hasSpeed: 'prędkość',
|
||||
hasReps: 'powt.',
|
||||
hasLoad: 'obciążenie',
|
||||
hasRir: 'RIR',
|
||||
hasCardio: 'chipCardio',
|
||||
hasTime: 'chipTime',
|
||||
hasSpeed: 'chipSpeed',
|
||||
hasReps: 'chipReps',
|
||||
hasLoad: 'chipLoad',
|
||||
hasRir: 'chipRir',
|
||||
};
|
||||
|
||||
const PRESET_STRENGTH: Flags = {
|
||||
@@ -91,15 +91,15 @@ const PRESETS: Record<'strength' | 'cardio', Flags> = {
|
||||
type ExerciseType = 'strength' | 'cardio' | 'custom';
|
||||
|
||||
const EXERCISE_TYPE_LABELS: Record<ExerciseType, string> = {
|
||||
strength: 'Siłowe',
|
||||
cardio: 'Cardio',
|
||||
custom: 'Własne',
|
||||
strength: 'typeStrength',
|
||||
cardio: 'typeCardio',
|
||||
custom: 'typeCustom',
|
||||
};
|
||||
|
||||
const SOURCE_LABELS: Record<string, string> = {
|
||||
BUILTIN: 'wbudowane',
|
||||
GYM_CUSTOM: 'siłowni',
|
||||
TRAINER_CUSTOM: 'trenera',
|
||||
const SOURCE_KEYS: Record<string, string> = {
|
||||
BUILTIN: 'sourceBuiltin',
|
||||
GYM_CUSTOM: 'sourceGymCustom',
|
||||
TRAINER_CUSTOM: 'sourceTrainerCustom',
|
||||
};
|
||||
|
||||
function flagsOf(ex: Exercise): Flags {
|
||||
@@ -147,12 +147,13 @@ const EMPTY: FormState = {
|
||||
function muscleOptions(
|
||||
areas: FocusArea[],
|
||||
extraValues: string[],
|
||||
notInCatalog: (name: string) => string,
|
||||
): { value: string; label: string }[] {
|
||||
const options = areas.map((a) => ({ value: a.muscle, label: `${a.name} (${a.muscle})` }));
|
||||
const known = new Set(options.map((o) => o.value));
|
||||
for (const v of extraValues) {
|
||||
if (v && !known.has(v)) {
|
||||
options.push({ value: v, label: `${v} (brak w katalogu obszarów)` });
|
||||
options.push({ value: v, label: notInCatalog(v) });
|
||||
known.add(v);
|
||||
}
|
||||
}
|
||||
@@ -161,7 +162,7 @@ function muscleOptions(
|
||||
|
||||
export default function Exercises() {
|
||||
const qc = useQueryClient();
|
||||
const { i18n } = useTranslation();
|
||||
const { t, i18n } = useTranslation('catalog');
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['exercises'],
|
||||
queryFn: () => api<{ exercises: Exercise[] }>('/admin/exercises'),
|
||||
@@ -274,9 +275,9 @@ export default function Exercises() {
|
||||
|
||||
// menu top: akcja „Nowe ćwiczenie” otwiera modal w treści strony
|
||||
useTopbar({
|
||||
title: 'Rodzaje ćwiczeń',
|
||||
title: t('common:nav.exercises'),
|
||||
search: 'exercises',
|
||||
actions: [{ label: 'Nowe ćwiczenie', onClick: openCreate, icon: Plus }],
|
||||
actions: [{ label: t('newExercise'), onClick: openCreate, icon: Plus }],
|
||||
});
|
||||
|
||||
function openEdit(ex: Exercise) {
|
||||
@@ -315,15 +316,24 @@ export default function Exercises() {
|
||||
}));
|
||||
}
|
||||
|
||||
const primaryOptions = muscleOptions(areas, editing ? [editing.primaryMuscle] : []);
|
||||
const secondaryOptions = muscleOptions(areas, form.secondaryMuscles);
|
||||
const primaryOptions = muscleOptions(areas, editing ? [editing.primaryMuscle] : [], (name) =>
|
||||
t('muscleNotInCatalog', { name }),
|
||||
);
|
||||
const secondaryOptions = muscleOptions(areas, form.secondaryMuscles, (name) =>
|
||||
t('muscleNotInCatalog', { name }),
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Muted className="mb-4 block">Rodzaje ćwiczeń i przypisane do nich maszyny/urządzenia.</Muted>
|
||||
<Muted className="mb-4 block">{t('introEx')}</Muted>
|
||||
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
{filtered.map((ex) => (
|
||||
@@ -332,9 +342,9 @@ export default function Exercises() {
|
||||
<div className="min-w-0">
|
||||
<div className="text-[1.05rem] font-semibold">
|
||||
{localizedName(ex, i18n.language)}
|
||||
{SOURCE_LABELS[ex.source] && (
|
||||
{SOURCE_KEYS[ex.source] && (
|
||||
<span className="ml-2 text-[0.875rem] text-dim font-normal">
|
||||
{SOURCE_LABELS[ex.source]}
|
||||
{t(SOURCE_KEYS[ex.source])}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -348,18 +358,16 @@ export default function Exercises() {
|
||||
))}
|
||||
{FLAG_KEYS.filter((k) => CARD_FLAG_CHIPS[k] && ex[k]).map((k) => (
|
||||
<Badge key={k} color="green">
|
||||
{CARD_FLAG_CHIPS[k]}
|
||||
{t(CARD_FLAG_CHIPS[k]!)}
|
||||
</Badge>
|
||||
))}
|
||||
{ex.planExercisesCount > 0 && (
|
||||
<Badge color="yellow">
|
||||
{ex.planExercisesCount === 1 ? '1 plan' : `${ex.planExercisesCount} planów`}
|
||||
</Badge>
|
||||
<Badge color="yellow">{t('countPlans', { n: ex.planExercisesCount })}</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-1 flex flex-wrap items-center gap-1.5">
|
||||
{ex.equipment.length === 0 ? (
|
||||
<span className="text-dim text-[0.875rem]">brak maszyn</span>
|
||||
<span className="text-dim text-[0.875rem]">{t('noMachines')}</span>
|
||||
) : (
|
||||
ex.equipment.map((e) => (
|
||||
<Badge key={e.id} color="gray">
|
||||
@@ -374,7 +382,7 @@ export default function Exercises() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => openEdit(ex)}
|
||||
aria-label={`Edytuj ${localizedName(ex, i18n.language)}`}
|
||||
aria-label={t('editAria', { name: localizedName(ex, i18n.language) })}
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -383,7 +391,7 @@ export default function Exercises() {
|
||||
size="sm"
|
||||
className="text-danger hover:text-danger"
|
||||
onClick={() => setDeleting(ex)}
|
||||
aria-label={`Usuń ${localizedName(ex, i18n.language)}`}
|
||||
aria-label={t('removeAria', { name: localizedName(ex, i18n.language) })}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -397,12 +405,8 @@ export default function Exercises() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={Dumbbell}
|
||||
title="Brak ćwiczeń"
|
||||
description={
|
||||
query
|
||||
? 'Brak wyników dla podanego zapytania.'
|
||||
: 'Brak ćwiczeń. Dodaj pierwsze przyciskiem „Nowe ćwiczenie” w menu kontekstowym.'
|
||||
}
|
||||
title={t('noExercisesTitle')}
|
||||
description={query ? t('noResultsDesc') : t('noExercisesDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
@@ -410,30 +414,30 @@ export default function Exercises() {
|
||||
<Modal
|
||||
open={formOpen}
|
||||
onClose={() => setFormOpen(false)}
|
||||
title={editing ? 'Edytuj ćwiczenie' : 'Nowe ćwiczenie'}
|
||||
title={editing ? t('editExercise') : t('newExercise')}
|
||||
className="sm:max-w-2xl"
|
||||
>
|
||||
<div className="flex flex-col gap-3.5">
|
||||
<Field label="Nazwa">
|
||||
<Field label={t('nameLabel')}>
|
||||
<Input
|
||||
value={form.name}
|
||||
onChange={(e) => setForm((f) => ({ ...f, name: e.target.value }))}
|
||||
placeholder="np. Wyciskanie sztangi leżąc"
|
||||
placeholder={t('namePhEx')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nazwa (EN)">
|
||||
<Field label={t('nameLabelEn')}>
|
||||
<Input
|
||||
value={form.nameEn}
|
||||
onChange={(e) => setForm((f) => ({ ...f, nameEn: e.target.value }))}
|
||||
placeholder="e.g. Barbell bench press"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Główny mięsień">
|
||||
<Field label={t('primaryMuscle')}>
|
||||
<Select
|
||||
value={form.primaryMuscle}
|
||||
onChange={(e) => setForm((f) => ({ ...f, primaryMuscle: e.target.value }))}
|
||||
>
|
||||
<option value="">— wybierz —</option>
|
||||
<option value="">{t('chooseOption')}</option>
|
||||
{primaryOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
@@ -441,11 +445,9 @@ export default function Exercises() {
|
||||
))}
|
||||
</Select>
|
||||
</Field>
|
||||
<Field label="Mięśnie pomocnicze">
|
||||
<Field label={t('secondaryMuscles')}>
|
||||
{secondaryOptions.length === 0 ? (
|
||||
<p className="text-dim text-[0.875rem]">
|
||||
Brak obszarów w katalogu. Dodaj je w sekcji „Obszary treningowe”.
|
||||
</p>
|
||||
<p className="text-dim text-[0.875rem]">{t('noAreasHint')}</p>
|
||||
) : (
|
||||
<div className="max-h-40 overflow-y-auto rounded-xl border border-line bg-input p-2">
|
||||
{secondaryOptions.map((o) => (
|
||||
@@ -465,28 +467,28 @@ export default function Exercises() {
|
||||
</div>
|
||||
)}
|
||||
</Field>
|
||||
<Field label="Typ ćwiczenia">
|
||||
<Field label={t('exerciseType')}>
|
||||
<Select
|
||||
value={form.exerciseType}
|
||||
onChange={(e) => {
|
||||
const t = e.target.value as ExerciseType;
|
||||
const t2 = e.target.value as ExerciseType;
|
||||
setForm((f) => ({
|
||||
...f,
|
||||
exerciseType: t,
|
||||
exerciseType: t2,
|
||||
// „własne” startuje od aktualnie zaznaczonego zestawu flag
|
||||
flags: t === 'custom' ? currentFlags() : PRESETS[t as 'strength' | 'cardio'],
|
||||
flags: t2 === 'custom' ? currentFlags() : PRESETS[t2 as 'strength' | 'cardio'],
|
||||
}));
|
||||
}}
|
||||
>
|
||||
{(Object.keys(EXERCISE_TYPE_LABELS) as ExerciseType[]).map((t) => (
|
||||
<option key={t} value={t}>
|
||||
{EXERCISE_TYPE_LABELS[t]}
|
||||
{(Object.keys(EXERCISE_TYPE_LABELS) as ExerciseType[]).map((t2) => (
|
||||
<option key={t2} value={t2}>
|
||||
{t(EXERCISE_TYPE_LABELS[t2])}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
</Field>
|
||||
{form.exerciseType === 'custom' && (
|
||||
<Field label="Zapisywane wartości">
|
||||
<Field label={t('savedValues')}>
|
||||
<div className="grid grid-cols-2 gap-1 rounded-xl border border-line bg-input p-2">
|
||||
{FLAG_KEYS.map((k) => (
|
||||
<label
|
||||
@@ -501,17 +503,15 @@ export default function Exercises() {
|
||||
}
|
||||
className="accent-[var(--accent)]"
|
||||
/>
|
||||
<span className="text-[0.875rem]">{FLAG_LABELS[k]}</span>
|
||||
<span className="text-[0.875rem]">{t(FLAG_LABELS[k])}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</Field>
|
||||
)}
|
||||
<Field label="Maszyny / urządzenia">
|
||||
<Field label={t('machines')}>
|
||||
{equipment.length === 0 ? (
|
||||
<p className="text-dim text-[0.875rem]">
|
||||
Brak urządzeń w katalogu. Dodaj je w sekcji „Urządzenia”.
|
||||
</p>
|
||||
<p className="text-dim text-[0.875rem]">{t('noEquipmentHint')}</p>
|
||||
) : (
|
||||
<div className="max-h-56 overflow-y-auto rounded-xl border border-line bg-input p-2">
|
||||
{equipment.map((e) => (
|
||||
@@ -531,37 +531,37 @@ export default function Exercises() {
|
||||
</div>
|
||||
)}
|
||||
</Field>
|
||||
<Field label="Opis (opcjonalnie)">
|
||||
<Field label={t('descLabel')}>
|
||||
<Textarea
|
||||
value={form.description}
|
||||
onChange={(e) => setForm((f) => ({ ...f, description: e.target.value }))}
|
||||
placeholder="Krótki opis ćwiczenia widoczny w aplikacji."
|
||||
placeholder={t('descPhEx')}
|
||||
rows={3}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Jak wykonać (opcjonalnie)">
|
||||
<Field label={t('howToLabel')}>
|
||||
<Textarea
|
||||
value={form.howTo}
|
||||
onChange={(e) => setForm((f) => ({ ...f, howTo: e.target.value }))}
|
||||
placeholder="Instrukcja wykonania."
|
||||
placeholder={t('howToPh')}
|
||||
rows={3}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Najczęstsze błędy (opcjonalnie)">
|
||||
<Field label={t('mistakesLabel')}>
|
||||
<Textarea
|
||||
value={form.commonMistakes}
|
||||
onChange={(e) => setForm((f) => ({ ...f, commonMistakes: e.target.value }))}
|
||||
placeholder="Czego unikać przy wykonaniu."
|
||||
placeholder={t('mistakesPh')}
|
||||
rows={3}
|
||||
/>
|
||||
</Field>
|
||||
{formError && <ErrorText>{formError}</ErrorText>}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="secondary" onClick={() => setFormOpen(false)}>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button onClick={submit} disabled={save.isPending || !form.name || !form.primaryMuscle}>
|
||||
{editing ? 'Zapisz' : 'Dodaj'}
|
||||
{editing ? t('common:save') : t('common:add')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -571,9 +571,12 @@ export default function Exercises() {
|
||||
open={confirmFlagChange}
|
||||
onClose={() => setConfirmFlagChange(false)}
|
||||
onConfirm={() => save.mutate()}
|
||||
title="Zmieniasz typ ćwiczenia"
|
||||
description={`„${editing?.name}” jest używane w ${editing?.planExercisesCount} planie/planach. Zmiana zapisywanych wartości (serie/obciążenie/czas...) wpłynie na trwające plany. Kontynuować?`}
|
||||
confirmLabel="Zapisz"
|
||||
title={t('flagChangeTitle')}
|
||||
description={t('flagChangeDesc', {
|
||||
name: editing?.name,
|
||||
count: editing?.planExercisesCount ?? 0,
|
||||
})}
|
||||
confirmLabel={t('common:save')}
|
||||
danger
|
||||
busy={save.isPending}
|
||||
/>
|
||||
@@ -582,9 +585,9 @@ export default function Exercises() {
|
||||
open={deleting != null}
|
||||
onClose={() => setDeleting(null)}
|
||||
onConfirm={() => deleting && remove.mutate(deleting.id)}
|
||||
title="Usuń ćwiczenie"
|
||||
description={`Na pewno usunąć „${deleting?.name}”? Nie można usunąć ćwiczenia używanego w planach.`}
|
||||
confirmLabel="Usuń"
|
||||
title={t('deleteExerciseTitle')}
|
||||
description={t('deleteExerciseDesc', { name: deleting?.name })}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={remove.isPending}
|
||||
/>
|
||||
|
||||
@@ -42,7 +42,7 @@ const EMPTY: FormState = {
|
||||
|
||||
export default function FocusAreas() {
|
||||
const qc = useQueryClient();
|
||||
const { i18n } = useTranslation();
|
||||
const { t, i18n } = useTranslation('catalog');
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['focus-areas'],
|
||||
queryFn: () => api<{ focusAreas: FocusArea[] }>('/admin/focus-areas'),
|
||||
@@ -110,7 +110,7 @@ export default function FocusAreas() {
|
||||
const min = form.setsMin ? parseInt(form.setsMin, 10) : null;
|
||||
const max = form.setsMax ? parseInt(form.setsMax, 10) : null;
|
||||
if (min != null && max != null && Number.isFinite(min) && Number.isFinite(max) && min > max) {
|
||||
setFormError('Minimalna liczba serii musi być mniejsza lub równa maksymalnej.');
|
||||
setFormError(t('setsOrderError'));
|
||||
return;
|
||||
}
|
||||
// zmiana klucza mięśnia odczepia ćwiczenia od łańcucha priorytetów
|
||||
@@ -130,9 +130,9 @@ export default function FocusAreas() {
|
||||
|
||||
// menu top: akcja „Nowy obszar” otwiera modal w treści strony
|
||||
useTopbar({
|
||||
title: 'Obszary treningowe',
|
||||
title: t('common:nav.focusAreas'),
|
||||
search: 'focus-areas',
|
||||
actions: [{ label: 'Nowy obszar', onClick: openCreate, icon: Plus }],
|
||||
actions: [{ label: t('newArea'), onClick: openCreate, icon: Plus }],
|
||||
});
|
||||
|
||||
function openEdit(area: FocusArea) {
|
||||
@@ -151,13 +151,15 @@ export default function FocusAreas() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<Muted className="mb-4 block">
|
||||
Katalog obszarów treningowych — z niego użytkownicy i trenerzy wybierają priorytety i
|
||||
wykluczenia.
|
||||
</Muted>
|
||||
<Muted className="mb-4 block">{t('introAreas')}</Muted>
|
||||
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
{filtered.map((a) => (
|
||||
@@ -172,11 +174,11 @@ export default function FocusAreas() {
|
||||
<Badge color="blue">{a.muscle}</Badge>
|
||||
{a.setsMin != null && a.setsMax != null && (
|
||||
<Badge color="gray">
|
||||
{a.setsMin}–{a.setsMax} serii/tydz.
|
||||
{t('setsPerWeek', { min: a.setsMin, max: a.setsMax })}
|
||||
</Badge>
|
||||
)}
|
||||
{a.exercisesCount != null && (
|
||||
<Badge color="gray">{a.exercisesCount} ćwiczeń</Badge>
|
||||
<Badge color="gray">{t('countExercises', { n: a.exercisesCount })}</Badge>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -185,7 +187,7 @@ export default function FocusAreas() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => openEdit(a)}
|
||||
aria-label={`Edytuj ${localizedName(a, i18n.language)}`}
|
||||
aria-label={t('editAria', { name: localizedName(a, i18n.language) })}
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -194,7 +196,7 @@ export default function FocusAreas() {
|
||||
size="sm"
|
||||
className="text-danger hover:text-danger"
|
||||
onClick={() => setDeleting(a)}
|
||||
aria-label={`Usuń ${localizedName(a, i18n.language)}`}
|
||||
aria-label={t('removeAria', { name: localizedName(a, i18n.language) })}
|
||||
>
|
||||
<Trash2 className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -209,12 +211,8 @@ export default function FocusAreas() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={Target}
|
||||
title="Brak obszarów"
|
||||
description={
|
||||
query
|
||||
? 'Brak wyników dla podanego zapytania.'
|
||||
: 'Brak obszarów. Dodaj pierwszy przyciskiem „Nowy obszar” w menu kontekstowym.'
|
||||
}
|
||||
title={t('noAreasTitle')}
|
||||
description={query ? t('noResultsDesc') : t('noAreasDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
@@ -222,63 +220,63 @@ export default function FocusAreas() {
|
||||
<Modal
|
||||
open={formOpen}
|
||||
onClose={() => setFormOpen(false)}
|
||||
title={editing ? 'Edytuj obszar' : 'Nowy obszar'}
|
||||
title={editing ? t('editArea') : t('newArea')}
|
||||
>
|
||||
<div className="flex flex-col gap-3.5">
|
||||
<Field label="Nazwa">
|
||||
<Field label={t('nameLabel')}>
|
||||
<Input
|
||||
value={form.name}
|
||||
onChange={(e) => setForm((f) => ({ ...f, name: e.target.value }))}
|
||||
placeholder="np. Klatka piersiowa"
|
||||
placeholder={t('namePhArea')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nazwa (EN)">
|
||||
<Field label={t('nameLabelEn')}>
|
||||
<Input
|
||||
value={form.nameEn}
|
||||
onChange={(e) => setForm((f) => ({ ...f, nameEn: e.target.value }))}
|
||||
placeholder="e.g. Chest"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Klucz mięśnia">
|
||||
<Field label={t('muscleKey')}>
|
||||
<Input
|
||||
value={form.muscle}
|
||||
onChange={(e) => setForm((f) => ({ ...f, muscle: e.target.value }))}
|
||||
placeholder="np. chest"
|
||||
placeholder={t('muscleKeyPh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Opis (opcjonalnie)">
|
||||
<Field label={t('descLabel')}>
|
||||
<Textarea
|
||||
value={form.description}
|
||||
onChange={(e) => setForm((f) => ({ ...f, description: e.target.value }))}
|
||||
placeholder="np. Wyciskanie, rozpiętki, pompki"
|
||||
placeholder={t('descPhArea')}
|
||||
rows={3}
|
||||
/>
|
||||
</Field>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<Field label="Zalecane serie min./tydz.">
|
||||
<Field label={t('setsMinLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={form.setsMin}
|
||||
onChange={(e) => setForm((f) => ({ ...f, setsMin: e.target.value }))}
|
||||
placeholder="np. 10"
|
||||
placeholder={t('setsMinPh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Zalecane serie max./tydz.">
|
||||
<Field label={t('setsMaxLabel')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={form.setsMax}
|
||||
onChange={(e) => setForm((f) => ({ ...f, setsMax: e.target.value }))}
|
||||
placeholder="np. 20"
|
||||
placeholder={t('setsMaxPh')}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
{formError && <ErrorText>{formError}</ErrorText>}
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button variant="secondary" onClick={() => setFormOpen(false)}>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button onClick={submit} disabled={save.isPending || !form.name || !form.muscle}>
|
||||
{editing ? 'Zapisz' : 'Dodaj'}
|
||||
{editing ? t('common:save') : t('common:add')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -288,9 +286,12 @@ export default function FocusAreas() {
|
||||
open={confirmMuscleChange}
|
||||
onClose={() => setConfirmMuscleChange(false)}
|
||||
onConfirm={() => save.mutate()}
|
||||
title="Zmieniasz klucz mięśnia"
|
||||
description={`Obszar „${editing?.name}” ma przypisane ${editing?.exercisesCount} ćwiczeń z dotychczasowym kluczem. Po zmianie przestaną one pasować do łańcucha priorytetów. Kontynuować?`}
|
||||
confirmLabel="Zapisz"
|
||||
title={t('muscleChangeTitle')}
|
||||
description={t('muscleChangeDesc', {
|
||||
name: editing?.name,
|
||||
count: editing?.exercisesCount ?? 0,
|
||||
})}
|
||||
confirmLabel={t('common:save')}
|
||||
danger
|
||||
busy={save.isPending}
|
||||
/>
|
||||
@@ -299,9 +300,9 @@ export default function FocusAreas() {
|
||||
open={deleting != null}
|
||||
onClose={() => setDeleting(null)}
|
||||
onConfirm={() => deleting && remove.mutate(deleting.id)}
|
||||
title="Usuń obszar"
|
||||
description={`Na pewno usunąć „${deleting?.name}”? Użytkownicy nie będą mogli go wybierać.`}
|
||||
confirmLabel="Usuń"
|
||||
title={t('deleteAreaTitle')}
|
||||
description={t('deleteAreaDesc', { name: deleting?.name })}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={remove.isPending}
|
||||
/>
|
||||
|
||||
@@ -60,15 +60,16 @@ import {
|
||||
Textarea,
|
||||
} from '../../components/ui';
|
||||
import { AvailabilityEditor } from '../../components/AvailabilityEditor';
|
||||
import { normalizeAvailability, TIME_SLOTS } from '../../lib/availability';
|
||||
import { dayFull, normalizeAvailability, TIME_SLOTS } from '../../lib/availability';
|
||||
import { fmtDate } from '../../lib/format';
|
||||
|
||||
/* Lista godzin otwarcia: wiersz na dzień (czytelna w wąskiej kolumnie), „dziś” wyróżnione. */
|
||||
function HoursList({ gym }: { gym: Gym }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const availability = normalizeAvailability(gym.availability);
|
||||
const todayIdx = (new Date().getDay() + 6) % 7;
|
||||
const DOWS = ['Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota', 'Niedziela'];
|
||||
const fmt = (r: { start: string; end: string } | null) =>
|
||||
r ? `${r.start}–${r.end}` : 'zamknięte';
|
||||
r ? `${r.start}–${r.end}` : t('closed');
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
{availability.map((day, i) => (
|
||||
@@ -79,10 +80,10 @@ function HoursList({ gym }: { gym: Gym }) {
|
||||
}`}
|
||||
>
|
||||
<span className={`flex items-center gap-2 ${day ? 'font-semibold' : 'text-dim/70'}`}>
|
||||
{DOWS[i]}
|
||||
{dayFull(i)}
|
||||
{i === todayIdx && (
|
||||
<span className="rounded-full bg-accent px-2 py-0.5 text-[0.62rem] font-extrabold uppercase tracking-wide text-accent-ink">
|
||||
dziś
|
||||
{t('today')}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
@@ -97,9 +98,10 @@ function HoursList({ gym }: { gym: Gym }) {
|
||||
|
||||
/* Mozaika galerii (odczyt): pierwsze zdjęcie duże, reszta siatką, „+N” na końcu — jak w apce. */
|
||||
function GalleryMosaic({ gym }: { gym: Gym }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const photos = gym.photos ?? [];
|
||||
if (photos.length === 0) {
|
||||
return <p className="text-[0.875rem] text-dim">Brak zdjęć.</p>;
|
||||
return <p className="text-[0.875rem] text-dim">{t('noPhotos')}</p>;
|
||||
}
|
||||
const [first, ...rest] = photos;
|
||||
return (
|
||||
@@ -117,7 +119,7 @@ function GalleryMosaic({ gym }: { gym: Gym }) {
|
||||
))}
|
||||
{rest.length > 3 && (
|
||||
<div className="grid place-items-center rounded-[10px] border border-line bg-input text-[0.8rem] font-extrabold text-accent-text">
|
||||
+{rest.length - 3} zdjęć
|
||||
{t('photosMore', { count: rest.length - 3 })}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -126,9 +128,10 @@ function GalleryMosaic({ gym }: { gym: Gym }) {
|
||||
|
||||
/* Kafle urządzeń (odczyt) — jak w apce; zarządzanie w modalu z grupy „Urządzenia”. */
|
||||
function EquipmentTiles({ gym }: { gym: Gym }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const { i18n } = useTranslation();
|
||||
if (gym.equipment.length === 0) {
|
||||
return <p className="text-[0.875rem] text-dim">Brak urządzeń.</p>;
|
||||
return <p className="text-[0.875rem] text-dim">{t('noEquipment')}</p>;
|
||||
}
|
||||
return (
|
||||
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
|
||||
@@ -146,6 +149,7 @@ function EquipmentTiles({ gym }: { gym: Gym }) {
|
||||
|
||||
/* Wyjątki (admin): komposer (data + tryb + godziny) — jak w apce. */
|
||||
function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const queryClient = useQueryClient();
|
||||
const [date, setDate] = useState('');
|
||||
const [closed, setClosed] = useState(true);
|
||||
@@ -165,7 +169,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
setDate('');
|
||||
await queryClient.invalidateQueries({ queryKey: ['gym-exceptions', gymId] });
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -174,7 +178,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
return (
|
||||
<div className="rounded-xl border border-line bg-input/40 p-3.5">
|
||||
<div className="mb-2.5 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Dodaj wyjątek — data i tryb dnia
|
||||
{t('addExceptionTitle')}
|
||||
</div>
|
||||
{/* wiersz 1: data + tryb; na wąskich ekranach każde przechodzi na pełną szerokość */}
|
||||
<div className="flex flex-wrap gap-2.5">
|
||||
@@ -182,7 +186,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
type="date"
|
||||
value={date}
|
||||
onChange={(e) => setDate(e.target.value)}
|
||||
aria-label="Data wyjątku"
|
||||
aria-label={t('exceptionDateAria')}
|
||||
className="w-full min-w-0 sm:w-44 sm:flex-none"
|
||||
required
|
||||
/>
|
||||
@@ -195,7 +199,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
closed ? 'bg-accent text-accent-ink' : 'text-dim hover:text-ink'
|
||||
}`}
|
||||
>
|
||||
Zamknięte
|
||||
{t('closedBtn')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -205,7 +209,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
!closed ? 'bg-accent text-accent-ink' : 'text-dim hover:text-ink'
|
||||
}`}
|
||||
>
|
||||
Inne godziny
|
||||
{t('otherHours')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -215,7 +219,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
<Select
|
||||
value={start}
|
||||
onChange={(e) => setStart(e.target.value)}
|
||||
aria-label="Od godziny"
|
||||
aria-label={t('fromHourAria')}
|
||||
className="min-w-0 flex-1 sm:flex-none sm:basis-28"
|
||||
>
|
||||
{TIME_SLOTS.map((s) => (
|
||||
@@ -227,7 +231,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
<Select
|
||||
value={end}
|
||||
onChange={(e) => setEnd(e.target.value)}
|
||||
aria-label="Do godziny"
|
||||
aria-label={t('toHourAria')}
|
||||
className="min-w-0 flex-1 sm:flex-none sm:basis-28"
|
||||
>
|
||||
{TIME_SLOTS.map((s) => (
|
||||
@@ -242,7 +246,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
disabled={busy || !date}
|
||||
className="w-full sm:ml-auto sm:w-auto"
|
||||
>
|
||||
{busy ? 'Dodawanie…' : 'Dodaj'}
|
||||
{busy ? t('adding') : t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
@@ -254,7 +258,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
disabled={busy || !date}
|
||||
className="w-full sm:w-auto"
|
||||
>
|
||||
{busy ? 'Dodawanie…' : 'Dodaj'}
|
||||
{busy ? t('adding') : t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
@@ -265,6 +269,7 @@ function ExceptionsComposer({ gymId }: { gymId: string }) {
|
||||
|
||||
/* Lista wyjątków z usuwaniem (admin może zarządzać każdym dniem). */
|
||||
function ExceptionsList({ gymId }: { gymId: string }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const queryClient = useQueryClient();
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ['gym-exceptions', gymId],
|
||||
@@ -277,13 +282,13 @@ function ExceptionsList({ gymId }: { gymId: string }) {
|
||||
await api(`/admin/gyms/${gymId}/exceptions/${exceptionId}`, { method: 'DELETE' });
|
||||
await queryClient.invalidateQueries({ queryKey: ['gym-exceptions', gymId] });
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : 'Błąd');
|
||||
alert(err instanceof Error ? err.message : t('common:error'));
|
||||
}
|
||||
};
|
||||
|
||||
if (isLoading) return <Loading />;
|
||||
if (exceptions.length === 0) {
|
||||
return <p className="text-[0.875rem] text-dim">Brak wyjątków.</p>;
|
||||
return <p className="text-[0.875rem] text-dim">{t('noExceptions')}</p>;
|
||||
}
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
@@ -293,13 +298,13 @@ function ExceptionsList({ gymId }: { gymId: string }) {
|
||||
className="flex items-center gap-3 rounded-[10px] border border-dashed border-danger/40 bg-danger/7 px-3 py-2"
|
||||
>
|
||||
<span className="font-display text-[0.85rem] font-bold tabular-nums">
|
||||
{new Date(ex.date).toLocaleDateString('pl-PL')}
|
||||
{fmtDate(ex.date)}
|
||||
</span>
|
||||
<span className="min-w-0 flex-1 truncate text-dim text-[0.8125rem]">
|
||||
{ex.availability ? `${ex.availability.start}–${ex.availability.end}` : 'zamknięte'}
|
||||
{ex.availability ? `${ex.availability.start}–${ex.availability.end}` : t('closed')}
|
||||
</span>
|
||||
<Button variant="danger" size="sm" type="button" onClick={() => void remove(ex.id)}>
|
||||
Usuń
|
||||
{t('common:remove')}
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
@@ -327,6 +332,7 @@ function ExceptionsEditor({ gymId }: { gymId: string }) {
|
||||
}
|
||||
|
||||
function GymEditForm({ gym, onSaved }: { gym: Gym; onSaved: () => void }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const [form, setForm] = useState({
|
||||
name: gym.name,
|
||||
addressLine1: gym.addressLine1 ?? '',
|
||||
@@ -363,7 +369,7 @@ function GymEditForm({ gym, onSaved }: { gym: Gym; onSaved: () => void }) {
|
||||
setSaved(true);
|
||||
onSaved();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -372,14 +378,14 @@ function GymEditForm({ gym, onSaved }: { gym: Gym; onSaved: () => void }) {
|
||||
return (
|
||||
<form onSubmit={submit}>
|
||||
<div className="grid grid-cols-1 gap-x-4 sm:grid-cols-2">
|
||||
<Field label="Nazwa">
|
||||
<Field label={t('nameLabel')}>
|
||||
<Input
|
||||
value={form.name}
|
||||
onChange={(e) => setForm({ ...form, name: e.target.value })}
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Ilość miejsc">
|
||||
<Field label={t('capacity')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={form.capacity}
|
||||
@@ -393,8 +399,7 @@ function GymEditForm({ gym, onSaved }: { gym: Gym; onSaved: () => void }) {
|
||||
</div>
|
||||
{!gym.addressLine1 && gym.location && (
|
||||
<p className="mb-3 text-[0.8rem] text-dim">
|
||||
Dotychczasowa lokalizacja: „{gym.location}”. Podanie adresu nadpisze ją adresem
|
||||
strukturalnym.
|
||||
{t('existingLocation', { location: gym.location })}
|
||||
</p>
|
||||
)}
|
||||
<div className="my-4 border-t border-line" />
|
||||
@@ -405,9 +410,9 @@ function GymEditForm({ gym, onSaved }: { gym: Gym; onSaved: () => void }) {
|
||||
/>
|
||||
</div>
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
{saved && !error && <SuccessText>Zapisano zmiany.</SuccessText>}
|
||||
{saved && !error && <SuccessText>{t('saved')}</SuccessText>}
|
||||
<Button type="submit" disabled={busy || !addressOk}>
|
||||
{busy ? 'Zapisywanie…' : 'Zapisz'}
|
||||
{busy ? t('common:saving') : t('common:save')}
|
||||
</Button>
|
||||
</form>
|
||||
);
|
||||
@@ -415,6 +420,7 @@ function GymEditForm({ gym, onSaved }: { gym: Gym; onSaved: () => void }) {
|
||||
|
||||
/* Właściciele siłowni (admin-only): lista + nadawanie i odbieranie roli OWNER. */
|
||||
function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const { data: usersData } = useAdminUsers();
|
||||
const owners = gym.owners ?? [];
|
||||
const [pick, setPick] = useState('');
|
||||
@@ -432,7 +438,7 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
setPick('');
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -445,7 +451,7 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
await api(`/admin/gyms/${gym.id}/owners/${userId}`, { method: 'DELETE' });
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -462,10 +468,8 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
<div className="mx-auto mb-3 flex h-11 w-11 items-center justify-center rounded-full bg-accent/10 text-accent-text">
|
||||
<Crown className="h-5 w-5" />
|
||||
</div>
|
||||
<p className="mb-1 font-semibold">Brak właściciela</p>
|
||||
<Muted className="text-[0.875rem]">
|
||||
Wyznacz osobę, która będzie zarządzać siłownią w aplikacji.
|
||||
</Muted>
|
||||
<p className="mb-1 font-semibold">{t('noOwnerTitle')}</p>
|
||||
<Muted className="text-[0.875rem]">{t('noOwnerDesc')}</Muted>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
@@ -491,8 +495,8 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Odbierz rolę"
|
||||
title="Odbierz rolę właściciela"
|
||||
aria-label={t('revokeAria')}
|
||||
title={t('revokeTitle')}
|
||||
disabled={busy}
|
||||
onClick={() => void remove(o.id)}
|
||||
className="shrink-0 cursor-pointer rounded-lg p-2 text-dim transition-colors hover:bg-danger/10 hover:text-danger disabled:opacity-50"
|
||||
@@ -511,18 +515,16 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
users={availableUsers}
|
||||
value={pick}
|
||||
onChange={setPick}
|
||||
ariaLabel="Szukaj przyszłego właściciela"
|
||||
emptyLabel="Brak kandydatów — wszyscy użytkownicy są już właścicielami"
|
||||
ariaLabel={t('searchFutureOwner')}
|
||||
emptyLabel={t('noOwnerCandidates')}
|
||||
/>
|
||||
</div>
|
||||
<Button onClick={() => void add()} disabled={!pick || busy} className="shrink-0">
|
||||
<UserPlus className="h-4 w-4" />
|
||||
{busy ? 'Nadawanie…' : 'Nadaj właściciela'}
|
||||
{busy ? t('granting') : t('grantOwner')}
|
||||
</Button>
|
||||
</div>
|
||||
<Muted className="mt-2 block text-[0.8rem]">
|
||||
Właściciel zarządza siłownią w aplikacji: urządzeniami, galerią i harmonogramem.
|
||||
</Muted>
|
||||
<Muted className="mt-2 block text-[0.8rem]">{t('ownerRoleHint')}</Muted>
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
</div>
|
||||
</div>
|
||||
@@ -530,6 +532,7 @@ function OwnersSection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
}
|
||||
|
||||
export default function GymDetail() {
|
||||
const { t } = useTranslation('gyms');
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const queryClient = useQueryClient();
|
||||
@@ -565,7 +568,7 @@ export default function GymDetail() {
|
||||
await queryClient.invalidateQueries({ queryKey: ['gyms'] });
|
||||
navigate('/gyms');
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : 'Błąd');
|
||||
alert(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -577,57 +580,61 @@ export default function GymDetail() {
|
||||
? [
|
||||
{
|
||||
id: 'edit',
|
||||
label: 'Edycja',
|
||||
label: t('groupEdit'),
|
||||
icon: Pencil,
|
||||
actions: [{ label: 'Podstawowe informacje', onClick: () => setEditOpen(true) }],
|
||||
actions: [{ label: t('basicInfo'), onClick: () => setEditOpen(true) }],
|
||||
},
|
||||
...(gym.kind === 'REAL'
|
||||
? [
|
||||
{
|
||||
id: 'gallery',
|
||||
label: 'Galeria',
|
||||
label: t('groupGallery'),
|
||||
icon: ImageIcon,
|
||||
actions: [{ label: 'Galeria', onClick: () => setGalleryOpen(true) }],
|
||||
actions: [{ label: t('groupGallery'), onClick: () => setGalleryOpen(true) }],
|
||||
} as TopbarCustomGroup,
|
||||
]
|
||||
: []),
|
||||
{
|
||||
id: 'equipment',
|
||||
label: 'Urządzenia',
|
||||
label: t('groupEquipment'),
|
||||
icon: Wrench,
|
||||
actions: [{ label: 'Urządzenia', onClick: () => setEquipmentOpen(true) }],
|
||||
actions: [{ label: t('groupEquipment'), onClick: () => setEquipmentOpen(true) }],
|
||||
},
|
||||
{
|
||||
id: 'owners',
|
||||
label: 'Właściciele',
|
||||
label: t('groupOwners'),
|
||||
icon: ShieldCheck,
|
||||
actions: [{ label: 'Właściciele', onClick: () => setOwnersOpen(true) }],
|
||||
actions: [{ label: t('groupOwners'), onClick: () => setOwnersOpen(true) }],
|
||||
},
|
||||
{
|
||||
id: 'announcements',
|
||||
label: 'Ogłoszenia',
|
||||
label: t('groupAnnouncements'),
|
||||
icon: Megaphone,
|
||||
actions: [
|
||||
{ label: 'Ogłoś w imieniu siłowni', onClick: () => setAnnouncementsOpen(true) },
|
||||
],
|
||||
actions: [{ label: t('announceOnBehalf'), onClick: () => setAnnouncementsOpen(true) }],
|
||||
},
|
||||
]
|
||||
: undefined;
|
||||
|
||||
useTopbar({
|
||||
title: 'Siłownie',
|
||||
title: t('common:nav.gyms'),
|
||||
back: '/gyms',
|
||||
groups,
|
||||
actions: [{ label: 'Usuń siłownię', variant: 'danger', onClick: () => setConfirmOpen(true) }],
|
||||
actions: [{ label: t('deleteGym'), variant: 'danger', onClick: () => setConfirmOpen(true) }],
|
||||
});
|
||||
|
||||
if (isLoading) return <Loading />;
|
||||
if (error) return <ErrorText>Błąd: {(error as Error).message}</ErrorText>;
|
||||
if (error)
|
||||
return (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
);
|
||||
if (!gym) {
|
||||
return (
|
||||
<>
|
||||
<BackButton to="/gyms" className="mb-4" />
|
||||
<ErrorText>Nie znaleziono siłowni.</ErrorText>
|
||||
<ErrorText>{t('notFound')}</ErrorText>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -683,20 +690,20 @@ export default function GymDetail() {
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-white/14 px-3 py-1 text-[0.78rem] font-semibold text-white backdrop-blur-sm">
|
||||
<Users className="h-3 w-3" />
|
||||
{gym._count?.memberships ?? 0} członków
|
||||
{t('common:counters.members', { count: gym._count?.memberships ?? 0 })}
|
||||
</span>
|
||||
<span className="inline-flex items-center gap-1.5 rounded-full bg-white/14 px-3 py-1 text-[0.78rem] font-semibold text-white backdrop-blur-sm">
|
||||
<Dumbbell className="h-3 w-3" />
|
||||
{gym.equipment.length} urządzeń
|
||||
{t('common:counters.devices', { count: gym.equipment.length })}
|
||||
</span>
|
||||
{gym.kind === 'VIRTUAL' && (
|
||||
<span className="rounded-full bg-white/14 px-3 py-1 text-[0.78rem] font-semibold text-white backdrop-blur-sm">
|
||||
Wirtualna
|
||||
{t('virtual')}
|
||||
</span>
|
||||
)}
|
||||
{gym.isPrivate && (
|
||||
<span className="rounded-full bg-white/14 px-3 py-1 text-[0.78rem] font-semibold text-white backdrop-blur-sm">
|
||||
Prywatna
|
||||
{t('private')}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -710,57 +717,54 @@ export default function GymDetail() {
|
||||
<div className="flex min-w-0 flex-col gap-4">
|
||||
{gym.kind === 'REAL' && (
|
||||
<Card>
|
||||
<SectionHeader title="Galeria zdjęć" />
|
||||
<SectionHeader title={t('gallerySection')} />
|
||||
<GalleryMosaic gym={gym} />
|
||||
</Card>
|
||||
)}
|
||||
<Card>
|
||||
<SectionHeader
|
||||
title="Urządzenia"
|
||||
description="Maszyny i urządzenia dostępne w tej siłowni."
|
||||
/>
|
||||
<SectionHeader title={t('groupEquipment')} description={t('equipmentDesc')} />
|
||||
<EquipmentTiles gym={gym} />
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className="flex min-w-0 flex-col gap-4">
|
||||
<Card>
|
||||
<SectionHeader title="Godziny otwarcia" />
|
||||
<SectionHeader title={t('hours')} />
|
||||
<HoursList gym={gym} />
|
||||
<div className="mt-4 mb-2 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Wyjątki
|
||||
{t('exceptions')}
|
||||
</div>
|
||||
<ExceptionsList gymId={gym.id} />
|
||||
</Card>
|
||||
<Card>
|
||||
<SectionHeader title="Dane" />
|
||||
<SectionHeader title={t('data')} />
|
||||
<div className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-[0.85rem]">
|
||||
<span className="text-dim">Rodzaj</span>
|
||||
<b>{gym.kind === 'REAL' ? 'Realna' : 'Wirtualna'}</b>
|
||||
<span className="text-dim">Prywatna</span>
|
||||
<b>{gym.isPrivate ? 'tak' : 'nie'}</b>
|
||||
<span className="text-dim">Pojemność</span>
|
||||
<span className="text-dim">{t('kindLabel')}</span>
|
||||
<b>{gym.kind === 'REAL' ? t('kindReal') : t('kindVirtual')}</b>
|
||||
<span className="text-dim">{t('privateLabel')}</span>
|
||||
<b>{gym.isPrivate ? t('common:yes') : t('common:no')}</b>
|
||||
<span className="text-dim">{t('capacityLabel')}</span>
|
||||
<b className="font-display tabular-nums">{gym.capacity ?? '—'}</b>
|
||||
{gym.addressLine1 || gym.postalCode || gym.city ? (
|
||||
<>
|
||||
<span className="text-dim">Ulica</span>
|
||||
<span className="text-dim">{t('streetLabel')}</span>
|
||||
<b>{[gym.addressLine1, gym.addressLine2].filter(Boolean).join(', ') || '—'}</b>
|
||||
<span className="text-dim">Kod i miasto</span>
|
||||
<span className="text-dim">{t('cityCodeLabel')}</span>
|
||||
<b>{[gym.postalCode, gym.city].filter(Boolean).join(' ') || '—'}</b>
|
||||
{gym.countryCode && gym.countryCode !== 'PL' && (
|
||||
<>
|
||||
<span className="text-dim">Kraj</span>
|
||||
<span className="text-dim">{t('countryLabel')}</span>
|
||||
<b>{gym.countryCode}</b>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span className="text-dim">Lokalizacja</span>
|
||||
<span className="text-dim">{t('locationLabel')}</span>
|
||||
<b>{gym.location ?? '—'}</b>
|
||||
</>
|
||||
)}
|
||||
<span className="text-dim">Właściciele</span>
|
||||
<span className="text-dim">{t('ownersLabel')}</span>
|
||||
<b>{ownerNames.length > 0 ? ownerNames.join(', ') : '—'}</b>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -771,7 +775,7 @@ export default function GymDetail() {
|
||||
<Modal
|
||||
open={editOpen}
|
||||
onClose={() => setEditOpen(false)}
|
||||
title="Podstawowe informacje"
|
||||
title={t('basicInfo')}
|
||||
className="sm:max-w-2xl"
|
||||
>
|
||||
<GymEditForm
|
||||
@@ -782,31 +786,28 @@ export default function GymDetail() {
|
||||
}}
|
||||
/>
|
||||
<div className="mt-6 border-t border-line pt-5">
|
||||
<SectionHeader
|
||||
title="Wyjątki w harmonogramie"
|
||||
description="Jednorazowe zmiany na konkretny dzień (zamknięcie lub inne godziny)."
|
||||
/>
|
||||
<SectionHeader title={t('exceptionsTitle')} description={t('exceptionsDesc')} />
|
||||
<ExceptionsEditor gymId={gym.id} />
|
||||
</div>
|
||||
</Modal>
|
||||
<Modal open={galleryOpen} onClose={() => setGalleryOpen(false)} title="Zarządzaj galerią">
|
||||
<Modal open={galleryOpen} onClose={() => setGalleryOpen(false)} title={t('manageGallery')}>
|
||||
<GallerySection key={gym.id} gym={gym} onChanged={() => void invalidate()} />
|
||||
</Modal>
|
||||
<Modal
|
||||
open={equipmentOpen}
|
||||
onClose={() => setEquipmentOpen(false)}
|
||||
title="Zarządzaj urządzeniami"
|
||||
title={t('manageEquipment')}
|
||||
className="sm:max-w-2xl"
|
||||
>
|
||||
<EquipmentSection key={gym.id} gym={gym} onChanged={() => void invalidate()} />
|
||||
</Modal>
|
||||
<Modal open={ownersOpen} onClose={() => setOwnersOpen(false)} title="Zarządzaj właścicielami">
|
||||
<Modal open={ownersOpen} onClose={() => setOwnersOpen(false)} title={t('manageOwners')}>
|
||||
<OwnersSection key={gym.id} gym={gym} onChanged={() => void invalidate()} />
|
||||
</Modal>
|
||||
<Modal
|
||||
open={announcementsOpen}
|
||||
onClose={() => setAnnouncementsOpen(false)}
|
||||
title="Ogłoszenia w imieniu siłowni"
|
||||
title={t('announcementsTitle')}
|
||||
>
|
||||
<GymAnnouncementsSection key={gym.id} gym={gym} />
|
||||
</Modal>
|
||||
@@ -815,9 +816,9 @@ export default function GymDetail() {
|
||||
open={confirmOpen}
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
onConfirm={() => void remove()}
|
||||
title="Usuń siłownię"
|
||||
description="Usunąć siłownię? Członkostwa zostaną usunięte, plany użytkowników zachowane."
|
||||
confirmLabel="Usuń"
|
||||
title={t('deleteGym')}
|
||||
description={t('deleteGymDesc')}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={busy}
|
||||
/>
|
||||
@@ -827,6 +828,7 @@ export default function GymDetail() {
|
||||
|
||||
/* Awaryjne ogłoszenia w imieniu siłowni (gdy właściciel nie może sam). */
|
||||
function GymAnnouncementsSection({ gym }: { gym: Gym }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const queryClient = useQueryClient();
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ['admin-announcements', gym.id],
|
||||
@@ -853,7 +855,7 @@ function GymAnnouncementsSection({ gym }: { gym: Gym }) {
|
||||
setBody('');
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-announcements', gym.id] });
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -865,37 +867,35 @@ function GymAnnouncementsSection({ gym }: { gym: Gym }) {
|
||||
await api(`/admin/announcements/${id}`, { method: 'DELETE' });
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-announcements', gym.id] });
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex flex-col gap-2.5 rounded-xl border border-line bg-input/40 p-3.5">
|
||||
<Muted className="block">
|
||||
Ogłoszenie trafi do wszystkich członków siłowni „{gym.name}”.
|
||||
</Muted>
|
||||
<Field label="Tytuł">
|
||||
<Muted className="block">{t('announcementSendTo', { name: gym.name })}</Muted>
|
||||
<Field label={t('announcementTitleLabel')}>
|
||||
<Input
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
maxLength={120}
|
||||
placeholder="np. Awarida prądu — siłownia nieczynna"
|
||||
placeholder={t('announcementTitlePh')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Treść">
|
||||
<Field label={t('announcementBodyLabel')}>
|
||||
<Textarea
|
||||
value={body}
|
||||
onChange={(e) => setBody(e.target.value)}
|
||||
maxLength={2000}
|
||||
rows={3}
|
||||
placeholder="Treść ogłoszenia…"
|
||||
placeholder={t('announcementBodyPh')}
|
||||
/>
|
||||
</Field>
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
<div>
|
||||
<Button onClick={() => void add()} disabled={busy || !title.trim() || !body.trim()}>
|
||||
{busy ? 'Publikowanie…' : 'Opublikuj'}
|
||||
{busy ? t('publishing') : t('publish')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -903,7 +903,7 @@ function GymAnnouncementsSection({ gym }: { gym: Gym }) {
|
||||
{isLoading ? (
|
||||
<Loading />
|
||||
) : announcements.length === 0 ? (
|
||||
<Muted className="block">Brak ogłoszeń tej siłowni.</Muted>
|
||||
<Muted className="block">{t('noAnnouncements')}</Muted>
|
||||
) : (
|
||||
<div className="flex flex-col gap-2">
|
||||
{announcements.map((a) => (
|
||||
@@ -915,9 +915,9 @@ function GymAnnouncementsSection({ gym }: { gym: Gym }) {
|
||||
variant="danger"
|
||||
size="sm"
|
||||
onClick={() => void remove(a.id)}
|
||||
aria-label={`Usuń ${a.title}`}
|
||||
aria-label={t('removeAria', { name: a.title })}
|
||||
>
|
||||
Usuń
|
||||
{t('common:remove')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
@@ -941,27 +941,28 @@ function AddSpecFields({
|
||||
values: SpecFields;
|
||||
onChange: (patch: Partial<SpecFields>) => void;
|
||||
}) {
|
||||
const { t } = useTranslation('gyms');
|
||||
if (LOAD_RANGE_KINDS.includes(kind)) {
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-x-4 gap-y-2">
|
||||
<Field label="Min. obciążenie (kg)">
|
||||
<Field label={t('minLoad')}>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
max={500}
|
||||
step="any"
|
||||
aria-label="Min. obciążenie (kg)"
|
||||
aria-label={t('minLoad')}
|
||||
value={values.minKg}
|
||||
onChange={(e) => onChange({ minKg: e.target.value })}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Max. obciążenie (kg)">
|
||||
<Field label={t('maxLoad')}>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
max={500}
|
||||
step="any"
|
||||
aria-label="Max. obciążenie (kg)"
|
||||
aria-label={t('maxLoad')}
|
||||
value={values.maxKg}
|
||||
onChange={(e) => onChange({ maxKg: e.target.value })}
|
||||
/>
|
||||
@@ -971,13 +972,13 @@ function AddSpecFields({
|
||||
}
|
||||
if (MAX_LOAD_KINDS.includes(kind)) {
|
||||
return (
|
||||
<Field label="Maksymalne obciążenie (kg)">
|
||||
<Field label={t('maxLoadFull')}>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
max={1000}
|
||||
step="any"
|
||||
aria-label="Maksymalne obciążenie (kg)"
|
||||
aria-label={t('maxLoadFull')}
|
||||
value={values.maxLoadKg}
|
||||
onChange={(e) => onChange({ maxLoadKg: e.target.value })}
|
||||
/>
|
||||
@@ -987,24 +988,24 @@ function AddSpecFields({
|
||||
if (kind === 'CARDIO') {
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-x-4 gap-y-2">
|
||||
<Field label="Maks. prędkość (km/h)">
|
||||
<Field label={t('maxSpeed')}>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
max={50}
|
||||
step="any"
|
||||
aria-label="Maks. prędkość (km/h)"
|
||||
aria-label={t('maxSpeed')}
|
||||
value={values.maxSpeedKmh}
|
||||
onChange={(e) => onChange({ maxSpeedKmh: e.target.value })}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Maks. nachylenie (%)">
|
||||
<Field label={t('maxIncline')}>
|
||||
<Input
|
||||
type="number"
|
||||
min={0}
|
||||
max={40}
|
||||
step="any"
|
||||
aria-label="Maks. nachylenie (%)"
|
||||
aria-label={t('maxIncline')}
|
||||
value={values.maxInclinePct}
|
||||
onChange={(e) => onChange({ maxInclinePct: e.target.value })}
|
||||
/>
|
||||
@@ -1016,6 +1017,7 @@ function AddSpecFields({
|
||||
}
|
||||
|
||||
function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const { i18n } = useTranslation();
|
||||
const { data: eqData, isLoading } = useQuery({
|
||||
queryKey: ['equipment'],
|
||||
@@ -1050,7 +1052,7 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
return;
|
||||
}
|
||||
if (result.spec == null) {
|
||||
setError('Podaj parametry urządzenia (prędkość lub nachylenie).');
|
||||
setError(t('specRequired'));
|
||||
return;
|
||||
}
|
||||
spec = result.spec;
|
||||
@@ -1066,7 +1068,7 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
setAddFields(EMPTY_SPEC_FIELDS);
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -1080,7 +1082,7 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
});
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : 'Błąd');
|
||||
alert(err instanceof Error ? err.message : t('common:error'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1089,7 +1091,7 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
await api(`/admin/gyms/${gym.id}/equipment/${instanceId}`, { method: 'DELETE' });
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : 'Błąd');
|
||||
alert(err instanceof Error ? err.message : t('common:error'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1103,11 +1105,11 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
{/* POZYCJE NA STANIE: wiersz = nazwa/spec + ilość + usuwanie */}
|
||||
<div>
|
||||
<div className="mb-2 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Pozycje na stanie ({gym.equipment.length})
|
||||
{t('positionsInStock', { count: gym.equipment.length })}
|
||||
</div>
|
||||
{gym.equipment.length === 0 ? (
|
||||
<div className="rounded-[10px] border border-dashed border-line px-4 py-6 text-center text-[0.875rem] text-dim">
|
||||
Brak urządzeń — dodaj pierwsze z katalogu poniżej.
|
||||
{t('noStockDesc')}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex flex-col gap-2">
|
||||
@@ -1124,7 +1126,7 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
min={1}
|
||||
max={10000}
|
||||
defaultValue={e.quantity}
|
||||
aria-label={`Ilość: ${localizedName(e.equipment, i18n.language)}`}
|
||||
aria-label={t('qtyAria', { name: localizedName(e.equipment, i18n.language) })}
|
||||
className="w-16 shrink-0 rounded-[10px] border border-line bg-input px-2 py-1 text-center text-[0.875rem] text-ink focus:border-accent-text focus:outline-none"
|
||||
onBlur={(ev) => {
|
||||
const value = parseInt(ev.target.value, 10);
|
||||
@@ -1141,8 +1143,8 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void remove(e.id)}
|
||||
aria-label={`Usuń ${localizedName(e.equipment, i18n.language)}`}
|
||||
title={`Usuń ${localizedName(e.equipment, i18n.language)}`}
|
||||
aria-label={t('removeAria', { name: localizedName(e.equipment, i18n.language) })}
|
||||
title={t('removeAria', { name: localizedName(e.equipment, i18n.language) })}
|
||||
className="shrink-0 cursor-pointer rounded-lg p-1.5 text-dim transition-colors hover:bg-danger/10 hover:text-danger"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" aria-hidden="true" />
|
||||
@@ -1156,28 +1158,28 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
{/* DODAWANIE z katalogu: pozycja zawsze z własnymi parametrami (zdjęcia pozycji zarządza właściciel w apce) */}
|
||||
<div className="rounded-xl border border-line bg-input/40 p-3.5">
|
||||
<div className="mb-2.5 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Dodaj urządzenie z katalogu
|
||||
{t('addFromCatalog')}
|
||||
</div>
|
||||
<div className="flex flex-wrap items-end gap-2.5">
|
||||
<div className="min-w-0 flex-1 basis-52">
|
||||
<Select
|
||||
value={addId}
|
||||
onChange={(e) => selectAdd(e.target.value)}
|
||||
aria-label="Dodaj urządzenie"
|
||||
aria-label={t('addDeviceAria')}
|
||||
>
|
||||
<option value="">Wybierz urządzenie…</option>
|
||||
<option value="">{t('chooseDevice')}</option>
|
||||
{catalog.map((e) => {
|
||||
const qty = totalQty(e.id);
|
||||
return (
|
||||
<option key={e.id} value={e.id}>
|
||||
{localizedName(e, i18n.language)}
|
||||
{qty > 0 ? ` (na stanie: ${qty})` : ''}
|
||||
{qty > 0 ? ` ${t('inStockOption', { count: qty })}` : ''}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
</Select>
|
||||
</div>
|
||||
<Field label="Ilość" className="w-20 shrink-0">
|
||||
<Field label={t('qty')} className="w-20 shrink-0">
|
||||
<Input
|
||||
type="number"
|
||||
size="sm"
|
||||
@@ -1185,17 +1187,17 @@ function EquipmentSection({ gym, onChanged }: { gym: Gym; onChanged: () => void
|
||||
max={10000}
|
||||
value={addQty}
|
||||
onChange={(e) => setAddQty(e.target.value)}
|
||||
aria-label="Ilość"
|
||||
aria-label={t('qty')}
|
||||
/>
|
||||
</Field>
|
||||
<Button onClick={add} disabled={!addId || busy} className="shrink-0">
|
||||
{busy ? 'Dodawanie…' : 'Dodaj'}
|
||||
{busy ? t('adding') : t('add')}
|
||||
</Button>
|
||||
</div>
|
||||
{addItem && hasSpecFields(addItem.kind) && (
|
||||
<div className="mt-3.5 border-t border-line pt-3.5">
|
||||
<div className="mb-2 text-[11px] font-bold uppercase tracking-[0.1em] text-dim">
|
||||
Parametry
|
||||
{t('parameters')}
|
||||
</div>
|
||||
<AddSpecFields
|
||||
kind={addItem.kind}
|
||||
@@ -1222,6 +1224,7 @@ async function uploadGymPhotos(gymId: string, files: File[]): Promise<unknown> {
|
||||
}
|
||||
|
||||
function GallerySection({ gym, onChanged }: { gym: Gym; onChanged: () => void }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const photos = gym.photos ?? [];
|
||||
const [error, setError] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
@@ -1234,11 +1237,11 @@ function GallerySection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
(f) => PHOTO_MIME_TYPES.includes(f.type) && f.size <= MAX_PHOTO_FILE_SIZE,
|
||||
);
|
||||
if (valid.length === 0) {
|
||||
setError('Dozwolone pliki: JPEG, PNG, WEBP (max 5 MB).');
|
||||
setError(t('photoTypesError'));
|
||||
return;
|
||||
}
|
||||
if (valid.length > MAX_PHOTO_FILES) {
|
||||
setError(`Maksymalnie ${MAX_PHOTO_FILES} plików naraz.`);
|
||||
setError(t('photoMaxFilesError', { count: MAX_PHOTO_FILES }));
|
||||
return;
|
||||
}
|
||||
setError('');
|
||||
@@ -1247,19 +1250,19 @@ function GallerySection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
await uploadGymPhotos(gym.id, valid);
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const remove = async (photo: GymPhoto) => {
|
||||
if (!confirm('Usunąć to zdjęcie?')) return;
|
||||
if (!confirm(t('confirmDeletePhoto'))) return;
|
||||
try {
|
||||
await api(`/gyms/${gym.id}/photos/${photo.id}`, { method: 'DELETE' });
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : 'Błąd');
|
||||
alert(err instanceof Error ? err.message : t('common:error'));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1268,37 +1271,34 @@ function GallerySection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
await api(`/gyms/${gym.id}/photos/${photo.id}/cover`, { method: 'PATCH' });
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
alert(err instanceof Error ? err.message : 'Błąd');
|
||||
alert(err instanceof Error ? err.message : t('common:error'));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SectionHeader
|
||||
title="Galeria zdjęć"
|
||||
description="Zdjęcia tej siłowni. Pierwsza pozycja to okładka (widoczna na liście)."
|
||||
/>
|
||||
<SectionHeader title={t('gallerySection')} description={t('galleryDesc')} />
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
|
||||
{photos.length === 0 && (
|
||||
<span className="col-span-full text-[0.875rem] text-dim">Brak zdjęć.</span>
|
||||
<span className="col-span-full text-[0.875rem] text-dim">{t('noPhotos')}</span>
|
||||
)}
|
||||
{photos.map((photo, i) => (
|
||||
<div key={photo.id} className="relative overflow-hidden rounded-xl border border-line">
|
||||
<AuthImage
|
||||
src={photo.url}
|
||||
alt={`Zdjęcie ${i + 1}`}
|
||||
alt={t('photoAlt', { n: i + 1 })}
|
||||
className="h-32 w-full object-cover"
|
||||
/>
|
||||
{i === 0 && (
|
||||
<span className="absolute left-1.5 top-1.5 rounded-md bg-black/70 px-1.5 py-0.5 text-[0.7rem] font-semibold text-white">
|
||||
Okładka
|
||||
{t('coverBadge')}
|
||||
</span>
|
||||
)}
|
||||
<div className="flex items-center justify-between gap-1 bg-card p-1.5">
|
||||
{i === 0 ? (
|
||||
<span className="inline-flex items-center gap-1 text-[0.75rem] text-dim">
|
||||
<Star className="w-3.5 h-3.5 fill-accent text-accent-text" />
|
||||
okładka
|
||||
{t('coverLabel')}
|
||||
</span>
|
||||
) : (
|
||||
<button
|
||||
@@ -1307,13 +1307,13 @@ function GallerySection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
className="inline-flex items-center gap-1 text-[0.75rem] text-dim hover:text-accent-text cursor-pointer"
|
||||
>
|
||||
<Star className="w-3.5 h-3.5" />
|
||||
Ustaw jako okładkę
|
||||
{t('setCover')}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => remove(photo)}
|
||||
aria-label="Usuń zdjęcie"
|
||||
aria-label={t('removePhotoAria')}
|
||||
className="text-dim hover:text-danger cursor-pointer"
|
||||
>
|
||||
<X className="w-4 h-4" />
|
||||
@@ -1325,7 +1325,7 @@ function GallerySection({ gym, onChanged }: { gym: Gym; onChanged: () => void })
|
||||
<div className="mt-4 flex items-center gap-2">
|
||||
<label className="inline-flex cursor-pointer items-center gap-1.5 rounded-xl border border-line px-3 py-1.5 text-[0.85rem] font-semibold text-dim hover:text-accent-text hover:border-accent">
|
||||
<ImageIcon className="w-4 h-4" />
|
||||
{busy ? 'Wgrywanie…' : 'Dodaj zdjęcia'}
|
||||
{busy ? t('uploading') : t('addPhotos')}
|
||||
<input
|
||||
type="file"
|
||||
accept={PHOTO_MIME_TYPES.join(',')}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { api } from '../../api/client';
|
||||
import { BackButton, Button, Card, ErrorText, Field, H1, H3, Input } from '../../components/ui';
|
||||
import { UserPicker } from '../../components/UserPicker';
|
||||
import {
|
||||
AddressFields,
|
||||
addressPayload,
|
||||
isAddressComplete,
|
||||
} from '../../components/AddressFields';
|
||||
import { AddressFields, addressPayload, isAddressComplete } from '../../components/AddressFields';
|
||||
import { AvailabilityEditor } from '../../components/AvailabilityEditor';
|
||||
import { emptyAvailability } from '../../lib/availability';
|
||||
import { useAdminUsers } from '../users/user-queries';
|
||||
@@ -15,7 +12,8 @@ import type { Availability } from '../../api/types';
|
||||
import { useTopbar } from '../../topbar';
|
||||
|
||||
export default function GymForm() {
|
||||
useTopbar({ title: 'Siłownie', back: '/gyms' });
|
||||
const { t } = useTranslation('gyms');
|
||||
useTopbar({ title: t('common:nav.gyms'), back: '/gyms' });
|
||||
const navigate = useNavigate();
|
||||
const { data: usersData } = useAdminUsers();
|
||||
const [form, setForm] = useState({
|
||||
@@ -54,7 +52,7 @@ export default function GymForm() {
|
||||
});
|
||||
navigate(`/gyms/${data.gym.id}`);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -63,27 +61,27 @@ export default function GymForm() {
|
||||
return (
|
||||
<>
|
||||
<BackButton to="/gyms" className="mb-4" />
|
||||
<H1>Nowa siłownia</H1>
|
||||
<H1>{t('newGym')}</H1>
|
||||
<Card>
|
||||
<form onSubmit={submit}>
|
||||
<div className="grid grid-cols-1 gap-x-4 sm:grid-cols-2">
|
||||
<Field label="Nazwa">
|
||||
<Field label={t('nameLabel')}>
|
||||
<Input
|
||||
value={form.name}
|
||||
onChange={(e) => setForm({ ...form, name: e.target.value })}
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Właściciel">
|
||||
<Field label={t('owner')}>
|
||||
<UserPicker
|
||||
users={usersData?.users ?? []}
|
||||
value={form.ownerId}
|
||||
onChange={(ownerId) => setForm({ ...form, ownerId })}
|
||||
ariaLabel="Szukaj właściciela"
|
||||
emptyLabel={usersData ? 'Brak użytkowników' : 'Wczytywanie…'}
|
||||
ariaLabel={t('searchOwner')}
|
||||
emptyLabel={usersData ? t('noUsers') : t('loading')}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Ilość miejsc">
|
||||
<Field label={t('capacity')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={form.capacity}
|
||||
@@ -92,7 +90,7 @@ export default function GymForm() {
|
||||
</Field>
|
||||
</div>
|
||||
<div className="mb-2 mt-4 border-t border-line pt-4">
|
||||
<H3>Adres</H3>
|
||||
<H3>{t('addressSection')}</H3>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-x-4 sm:grid-cols-2">
|
||||
<AddressFields
|
||||
@@ -101,20 +99,16 @@ export default function GymForm() {
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<Field label="Dostępność">
|
||||
<Field label={t('availability')}>
|
||||
<AvailabilityEditor
|
||||
value={form.availability}
|
||||
onChange={(availability) => setForm({ ...form, availability })}
|
||||
/>
|
||||
</Field>
|
||||
{!form.ownerId && (
|
||||
<p className="mb-3 text-[0.875rem] text-dim">
|
||||
Wyznacz właściciela — otrzyma on rolę OWNER i dostęp do zarządzania siłownią.
|
||||
</p>
|
||||
)}
|
||||
{!form.ownerId && <p className="mb-3 text-[0.875rem] text-dim">{t('ownerHint')}</p>}
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
<Button type="submit" disabled={busy || !form.ownerId || !addressOk}>
|
||||
{busy ? 'Zapisywanie…' : 'Utwórz siłownię'}
|
||||
{busy ? t('common:saving') : t('create')}
|
||||
</Button>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { MapPin, Plus, Users, Building2, Dumbbell } from 'lucide-react';
|
||||
import { api } from '../../api/client';
|
||||
import type { Gym } from '../../api/types';
|
||||
import { Badge, Card, EmptyState, ErrorText, H3, Loading, MetaItem } from '../../components/ui';
|
||||
import { DAY_NAMES, formatDayRange, normalizeAvailability } from '../../lib/availability';
|
||||
import { dayShort, formatDayRange, normalizeAvailability } from '../../lib/availability';
|
||||
import { useListSearch } from '../../store/list-search';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { AuthImage } from '../../components/AuthImage';
|
||||
@@ -13,6 +14,7 @@ import { AuthImage } from '../../components/AuthImage';
|
||||
/* Karta siłowni 1:1 z widokiem z aplikacji (app/src/pages/gyms/Gyms.tsx):
|
||||
cover z badge'ami i „Otwórz →”, nazwa, meta z ikonami, pasek tygodnia z wyróżnionym „dziś”. */
|
||||
function GymCard({ gym }: { gym: Gym }) {
|
||||
const { t } = useTranslation('gyms');
|
||||
const navigate = useNavigate();
|
||||
const availability = normalizeAvailability(gym.availability);
|
||||
const todayIdx = (new Date().getDay() + 6) % 7;
|
||||
@@ -58,11 +60,11 @@ function GymCard({ gym }: { gym: Gym }) {
|
||||
className="absolute inset-0 bg-[linear-gradient(180deg,transparent_55%,rgb(0_0_0/0.45))]"
|
||||
/>
|
||||
<div className="absolute left-2.5 top-2.5 flex flex-wrap gap-1.5">
|
||||
{gym.kind === 'VIRTUAL' && <Badge color="blue">Wirtualna</Badge>}
|
||||
{gym.isPrivate && <Badge color="gray">Prywatna</Badge>}
|
||||
{gym.kind === 'VIRTUAL' && <Badge color="blue">{t('virtual')}</Badge>}
|
||||
{gym.isPrivate && <Badge color="gray">{t('private')}</Badge>}
|
||||
</div>
|
||||
<span className="absolute bottom-2.5 right-2.5 inline-flex items-center gap-1.5 rounded-full bg-black/35 px-2.5 py-1 text-[0.7rem] font-bold text-white backdrop-blur-sm">
|
||||
Otwórz →
|
||||
{t('open')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -76,9 +78,13 @@ function GymCard({ gym }: { gym: Gym }) {
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-1 text-dim text-[0.78rem]">
|
||||
<MetaItem icon={MapPin}>{gym.location || '—'}</MetaItem>
|
||||
<MetaItem icon={Users}>
|
||||
{gym.capacity != null ? `${members}/${gym.capacity} członków` : `${members} członków`}
|
||||
{gym.capacity != null
|
||||
? t('membersCapacity', { members, capacity: gym.capacity })
|
||||
: t('common:counters.members', { count: members })}
|
||||
</MetaItem>
|
||||
<MetaItem icon={Dumbbell}>
|
||||
{t('common:counters.devices', { count: gym.equipment.length })}
|
||||
</MetaItem>
|
||||
<MetaItem icon={Dumbbell}>{gym.equipment.length} urządzeń</MetaItem>
|
||||
</div>
|
||||
<div className="grid grid-cols-7 gap-0.5">
|
||||
{availability.map((day, i) => (
|
||||
@@ -93,7 +99,7 @@ function GymCard({ gym }: { gym: Gym }) {
|
||||
day ? 'text-accent-text' : 'text-dim/60'
|
||||
}`}
|
||||
>
|
||||
{DAY_NAMES[i]}
|
||||
{dayShort(i)}
|
||||
</div>
|
||||
<div
|
||||
className={`whitespace-nowrap text-[0.65rem] tabular-nums tracking-tight ${
|
||||
@@ -111,10 +117,11 @@ function GymCard({ gym }: { gym: Gym }) {
|
||||
}
|
||||
|
||||
export default function GymsList() {
|
||||
const { t } = useTranslation('gyms');
|
||||
useTopbar({
|
||||
title: 'Siłownie',
|
||||
title: t('common:nav.gyms'),
|
||||
search: 'gyms',
|
||||
actions: [{ label: 'Nowa siłownia', to: '/gyms/new', icon: Plus }],
|
||||
actions: [{ label: t('newGym'), to: '/gyms/new', icon: Plus }],
|
||||
});
|
||||
const { data, isLoading, error } = useQuery({
|
||||
queryKey: ['gyms'],
|
||||
@@ -139,12 +146,17 @@ export default function GymsList() {
|
||||
return (
|
||||
<>
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
{!isLoading && !error && filtered.length > 0 && (
|
||||
<>
|
||||
<div className="mb-3 flex items-center gap-2.5">
|
||||
<H3 className="mb-0">Wszystkie siłownie</H3>
|
||||
<H3 className="mb-0">{t('allGyms')}</H3>
|
||||
<Badge color="gray">{filtered.length}</Badge>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
@@ -159,12 +171,8 @@ export default function GymsList() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={Building2}
|
||||
title={query ? 'Brak wyników' : 'Brak siłowni'}
|
||||
description={
|
||||
query
|
||||
? 'Brak wyników dla podanego zapytania.'
|
||||
: 'Brak siłowni. Dodaj pierwszą przyciskiem „Nowa siłownia” w menu kontekstowym.'
|
||||
}
|
||||
title={query ? t('noResults') : t('noGymsTitle')}
|
||||
description={query ? t('noResultsDesc') : t('noGymsDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Ruler, Scale, TrendingDown, TrendingUp, type LucideIcon } from 'lucide-react';
|
||||
import {
|
||||
Area,
|
||||
@@ -24,6 +25,8 @@ import {
|
||||
} from '../../components/ui';
|
||||
import { MEASUREMENT_TYPES, type Gender, type Side } from '../../lib/body-measurements';
|
||||
import { useMeasurementLabels } from '../../lib/useMeasurementLabels';
|
||||
import i18n from '../../i18n';
|
||||
import { resolveLocaleTag } from '../../i18n/language';
|
||||
import { fmtDate } from '../../lib/format';
|
||||
import type { CircumferenceSeries } from '../../api/types';
|
||||
import { useAdminUser, useUserBodyParameters } from './user-queries';
|
||||
@@ -118,20 +121,25 @@ 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`;
|
||||
/* Pluralis dla „pomiar” (kategorie odpowiadające regułom PL). */
|
||||
function pomN(n: number, words: { one: string; few: string; many: string }): string {
|
||||
if (n === 1) return `${n} ${words.one}`;
|
||||
if (n % 10 >= 2 && n % 10 <= 4 && !(n % 100 >= 12 && n % 100 <= 14)) return `${n} ${words.few}`;
|
||||
return `${n} ${words.many}`;
|
||||
}
|
||||
|
||||
const WEIGHT_KEY = 'weight';
|
||||
|
||||
const fmtVal = (n: number) => n.toLocaleString('pl-PL', { maximumFractionDigits: 1 });
|
||||
const localeTag = () => resolveLocaleTag(i18n.language);
|
||||
|
||||
const fmtVal = (n: number) => n.toLocaleString(localeTag(), { 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. */
|
||||
function progressOf(g: { unit: 'kg' | 'cm'; points: GroupPoint[] }): {
|
||||
function progressOf(
|
||||
g: { unit: 'kg' | 'cm'; points: GroupPoint[] },
|
||||
changeText: (diff: string, unit: string) => string,
|
||||
): {
|
||||
text: string;
|
||||
className: string;
|
||||
} | null {
|
||||
@@ -139,7 +147,7 @@ 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: changeText(signed(d), g.unit), className };
|
||||
}
|
||||
|
||||
/* Osobny div postępu wybranej części: kierunek zmiany + wynik (strony osobno, gdy łączone). */
|
||||
@@ -148,11 +156,13 @@ function ProgressCard({
|
||||
primary,
|
||||
primaryClass,
|
||||
sub,
|
||||
title,
|
||||
}: {
|
||||
down: boolean;
|
||||
primary: string;
|
||||
primaryClass: string;
|
||||
sub: string;
|
||||
title: string;
|
||||
}) {
|
||||
const Icon = down ? TrendingDown : TrendingUp;
|
||||
return (
|
||||
@@ -162,7 +172,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">{title}</H3>
|
||||
<p className={`text-[0.95rem] font-semibold tabular-nums ${primaryClass}`}>{primary}</p>
|
||||
<p className="text-[0.8125rem] text-dim">{sub}</p>
|
||||
</div>
|
||||
@@ -173,7 +183,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(localeTag(), {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
...(withYear ? { year: '2-digit' } : {}),
|
||||
@@ -369,19 +379,26 @@ function PartSection({
|
||||
onShowMore: () => void;
|
||||
sideName: (side: Side) => string;
|
||||
}) {
|
||||
const { t } = useTranslation('users');
|
||||
const latest = points[points.length - 1];
|
||||
// historia przekracza rok → oś X z rokiem (również przy przerwie >12 mies. w jednym roku)
|
||||
const withYear =
|
||||
new Date(points[points.length - 1].date).getTime() - new Date(points[0].date).getTime() >
|
||||
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 prog = progressOf({ unit, points }, (diff, u) => t('changeSinceFirst', { diff, unit: u }));
|
||||
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('secondMeasurementHint')
|
||||
: t('firstToLast', {
|
||||
n: pomN(points.length, {
|
||||
one: t('measurementWordOne'),
|
||||
few: t('measurementWordFew'),
|
||||
many: t('measurementWordMany'),
|
||||
}),
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -410,6 +427,7 @@ function PartSection({
|
||||
primary={primary}
|
||||
primaryClass={primaryClass}
|
||||
sub={sub}
|
||||
title={t('progressWord')}
|
||||
/>
|
||||
|
||||
{points.length >= 2 ? (
|
||||
@@ -422,7 +440,7 @@ function PartSection({
|
||||
height={220}
|
||||
/>
|
||||
) : (
|
||||
<p className="text-dim">Za mało danych na wykres (min. 2 pomiary).</p>
|
||||
<p className="text-dim">{t('chartNotEnough')}</p>
|
||||
)}
|
||||
|
||||
{/* lista: najnowsze 3 + „Pokaż więcej" (kolejne 3); pełna historia w wykresie */}
|
||||
@@ -451,7 +469,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>
|
||||
@@ -465,6 +483,7 @@ function PartSection({
|
||||
* osobno). Pomiary dodaje i usuwa wyłącznie użytkownik — brak kontrolek edycji.
|
||||
*/
|
||||
export default function UserBodyParameters() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const { user } = useAdminUser(id);
|
||||
const { data: bp, isLoading: bpLoading, error: bpError } = useUserBodyParameters(id);
|
||||
@@ -475,7 +494,7 @@ export default function UserBodyParameters() {
|
||||
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
|
||||
title: user ? t('profileTitle', { name: userDisplayName(user) }) : t('profileFallback'),
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
});
|
||||
|
||||
@@ -548,17 +567,20 @@ export default function UserBodyParameters() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Parametry ciała"
|
||||
title={t('bodyParams')}
|
||||
actions={<BackButton to={id ? `/users/${id}` : '/users'} />}
|
||||
/>
|
||||
|
||||
{bpError ? (
|
||||
<ErrorText>Błąd: {(bpError as Error).message}</ErrorText>
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(bpError as Error).message}
|
||||
</ErrorText>
|
||||
) : active == null ? (
|
||||
<EmptyState
|
||||
icon={Scale}
|
||||
title="Brak pomiarów"
|
||||
description="Pomiary pojawią się tutaj, gdy użytkownik doda wagę lub obwód w aplikacji."
|
||||
title={t('bpNoMeasurements')}
|
||||
description={t('bpNoMeasurementsDesc')}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FileText } from 'lucide-react';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import {
|
||||
@@ -15,10 +16,10 @@ import { fmtDate } from '../../lib/format';
|
||||
import { useAdminUser, useUserClaims } from './user-queries';
|
||||
import { userDisplayName } from './UserDetail';
|
||||
|
||||
const STATUS_BADGE: Record<string, { label: string; color: 'green' | 'yellow' | 'red' }> = {
|
||||
PENDING: { label: 'Oczekuje', color: 'yellow' },
|
||||
APPROVED: { label: 'Zatwierdzony', color: 'green' },
|
||||
REJECTED: { label: 'Odrzucony', color: 'red' },
|
||||
const STATUS_BADGE: Record<string, { labelKey: string; color: 'green' | 'yellow' | 'red' }> = {
|
||||
PENDING: { labelKey: 'claimStatusPending', color: 'yellow' },
|
||||
APPROVED: { labelKey: 'claimStatusApproved', color: 'green' },
|
||||
REJECTED: { labelKey: 'claimStatusRejected', color: 'red' },
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -26,11 +27,12 @@ const STATUS_BADGE: Record<string, { label: string; color: 'green' | 'yellow' |
|
||||
* zapadają na stronie Weryfikacje). Dodatek admina do profilu użytkownika.
|
||||
*/
|
||||
export default function UserClaims() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const { user } = useAdminUser(id);
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
|
||||
title: user ? t('profileTitle', { name: userDisplayName(user) }) : t('profileFallback'),
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
});
|
||||
const { data, isLoading, error } = useUserClaims(id);
|
||||
@@ -49,7 +51,7 @@ export default function UserClaims() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Wnioski"
|
||||
title={t('claims')}
|
||||
actions={
|
||||
<>
|
||||
{claims.length > 0 && <Badge>{claims.length}</Badge>}
|
||||
@@ -59,13 +61,14 @@ export default function UserClaims() {
|
||||
/>
|
||||
|
||||
<Card>
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
{!error && claims.length === 0 && (
|
||||
<EmptyState
|
||||
icon={FileText}
|
||||
title="Brak wniosków"
|
||||
description="Użytkownik nie złożył jeszcze żadnych wniosków o siłownię."
|
||||
/>
|
||||
<EmptyState icon={FileText} title={t('noClaimsTitle')} description={t('noClaimsDesc')} />
|
||||
)}
|
||||
{!error && claims.length > 0 && (
|
||||
<div className="divide-y divide-line">
|
||||
@@ -76,22 +79,25 @@ export default function UserClaims() {
|
||||
<ListRow
|
||||
key={c.id}
|
||||
title={name}
|
||||
meta={`${c.type === 'new' ? 'Nowa siłownia' : 'Weryfikacja'} · złożono ${fmtDate(c.createdAt)}`}
|
||||
meta={`${c.type === 'new' ? t('typeNew') : t('typeVerification')} · ${t('submittedOn', { date: fmtDate(c.createdAt) })}`}
|
||||
actions={
|
||||
<Link
|
||||
to={`/verifications/${c.id}`}
|
||||
className="text-accent-text text-[0.875rem] font-semibold hover:underline"
|
||||
>
|
||||
Szczegóły
|
||||
{t('details')}
|
||||
</Link>
|
||||
}
|
||||
>
|
||||
<div className="flex flex-wrap items-center gap-1.5 pt-1">
|
||||
<Badge color={st?.color ?? 'gray'}>{st?.label ?? c.status}</Badge>
|
||||
<Badge color={st?.color ?? 'gray'}>{st ? t(st.labelKey) : c.status}</Badge>
|
||||
{c.documentCount != null && <Badge color="gray">{c.documentCount}</Badge>}
|
||||
</div>
|
||||
{c.status === 'REJECTED' && c.rejectReason && (
|
||||
<p className="mt-1.5 text-[0.875rem] text-danger">Powód: {c.rejectReason}</p>
|
||||
<p className="mt-1.5 text-[0.875rem] text-danger">
|
||||
{t('reasonPrefix')}
|
||||
{c.rejectReason}
|
||||
</p>
|
||||
)}
|
||||
</ListRow>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
Ban,
|
||||
Building2,
|
||||
@@ -19,7 +20,7 @@ import { useTopbar } from '../../topbar';
|
||||
import { api } from '../../api/client';
|
||||
import { BackButton, Badge, Card, ConfirmDialog, ErrorText, Loading } from '../../components/ui';
|
||||
import { Avatar } from '../../components/Avatar';
|
||||
import { displayName, fmtDate, fmtVolume } from '../../lib/format';
|
||||
import { displayName, fmtDate, fmtDateTime, fmtVolume } from '../../lib/format';
|
||||
import { UserRestrictionModal } from './UserRestrictionModal';
|
||||
import {
|
||||
useAdminUser,
|
||||
@@ -40,12 +41,12 @@ export function userDisplayName(u: {
|
||||
return displayName(u) === '—' ? u.email : displayName(u);
|
||||
}
|
||||
|
||||
function sessionCountLabel(n: number) {
|
||||
function sessionCountLabel(n: number, words: { one: string; few: string; many: string }): string {
|
||||
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`;
|
||||
if (mod10 === 1 && mod100 !== 11) return `${n} ${words.one}`;
|
||||
if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) return `${n} ${words.few}`;
|
||||
return `${n} ${words.many}`;
|
||||
}
|
||||
|
||||
/** Mini-statystyka: ikona + etykieta + wartość. */
|
||||
@@ -107,6 +108,7 @@ function SectionLink({
|
||||
* Struktura wzorowana na profilu z aplikacji (`/profile`) z dodatkami admina.
|
||||
*/
|
||||
export default function UserDetail() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const { user, isLoading, error } = useAdminUser(id);
|
||||
@@ -122,26 +124,32 @@ export default function UserDetail() {
|
||||
|
||||
// Menu trzyma tylko akcje (edycja/kary/usunięcie); nawigacja do podstron = wiersze w treści.
|
||||
useTopbar({
|
||||
title: user ? userDisplayName(user) : 'Użytkownik',
|
||||
title: user ? userDisplayName(user) : t('userFallback'),
|
||||
back: '/users',
|
||||
actions: user
|
||||
? [
|
||||
{ label: 'Edytuj', icon: Pencil, to: `/users/${user.id}/edit` },
|
||||
{ label: 'Zawieś', icon: Pause, onClick: () => setRestriction('SUSPENDED') },
|
||||
{ label: t('common:edit'), icon: Pencil, to: `/users/${user.id}/edit` },
|
||||
{ label: t('suspend'), icon: Pause, onClick: () => setRestriction('SUSPENDED') },
|
||||
{
|
||||
label: 'Zbanuj',
|
||||
label: t('ban'),
|
||||
icon: Ban,
|
||||
variant: 'danger',
|
||||
onClick: () => setRestriction('BANNED'),
|
||||
},
|
||||
{ label: 'Usuń', variant: 'danger', onClick: () => setConfirmOpen(true) },
|
||||
{ label: t('common:remove'), variant: 'danger', onClick: () => setConfirmOpen(true) },
|
||||
]
|
||||
: [],
|
||||
});
|
||||
|
||||
if (isLoading) return <Loading />;
|
||||
if (error) return <ErrorText>Błąd: {(error as Error).message}</ErrorText>;
|
||||
if (!user) return <ErrorText>Nie znaleziono użytkownika.</ErrorText>;
|
||||
if (error)
|
||||
return (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
);
|
||||
if (!user) return <ErrorText>{t('notFound')}</ErrorText>;
|
||||
|
||||
const remove = async () => {
|
||||
setBusy(true);
|
||||
@@ -149,7 +157,7 @@ export default function UserDetail() {
|
||||
await api(`/admin/users/${user.id}`, { method: 'DELETE' });
|
||||
navigate('/users');
|
||||
} catch (err) {
|
||||
setRemoveError(err instanceof Error ? err.message : 'Błąd');
|
||||
setRemoveError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -162,8 +170,8 @@ export default function UserDetail() {
|
||||
const weightPoints = [...(bp?.weight ?? [])].sort((a, b) => a.date.localeCompare(b.date));
|
||||
const latestWeight = weightPoints[weightPoints.length - 1];
|
||||
const weightSummary = latestWeight
|
||||
? `${latestWeight.value} kg · ${fmtDate(latestWeight.date)}`
|
||||
: 'brak pomiarów';
|
||||
? t('weightSummary', { value: latestWeight.value, date: fmtDate(latestWeight.date) })
|
||||
: t('noMeasurements');
|
||||
|
||||
// sesje: liczba + ostatnia data + objętość z ostatnich 7 dni (Σ planowane kg × powt.)
|
||||
const sessions = hist?.sessions ?? [];
|
||||
@@ -173,8 +181,12 @@ export default function UserDetail() {
|
||||
);
|
||||
const historySummary =
|
||||
sessions.length > 0
|
||||
? `${sessionCountLabel(sessions.length)} · ostatnia ${fmtDate(lastSession!)}`
|
||||
: 'brak sesji';
|
||||
? `${sessionCountLabel(sessions.length, {
|
||||
one: t('sessionsWordOne'),
|
||||
few: t('sessionsWordFew'),
|
||||
many: t('sessionsWordMany'),
|
||||
})} · ${t('lastSession', { date: fmtDate(lastSession!) })}`
|
||||
: t('noSessions');
|
||||
const weekAgo = Date.now() - 7 * 24 * 3600 * 1000;
|
||||
const volume7d = sessions
|
||||
.filter((s) => new Date(s.startedAt).getTime() >= weekAgo)
|
||||
@@ -189,28 +201,28 @@ export default function UserDetail() {
|
||||
const gymsSummary =
|
||||
memberships.length > 0
|
||||
? memberships.map((m) => `${m.gym.name} (${m.roles.join(', ')})`).join(', ')
|
||||
: 'brak';
|
||||
: 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('pendingClaims', { count: pendingClaims })
|
||||
: t('resolvedClaims', { count: claims.length });
|
||||
|
||||
const progressCount = (progressData?.exercises ?? []).length;
|
||||
const progressSummary =
|
||||
progressCount > 0
|
||||
? `${progressCount} ${
|
||||
progressCount === 1
|
||||
? 'ćwiczenie'
|
||||
? t('exercisesWordOne')
|
||||
: progressCount < 5 && progressCount % 10 >= 2 && progressCount % 10 <= 4
|
||||
? 'ćwiczenia'
|
||||
: 'ćwiczeń'
|
||||
? t('exercisesWordFew')
|
||||
: t('exercisesWordMany')
|
||||
}`
|
||||
: 'brak danych';
|
||||
: t('noData');
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -228,36 +240,40 @@ export default function UserDetail() {
|
||||
</div>
|
||||
<div className="truncate text-dim text-[0.8125rem]">{user.email}</div>
|
||||
<div className="text-[0.75rem] text-dim">
|
||||
Utworzony {new Date(user.createdAt).toLocaleDateString('pl-PL')}
|
||||
{t('createdOn', { date: fmtDate(user.createdAt) })}
|
||||
</div>
|
||||
</div>
|
||||
<span className="flex flex-wrap items-center gap-1.5">
|
||||
{user.status === 'SUSPENDED' && (
|
||||
<Badge color="yellow">
|
||||
Zawieszone
|
||||
{user.suspensionUntil
|
||||
? ` do ${new Intl.DateTimeFormat('pl-PL', { dateStyle: 'medium', timeStyle: 'short' }).format(new Date(user.suspensionUntil))}`
|
||||
: ''}
|
||||
{t('statusSuspended')}
|
||||
{user.suspensionUntil ? t('until', { dt: fmtDateTime(user.suspensionUntil) }) : ''}
|
||||
</Badge>
|
||||
)}
|
||||
{user.status === 'BANNED' && <Badge color="red">Zablokowane</Badge>}
|
||||
{user.status === 'BANNED' && <Badge color="red">{t('statusBanned')}</Badge>}
|
||||
{user.nickname && <Badge color="blue">@{user.nickname}</Badge>}
|
||||
{user.isAdmin && <Badge color="blue">Admin</Badge>}
|
||||
{memberships.length > 0 && <Badge color="gray">{memberships.length} sił.</Badge>}
|
||||
{user.isAdmin && <Badge color="blue">{t('adminBadge')}</Badge>}
|
||||
{memberships.length > 0 && (
|
||||
<Badge color="gray">{t('gymsShort', { count: memberships.length })}</Badge>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Pasek mini-statystyk: 2 na mobile, 3 w rzędzie na desktop */}
|
||||
<div className="mb-4 grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
<MiniStat icon={Flame} label="Killstreak" value={ks ? String(ks.killstreak) : '—'} />
|
||||
<MiniStat
|
||||
icon={Flame}
|
||||
label={t('statKillstreak')}
|
||||
value={ks ? String(ks.killstreak) : '—'}
|
||||
/>
|
||||
<MiniStat
|
||||
icon={Dumbbell}
|
||||
label="Objętość 7 dni"
|
||||
label={t('statVolume7d')}
|
||||
value={volume7d > 0 ? fmtVolume(volume7d) : '—'}
|
||||
/>
|
||||
<MiniStat
|
||||
icon={History}
|
||||
label="Sesje"
|
||||
label={t('statSessions')}
|
||||
value={sessions.length > 0 ? String(sessions.length) : '—'}
|
||||
/>
|
||||
</div>
|
||||
@@ -268,26 +284,26 @@ export default function UserDetail() {
|
||||
<div className="divide-y divide-line">
|
||||
<SectionLink
|
||||
to={`/users/${user.id}/info`}
|
||||
title="Dane osobowe"
|
||||
title={t('personalInfo')}
|
||||
icon={User}
|
||||
summary={
|
||||
[
|
||||
user.age != null ? `${user.age} lat` : null,
|
||||
user.age != null ? t('ageValue', { age: user.age }) : null,
|
||||
user.heightCm != null ? `${user.heightCm} cm` : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ') || 'brak danych'
|
||||
.join(' · ') || t('noData')
|
||||
}
|
||||
/>
|
||||
<SectionLink
|
||||
to={`/users/${user.id}/body-parameters`}
|
||||
title="Parametry ciała"
|
||||
title={t('bodyParams')}
|
||||
icon={Scale}
|
||||
summary={weightSummary}
|
||||
/>
|
||||
<SectionLink
|
||||
to={`/users/${user.id}/history`}
|
||||
title="Historia treningów"
|
||||
title={t('trainingHistory')}
|
||||
icon={History}
|
||||
summary={historySummary}
|
||||
/>
|
||||
@@ -295,19 +311,19 @@ export default function UserDetail() {
|
||||
<div className="divide-y divide-line">
|
||||
<SectionLink
|
||||
to={`/users/${user.id}/progress`}
|
||||
title="Postępy"
|
||||
title={t('progress')}
|
||||
icon={TrendingUp}
|
||||
summary={progressSummary}
|
||||
/>
|
||||
<SectionLink
|
||||
to={`/users/${user.id}/memberships`}
|
||||
title="Członkostwa w siłowniach"
|
||||
title={t('membershipsTitle')}
|
||||
icon={Building2}
|
||||
summary={gymsSummary}
|
||||
/>
|
||||
<SectionLink
|
||||
to={`/users/${user.id}/claims`}
|
||||
title="Wnioski"
|
||||
title={t('claims')}
|
||||
icon={FileText}
|
||||
summary={claimsSummary}
|
||||
/>
|
||||
@@ -319,9 +335,9 @@ export default function UserDetail() {
|
||||
open={confirmOpen}
|
||||
onClose={() => setConfirmOpen(false)}
|
||||
onConfirm={() => void remove()}
|
||||
title="Usunąć użytkownika?"
|
||||
description="Jego plany i sesje zostaną usunięte. Tej operacji nie da się cofnąć."
|
||||
confirmLabel="Usuń"
|
||||
title={t('deleteConfirmTitle')}
|
||||
description={t('deleteConfirmDesc')}
|
||||
confirmLabel={t('common:remove')}
|
||||
danger
|
||||
busy={busy}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Building2, Check, ChevronDown, ShieldCheck, Trash2, UserPlus } from 'lucide-react';
|
||||
import { api } from '../../api/client';
|
||||
import type { Gym, GymRole, User } from '../../api/types';
|
||||
@@ -35,11 +36,11 @@ let rowSeq = 0;
|
||||
const nextKey = () => ++rowSeq;
|
||||
|
||||
/** Wyjaśnienie roli administratora — rozwijane, żeby nie zaśmiecać formularza. */
|
||||
function AdminExplain({ open }: { open: boolean }) {
|
||||
function AdminExplain({ open, items }: { open: boolean; items: string[] }) {
|
||||
if (!open) return null;
|
||||
return (
|
||||
<ul className="mb-2 mt-1.5 space-y-0.5 rounded-xl border border-line bg-input/40 px-3 py-2 text-[0.875rem] text-dim">
|
||||
{ADMIN_ROLE_META.grants.map((g) => (
|
||||
{items.map((g) => (
|
||||
<li key={g} className="flex gap-1.5">
|
||||
<span className="text-accent-text">•</span>
|
||||
<span>{g}</span>
|
||||
@@ -57,6 +58,7 @@ function AdminExplain({ open }: { open: boolean }) {
|
||||
* nadaje się z menu kontekstowego strony użytkownika (UserRestrictionModal).
|
||||
*/
|
||||
export default function UserForm() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const isEdit = Boolean(id);
|
||||
const navigate = useNavigate();
|
||||
@@ -72,11 +74,11 @@ export default function UserForm() {
|
||||
};
|
||||
|
||||
useTopbar({
|
||||
title: isEdit ? 'Edycja użytkownika' : 'Nowy użytkownik',
|
||||
title: isEdit ? t('editUser') : t('newUser'),
|
||||
back: isEdit && id ? `/users/${id}` : '/users',
|
||||
actions: [
|
||||
{
|
||||
label: busy ? 'Zapisywanie…' : 'Zapisz',
|
||||
label: busy ? t('common:saving') : t('common:save'),
|
||||
icon: Check,
|
||||
onClick: submitFromMenu,
|
||||
disabled: busy,
|
||||
@@ -152,12 +154,11 @@ export default function UserForm() {
|
||||
}, [rows, user, isEdit]);
|
||||
|
||||
const validate = (): string => {
|
||||
if (!isEdit && !form.email.trim()) return 'Podaj adres e-mail.';
|
||||
if (!isEdit && form.password.length < 8) return 'Hasło musi mieć co najmniej 8 znaków.';
|
||||
if (isEdit && form.password && form.password.length < 8)
|
||||
return 'Nowe hasło musi mieć co najmniej 8 znaków.';
|
||||
if (!isEdit && !form.email.trim()) return t('emailRequired');
|
||||
if (!isEdit && form.password.length < 8) return t('passMin8');
|
||||
if (isEdit && form.password && form.password.length < 8) return t('newPassMin8');
|
||||
// w edycji oba pola mogą zostać puste (bez zmiany hasła); w tworzeniu muszą się zgadzać
|
||||
if (form.password !== form.password2) return 'Podane hasła muszą być takie same.';
|
||||
if (form.password !== form.password2) return t('passMismatch');
|
||||
return '';
|
||||
};
|
||||
|
||||
@@ -165,12 +166,12 @@ export default function UserForm() {
|
||||
const validateRows = (): string => {
|
||||
for (const r of rows) {
|
||||
if (r.gymId && r.roles.length === 0) {
|
||||
const name = gyms.find((g) => g.id === r.gymId)?.name ?? 'tego';
|
||||
return `Nie wolno dodać kogoś do siłowni bez roli. Zaznacz rolę dla „${name}” albo usuń ten wiersz.`;
|
||||
const name = gyms.find((g) => g.id === r.gymId)?.name ?? t('fallbackThis');
|
||||
return t('roleNoGym', { name });
|
||||
}
|
||||
if (!r.gymId && r.roles.length > 0) {
|
||||
const labels = r.roles.map((x) => GYM_ROLE_META[x].label).join(', ');
|
||||
return `Role (${labels}) wymagają wybranej siłowni. Wybierz siłownię albo odznacz role.`;
|
||||
const labels = r.roles.map((x) => t(`common:${GYM_ROLE_META[x].labelKey}`)).join(', ');
|
||||
return t('rolesNeedGym', { labels });
|
||||
}
|
||||
}
|
||||
return '';
|
||||
@@ -253,7 +254,7 @@ export default function UserForm() {
|
||||
}
|
||||
navigate(`/users/${id}`);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd');
|
||||
setError(err instanceof Error ? err.message : t('common:error'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -275,22 +276,22 @@ export default function UserForm() {
|
||||
<span className="grid h-7 w-7 place-items-center rounded-full bg-accent/10 text-[0.8rem] font-bold text-accent-text">
|
||||
1
|
||||
</span>
|
||||
<H3 className="mb-0">Dane</H3>
|
||||
<H3 className="mb-0">{t('stepData')}</H3>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-x-4 sm:grid-cols-2">
|
||||
<Field label="Imię">
|
||||
<Field label={t('firstName')}>
|
||||
<Input
|
||||
value={form.firstName}
|
||||
onChange={(e) => setForm({ ...form, firstName: e.target.value })}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nazwisko">
|
||||
<Field label={t('lastName')}>
|
||||
<Input
|
||||
value={form.lastName}
|
||||
onChange={(e) => setForm({ ...form, lastName: e.target.value })}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={isEdit ? 'Nowe hasło (opcjonalnie)' : 'Hasło (min. 8)'}>
|
||||
<Field label={isEdit ? t('newPasswordOpt') : t('passwordMin8')}>
|
||||
<Input
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
@@ -301,7 +302,7 @@ export default function UserForm() {
|
||||
placeholder={isEdit ? '••••••••' : undefined}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={isEdit ? 'Powtórz nowe hasło' : 'Powtórz hasło'}>
|
||||
<Field label={isEdit ? t('repeatNewPassword') : t('repeatPassword')}>
|
||||
<Input
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
@@ -312,7 +313,7 @@ export default function UserForm() {
|
||||
placeholder={isEdit ? '••••••••' : undefined}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="E-mail">
|
||||
<Field label={t('auth:email')}>
|
||||
<Input
|
||||
type="email"
|
||||
value={form.email}
|
||||
@@ -320,7 +321,7 @@ export default function UserForm() {
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Wiek">
|
||||
<Field label={t('age')}>
|
||||
<Input
|
||||
type="number"
|
||||
value={form.age}
|
||||
@@ -336,7 +337,7 @@ export default function UserForm() {
|
||||
<span className="grid h-7 w-7 place-items-center rounded-full bg-accent/10 text-[0.8rem] font-bold text-accent-text">
|
||||
2
|
||||
</span>
|
||||
<H3 className="mb-0">Role</H3>
|
||||
<H3 className="mb-0">{t('stepRoles')}</H3>
|
||||
</div>
|
||||
|
||||
{/* Rola administratora platformy */}
|
||||
@@ -352,23 +353,28 @@ export default function UserForm() {
|
||||
<span className="min-w-0">
|
||||
<span className="flex items-center gap-1.5 text-[0.95rem] font-semibold">
|
||||
<ShieldCheck className="h-4 w-4 text-accent-text" />
|
||||
Administrator platformy
|
||||
{t('adminPlatformTitle')}
|
||||
</span>
|
||||
<span className="block text-[0.8125rem] text-dim">
|
||||
{t(`common:${ADMIN_ROLE_META.summaryKey}`)}
|
||||
</span>
|
||||
<span className="block text-[0.8125rem] text-dim">{ADMIN_ROLE_META.summary}</span>
|
||||
</span>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAdminExplain((v) => !v)}
|
||||
className="shrink-0 cursor-pointer p-1 text-dim hover:text-ink"
|
||||
aria-label={adminExplain ? 'Zwiń uprawnienia admina' : 'Pokaż uprawnienia admina'}
|
||||
aria-label={adminExplain ? t('ariaHideAdmin') : t('ariaShowAdmin')}
|
||||
>
|
||||
<ChevronDown
|
||||
className={`h-4 w-4 transition-transform ${adminExplain ? 'rotate-180' : ''}`}
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<AdminExplain open={adminExplain} />
|
||||
<AdminExplain
|
||||
open={adminExplain}
|
||||
items={ADMIN_ROLE_META.grantKeys.map((k) => t(`common:${k}`))}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@@ -379,7 +385,7 @@ export default function UserForm() {
|
||||
{isEdit ? 4 : 3}
|
||||
</span>
|
||||
<div className="flex min-w-0 flex-1 items-center justify-between gap-3">
|
||||
<H3 className="mb-0">Członkostwa w siłowniach</H3>
|
||||
<H3 className="mb-0">{t('membershipsTitle')}</H3>
|
||||
{filledCount > 0 && <Badge>{filledCount}</Badge>}
|
||||
</div>
|
||||
</div>
|
||||
@@ -387,14 +393,11 @@ export default function UserForm() {
|
||||
{rows.length === 0 ? (
|
||||
<div className="rounded-xl border border-dashed border-line px-4 py-8 text-center">
|
||||
<Building2 className="mx-auto h-7 w-7 text-dim" aria-hidden />
|
||||
<p className="mt-2 text-[0.95rem] font-semibold">Jeszcze bez siłowni</p>
|
||||
<p className="mx-auto mt-1 max-w-md text-[0.875rem] text-dim">
|
||||
Dodaj pierwszą siłownię i zaznacz rolę — członkostwa nadajesz i zmieniasz tylko
|
||||
tutaj.
|
||||
</p>
|
||||
<p className="mt-2 text-[0.95rem] font-semibold">{t('noGymsYet')}</p>
|
||||
<p className="mx-auto mt-1 max-w-md text-[0.875rem] text-dim">{t('noGymsYetDesc')}</p>
|
||||
<Button type="button" variant="secondary" size="sm" onClick={addRow} className="mt-4">
|
||||
<UserPlus className="h-4 w-4" />
|
||||
Dodaj pierwszą siłownię
|
||||
{t('addFirstGym')}
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
@@ -410,13 +413,17 @@ export default function UserForm() {
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => removeRow(r.key)}
|
||||
aria-label={gym ? `Usuń ${gym.name}` : `Usuń siłownię ${i + 1}`}
|
||||
aria-label={
|
||||
gym
|
||||
? t('removeGymAria', { name: gym.name })
|
||||
: t('removeGymRowAria', { n: i + 1 })
|
||||
}
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
<div>
|
||||
<Label>Siłownia</Label>
|
||||
<Label>{t('gymLabel')}</Label>
|
||||
<GymPicker
|
||||
gyms={gymsFor(r.key)}
|
||||
value={r.gymId}
|
||||
@@ -424,11 +431,11 @@ export default function UserForm() {
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label>Role</Label>
|
||||
<Label>{t('stepRoles')}</Label>
|
||||
<GymRolePicker
|
||||
value={r.roles}
|
||||
onChange={(roles) => updateRow(r.key, { roles })}
|
||||
labelPrefix={gym?.name ?? `siłownia ${i + 1}`}
|
||||
labelPrefix={gym?.name ?? t('gymFallback', { n: i + 1 })}
|
||||
minRoles={0}
|
||||
/>
|
||||
</div>
|
||||
@@ -439,7 +446,7 @@ export default function UserForm() {
|
||||
|
||||
<Button type="button" variant="secondary" size="sm" onClick={addRow} className="mt-3">
|
||||
<UserPlus className="h-4 w-4" />
|
||||
Dodaj kolejną siłownię
|
||||
{t('addNextGym')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
@@ -449,10 +456,10 @@ export default function UserForm() {
|
||||
</form>
|
||||
|
||||
{/* zapis wzbroniony, dopóki wiersz członkostwa jest niekompletny */}
|
||||
<Modal open={rowError !== null} onClose={() => setRowError(null)} title="Nie można zapisać">
|
||||
<Modal open={rowError !== null} onClose={() => setRowError(null)} title={t('cannotSave')}>
|
||||
<p className="text-[0.95rem] text-dim">{rowError}</p>
|
||||
<div className="mt-5 flex justify-end">
|
||||
<Button onClick={() => setRowError(null)}>Rozumiem</Button>
|
||||
<Button onClick={() => setRowError(null)}>{t('understand')}</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { useParams, useSearchParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { History } from 'lucide-react';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { MonthPickerCore } from '../../topbar/MonthPicker';
|
||||
@@ -13,6 +14,7 @@ import HistoryTable from '../../components/HistoryTable';
|
||||
* Układ wzorowany na `/profile/history` z aplikacji.
|
||||
*/
|
||||
export default function UserHistory() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const { user } = useAdminUser(id);
|
||||
const [params] = useSearchParams();
|
||||
@@ -31,7 +33,7 @@ export default function UserHistory() {
|
||||
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
|
||||
title: user ? t('profileTitle', { name: userDisplayName(user) }) : t('profileFallback'),
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
dateFilter: (
|
||||
<MonthPickerCore
|
||||
@@ -60,21 +62,22 @@ export default function UserHistory() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Historia treningów"
|
||||
title={t('trainingHistory')}
|
||||
actions={<BackButton to={id ? `/users/${id}` : '/users'} />}
|
||||
/>
|
||||
|
||||
<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 odznacz filtr, aby zobaczyć pełną historię.'
|
||||
: 'Użytkownik nie ma jeszcze żadnych sesji treningowych.'
|
||||
}
|
||||
title={month ? t('noSessionsMonthTitle') : t('noSessionsTitle')}
|
||||
description={month ? t('noSessionsMonthDesc') : t('noSessionsDesc')}
|
||||
/>
|
||||
)}
|
||||
{!error && sessions.length > 0 && (
|
||||
|
||||
@@ -32,7 +32,8 @@ import {
|
||||
Skeleton,
|
||||
} from '../../components/ui';
|
||||
import { Avatar } from '../../components/Avatar';
|
||||
import { MUSCLE_COLORS, MUSCLE_NAMES, SOCIAL_MEDIA_LABELS } from '../../lib/labels';
|
||||
import { MUSCLE_COLORS, muscleName, SOCIAL_MEDIA_LABELS } from '../../lib/labels';
|
||||
import { fmtDate } from '../../lib/format';
|
||||
import { localizedName } from '../../lib/localizedName';
|
||||
import { formatAvailabilityParts } from '../../lib/availability';
|
||||
import { useAdminUser } from './user-queries';
|
||||
@@ -48,32 +49,32 @@ 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: {
|
||||
badge: 'blue',
|
||||
text: 'text-info',
|
||||
tint: 'border-info/40 bg-info/10',
|
||||
dot: 'bg-info',
|
||||
label: 'Co potrafi',
|
||||
chainPrefix: '',
|
||||
labelKey: 'toneCanDo',
|
||||
chainPrefixKey: '',
|
||||
},
|
||||
difficult: {
|
||||
badge: 'yellow',
|
||||
text: 'text-warn',
|
||||
tint: 'border-warn/40 bg-warn/10',
|
||||
dot: 'bg-warn',
|
||||
label: 'Co trudne',
|
||||
chainPrefix: '',
|
||||
labelKey: 'toneDifficult',
|
||||
chainPrefixKey: '',
|
||||
},
|
||||
avoid: {
|
||||
badge: 'red',
|
||||
text: 'text-danger',
|
||||
tint: 'border-danger/40 bg-danger/10',
|
||||
dot: 'bg-danger',
|
||||
label: 'Co unikać',
|
||||
chainPrefix: 'unikamy: ',
|
||||
labelKey: 'toneAvoid',
|
||||
chainPrefixKey: 'chainPrefixAvoid',
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -130,8 +131,11 @@ function hostOf(url: string): string {
|
||||
}
|
||||
|
||||
function SocialTile({ entry }: { entry: SocialMediaEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const label =
|
||||
entry.platform === 'OTHER' ? entry.label || 'Inne' : SOCIAL_MEDIA_LABELS[entry.platform];
|
||||
entry.platform === 'OTHER'
|
||||
? entry.label || t('socialMedia.OTHER')
|
||||
: SOCIAL_MEDIA_LABELS[entry.platform];
|
||||
const brand = SOCIAL_BRAND[entry.platform];
|
||||
return (
|
||||
<a
|
||||
@@ -160,54 +164,54 @@ function SocialTile({ entry }: { entry: SocialMediaEntry }) {
|
||||
/* 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 { t, i18n } = useTranslation('users');
|
||||
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 priorytetó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 toneMeta = 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 ? toneMeta.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 ? toneMeta.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 ? toneMeta.text : 'text-dim'
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
{t(toneMeta.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) => (
|
||||
<div key={e.muscle}>
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge color={MUSCLE_COLORS[e.muscle] ?? 'gray'}>
|
||||
{MUSCLE_NAMES[e.muscle] ?? localizedName(e, i18n.language)}
|
||||
{muscleName(e.muscle) || localizedName(e, i18n.language)}
|
||||
</Badge>
|
||||
{(e.exercises ?? []).length > 0 && (
|
||||
<span className="text-[0.75rem] font-bold tabular-nums text-dim">
|
||||
@@ -217,8 +221,12 @@ 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'}
|
||||
? `${toneMeta.chainPrefixKey ? t(toneMeta.chainPrefixKey) : ''}${(
|
||||
e.exercises ?? []
|
||||
)
|
||||
.map((x) => localizedName(x, i18n.language))
|
||||
.join(', ')}`
|
||||
: t('chainNotInPlan')}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -252,8 +260,8 @@ function InfoRow({ label, value }: { label: string; value: string }) {
|
||||
* Karta „Konto” (e-mail, admin, data utworzenia) to dodatek admina.
|
||||
*/
|
||||
export default function UserInfo() {
|
||||
const { t, i18n } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const { i18n } = useTranslation();
|
||||
const { user, isLoading } = useAdminUser(id);
|
||||
const { data: areasData } = useQuery({
|
||||
queryKey: ['focus-areas'],
|
||||
@@ -272,7 +280,7 @@ export default function UserInfo() {
|
||||
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
|
||||
title: user ? t('profileTitle', { name: userDisplayName(user) }) : t('profileFallback'),
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
});
|
||||
|
||||
@@ -292,40 +300,47 @@ export default function UserInfo() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Dane osobowe"
|
||||
title={t('personalInfo')}
|
||||
leading={<Avatar name={name} size={40} />}
|
||||
actions={<BackButton to={`/users/${user.id}`} />}
|
||||
/>
|
||||
|
||||
{/* Karta: konto (stan konta — edycja w wizardzie); dodatek admina */}
|
||||
<Card>
|
||||
<SectionHeader title="Konto" />
|
||||
<SectionHeader title={t('accountCard')} />
|
||||
<div className="divide-y divide-line">
|
||||
<InfoRow label="E-mail" value={user.email} />
|
||||
<InfoRow label="Administrator" value={user.isAdmin ? 'Pełny dostęp' : 'Brak'} />
|
||||
<InfoRow label="Utworzony" value={new Date(user.createdAt).toLocaleDateString('pl-PL')} />
|
||||
<InfoRow label={t('auth:email')} value={user.email} />
|
||||
<InfoRow
|
||||
label={t('common:roles.admin.label')}
|
||||
value={user.isAdmin ? t('fullAccess') : t('accountNone')}
|
||||
/>
|
||||
<InfoRow label={t('createdLabel')} value={fmtDate(user.createdAt)} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{/* Karta 1: podstawowe dane — siatka płytek z ikonami + dostępność jako chipy */}
|
||||
<Card>
|
||||
<SectionHeader title="Podstawowe dane" />
|
||||
<SectionHeader title={t('basicData')} />
|
||||
<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('firstName')} value={user.firstName || '—'} />
|
||||
<InfoTile icon={User} label={t('lastName')} value={user.lastName || '—'} />
|
||||
<InfoTile
|
||||
icon={Cake}
|
||||
label={t('age')}
|
||||
value={user.age != null ? t('ageValue', { age: user.age }) : '—'}
|
||||
/>
|
||||
<InfoTile
|
||||
icon={Ruler}
|
||||
label="Wzrost"
|
||||
label={t('height')}
|
||||
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('phone')} value={user.phone || '—'} />
|
||||
<InfoTile icon={AtSign} label={t('nick')} 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('availabilityLabel')}
|
||||
</div>
|
||||
{availabilityParts.length > 0 ? (
|
||||
<div className="flex flex-wrap gap-1.5">
|
||||
@@ -336,38 +351,38 @@ export default function UserInfo() {
|
||||
))}
|
||||
</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('prioritiesTitle')} />
|
||||
<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]] as string[] | undefined) ?? [];
|
||||
const t = MUSCLE_TONES[tone];
|
||||
const toneMeta = 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 ? toneMeta.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 ? toneMeta.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 ? toneMeta.text : 'text-dim'
|
||||
}`}
|
||||
>
|
||||
{t.label}
|
||||
{t(toneMeta.labelKey)}
|
||||
</span>
|
||||
{musclesList.length > 0 && (
|
||||
<span className="ml-auto text-[11px] font-bold tabular-nums text-dim">
|
||||
@@ -380,14 +395,14 @@ export default function UserInfo() {
|
||||
musclesList.map((m) => (
|
||||
<Badge
|
||||
key={m}
|
||||
color={t.badge as 'green' | 'blue' | 'yellow' | 'red'}
|
||||
color={toneMeta.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>
|
||||
@@ -398,7 +413,7 @@ export default function UserInfo() {
|
||||
|
||||
{/* Karta 3: social media — kafelki linków z markową kropką i domeną */}
|
||||
<Card>
|
||||
<SectionHeader title="Social media" />
|
||||
<SectionHeader title={t('socialMediaTitle')} />
|
||||
{(user.socialMedia ?? []).length > 0 ? (
|
||||
<div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2">
|
||||
{(user.socialMedia ?? []).map((s, i) => (
|
||||
@@ -408,7 +423,7 @@ export default function UserInfo() {
|
||||
) : (
|
||||
<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>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { GYM_ROLE_META } from '../../lib/roles';
|
||||
import {
|
||||
@@ -22,12 +23,13 @@ import { userDisplayName } from './UserDetail';
|
||||
* poza swoim edytorem.
|
||||
*/
|
||||
export default function UserMemberships() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const { user, isLoading, error } = useAdminUser(id);
|
||||
|
||||
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
useTopbar({
|
||||
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
|
||||
title: user ? t('profileTitle', { name: userDisplayName(user) }) : t('profileFallback'),
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
});
|
||||
|
||||
@@ -39,22 +41,28 @@ export default function UserMemberships() {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (error) return <ErrorText>Błąd: {(error as Error).message}</ErrorText>;
|
||||
if (!user) return <ErrorText>Nie znaleziono użytkownika.</ErrorText>;
|
||||
if (error)
|
||||
return (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
);
|
||||
if (!user) return <ErrorText>{t('notFound')}</ErrorText>;
|
||||
|
||||
const memberships = user.memberships ?? [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Członkostwa w siłowniach"
|
||||
title={t('membershipsTitle')}
|
||||
badge={memberships.length > 0 ? <Badge>{memberships.length}</Badge> : undefined}
|
||||
actions={<BackButton to={`/users/${user.id}`} />}
|
||||
/>
|
||||
|
||||
<Card>
|
||||
<SectionHeader
|
||||
title="Przynależności"
|
||||
title={t('affiliations')}
|
||||
actions={memberships.length > 0 ? <Badge>{memberships.length}</Badge> : undefined}
|
||||
/>
|
||||
{memberships.length > 0 ? (
|
||||
@@ -64,7 +72,7 @@ export default function UserMemberships() {
|
||||
<div className="flex flex-wrap gap-2 pt-1">
|
||||
{m.roles.map((r) => (
|
||||
<Badge key={r} color="gray">
|
||||
{GYM_ROLE_META[r].label}
|
||||
{t(`common:${GYM_ROLE_META[r].labelKey}`)}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
@@ -72,7 +80,7 @@ export default function UserMemberships() {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Muted>Brak członkostw.</Muted>
|
||||
<Muted>{t('noMemberships')}</Muted>
|
||||
)}
|
||||
</Card>
|
||||
</>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { TrendingUp } from 'lucide-react';
|
||||
import { useTopbar } from '../../topbar';
|
||||
import { BackButton, Card, EmptyState, ErrorText, PageHeader, Skeleton } from '../../components/ui';
|
||||
@@ -11,11 +12,12 @@ import { userDisplayName } from './UserDetail';
|
||||
* z aplikacji (czyt. opis wzoru 1RM usunięty z obu stron).
|
||||
*/
|
||||
export default function UserProgress() {
|
||||
const { t } = useTranslation('users');
|
||||
const { id } = useParams();
|
||||
const { user } = useAdminUser(id);
|
||||
useTopbar({
|
||||
// topbar = rodzic („Profil [nazwa]”), nazwa podstrony w PageHeader poniżej (h2)
|
||||
title: user ? `Profil ${userDisplayName(user)}` : 'Profil',
|
||||
title: user ? t('profileTitle', { name: userDisplayName(user) }) : t('profileFallback'),
|
||||
back: id ? `/users/${id}` : '/users',
|
||||
});
|
||||
const { data, isLoading, error } = useUserExerciseProgress(id);
|
||||
@@ -33,15 +35,23 @@ export default function UserProgress() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader title="Postępy" actions={<BackButton to={id ? `/users/${id}` : '/users'} />} />
|
||||
<PageHeader
|
||||
title={t('progress')}
|
||||
actions={<BackButton to={id ? `/users/${id}` : '/users'} />}
|
||||
/>
|
||||
|
||||
<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 użytkownika."
|
||||
title={t('noProgressTitle')}
|
||||
description={t('noProgressDesc')}
|
||||
/>
|
||||
)}
|
||||
{!error && exercises.length > 0 && <ExerciseProgressCards exercises={exercises} />}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { api } from '../../api/client';
|
||||
import type { User } from '../../api/types';
|
||||
@@ -26,6 +27,7 @@ export function UserRestrictionModal({
|
||||
initialStatus: User['status'];
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation('users');
|
||||
const queryClient = useQueryClient();
|
||||
const [status, setStatus] = useState<User['status']>(initialStatus);
|
||||
const [until, setUntil] = useState(
|
||||
@@ -38,16 +40,16 @@ export function UserRestrictionModal({
|
||||
const save = async () => {
|
||||
if (status === 'SUSPENDED') {
|
||||
if (!until) {
|
||||
setError('Podaj datę, do kiedy konto ma być zawieszone.');
|
||||
setError(t('errUntilRequired'));
|
||||
return;
|
||||
}
|
||||
if (new Date(until) <= new Date()) {
|
||||
setError('Data zawieszenia musi być w przyszłości.');
|
||||
setError(t('errUntilFuture'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (status === 'BANNED' && !reason.trim()) {
|
||||
setError('Podaj powód blokady konta.');
|
||||
setError(t('errReasonRequired'));
|
||||
return;
|
||||
}
|
||||
setBusy(true);
|
||||
@@ -64,53 +66,53 @@ export function UserRestrictionModal({
|
||||
await queryClient.invalidateQueries({ queryKey: ['admin-users'] });
|
||||
onClose();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Błąd zapisu');
|
||||
setError(err instanceof Error ? err.message : t('saveError'));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal open onClose={onClose} title="Dostęp do konta">
|
||||
<Modal open onClose={onClose} title={t('accessTitle')}>
|
||||
<div className="flex flex-col gap-3.5">
|
||||
{error && <ErrorText>{error}</ErrorText>}
|
||||
<Field label="Status konta">
|
||||
<Field label={t('statusLabel')}>
|
||||
<Select
|
||||
aria-label="Status konta"
|
||||
aria-label={t('statusLabel')}
|
||||
value={status}
|
||||
onChange={(e) => setStatus(e.target.value as User['status'])}
|
||||
>
|
||||
<option value="ACTIVE">Aktywne</option>
|
||||
<option value="SUSPENDED">Zawieszone</option>
|
||||
<option value="BANNED">Zablokowane</option>
|
||||
<option value="ACTIVE">{t('statusActive')}</option>
|
||||
<option value="SUSPENDED">{t('statusSuspended')}</option>
|
||||
<option value="BANNED">{t('statusBanned')}</option>
|
||||
</Select>
|
||||
</Field>
|
||||
{status === 'SUSPENDED' && (
|
||||
<Field label="Zawieszone do">
|
||||
<Field label={t('suspendedUntilLabel')}>
|
||||
<Input
|
||||
type="datetime-local"
|
||||
aria-label="Zawieszone do"
|
||||
aria-label={t('suspendedUntilLabel')}
|
||||
value={until}
|
||||
onChange={(e) => setUntil(e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{status !== 'ACTIVE' && (
|
||||
<Field label="Powód">
|
||||
<Field label={t('reasonLabel')}>
|
||||
<Input
|
||||
aria-label="Powód kary"
|
||||
aria-label={t('reasonAria')}
|
||||
value={reason}
|
||||
onChange={(e) => setReason(e.target.value)}
|
||||
placeholder={status === 'BANNED' ? 'np. udostępnianie konta' : 'opcjonalnie'}
|
||||
placeholder={status === 'BANNED' ? t('reasonPhBanned') : t('optionalPh')}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
<div className="flex justify-end gap-2 pt-1">
|
||||
<Button variant="ghost" onClick={onClose} disabled={busy}>
|
||||
Anuluj
|
||||
{t('common:cancel')}
|
||||
</Button>
|
||||
<Button onClick={() => void save()} disabled={busy}>
|
||||
{busy ? 'Zapisywanie…' : 'Zapisz'}
|
||||
{busy ? t('common:saving') : t('common:save')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect } from 'react';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { Plus, Users as UsersIcon } from 'lucide-react';
|
||||
import { api } from '../../api/client';
|
||||
@@ -11,10 +12,11 @@ import { useTopbar } from '../../topbar';
|
||||
import { userDisplayName } from './UserDetail';
|
||||
|
||||
export default function UsersList() {
|
||||
const { t } = useTranslation('users');
|
||||
useTopbar({
|
||||
title: 'Użytkownicy',
|
||||
title: t('common:nav.users'),
|
||||
search: 'users',
|
||||
actions: [{ label: 'Nowy użytkownik', to: '/users/new', icon: Plus }],
|
||||
actions: [{ label: t('newUser'), to: '/users/new', icon: Plus }],
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const { data, isLoading, error } = useQuery({
|
||||
@@ -40,7 +42,12 @@ export default function UsersList() {
|
||||
return (
|
||||
<>
|
||||
{isLoading && <Loading />}
|
||||
{error && <ErrorText>Błąd: {(error as Error).message}</ErrorText>}
|
||||
{error && (
|
||||
<ErrorText>
|
||||
{t('common:errorPrefix')}
|
||||
{(error as Error).message}
|
||||
</ErrorText>
|
||||
)}
|
||||
|
||||
<Card>
|
||||
<div className="divide-y divide-line">
|
||||
@@ -58,15 +65,19 @@ export default function UsersList() {
|
||||
meta={
|
||||
<>
|
||||
{u.email}
|
||||
{u.age != null ? ` · wiek: ${u.age}` : ''}
|
||||
{u.age != null ? ` · ${t('ageWord', { age: u.age })}` : ''}
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
{u.status === 'SUSPENDED' && <Badge color="yellow">Zawieszone</Badge>}
|
||||
{u.status === 'BANNED' && <Badge color="red">Zablokowane</Badge>}
|
||||
{u.isAdmin && <Badge color="blue">Admin</Badge>}
|
||||
<Badge color="gray">{u.memberships?.length ?? 0} sił.</Badge>
|
||||
{u.status === 'SUSPENDED' && (
|
||||
<Badge color="yellow">{t('statusSuspended')}</Badge>
|
||||
)}
|
||||
{u.status === 'BANNED' && <Badge color="red">{t('statusBanned')}</Badge>}
|
||||
{u.isAdmin && <Badge color="blue">{t('adminBadge')}</Badge>}
|
||||
<Badge color="gray">
|
||||
{t('gymsShort', { count: u.memberships?.length ?? 0 })}
|
||||
</Badge>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
@@ -79,8 +90,8 @@ export default function UsersList() {
|
||||
<Card>
|
||||
<EmptyState
|
||||
icon={UsersIcon}
|
||||
title="Brak użytkowników"
|
||||
description={query ? 'Brak wyników dla podanego zapytania.' : 'Brak użytkowników.'}
|
||||
title={t('noUsersTitle')}
|
||||
description={query ? t('noResultsDesc') : t('noUsersDesc')}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { create } from 'zustand';
|
||||
import { API_BASE } from '../config';
|
||||
import { api, setAccessToken } from '../api/client';
|
||||
import i18n from '../i18n';
|
||||
import type { User } from '../api/types';
|
||||
|
||||
interface AuthState {
|
||||
@@ -22,7 +23,7 @@ export const useAuth = create<AuthState>((set) => ({
|
||||
});
|
||||
if (!data.user.isAdmin) {
|
||||
setAccessToken(null);
|
||||
throw new Error('Dostęp tylko dla administratorów');
|
||||
throw new Error(i18n.t('auth:notAdmin'));
|
||||
}
|
||||
setAccessToken(data.accessToken);
|
||||
set({ user: data.user });
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
export type SearchableSection =
|
||||
| 'gyms'
|
||||
| 'users'
|
||||
| 'announcements'
|
||||
| 'focus-areas'
|
||||
| 'exercises'
|
||||
| 'equipment'
|
||||
| 'logs';
|
||||
'gyms' | 'users' | 'announcements' | 'focus-areas' | 'exercises' | 'equipment' | 'logs';
|
||||
|
||||
const EMPTY_QUERIES: Record<SearchableSection, string> = {
|
||||
gyms: '',
|
||||
|
||||
@@ -1,43 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Calendar, ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { Button } from '../components/ui';
|
||||
|
||||
export const MONTH_NAMES = [
|
||||
'Styczeń',
|
||||
'Luty',
|
||||
'Marzec',
|
||||
'Kwiecień',
|
||||
'Maj',
|
||||
'Czerwiec',
|
||||
'Lipiec',
|
||||
'Sierpień',
|
||||
'Wrzesień',
|
||||
'Październik',
|
||||
'Listopad',
|
||||
'Grudzień',
|
||||
];
|
||||
|
||||
/** Krótkie nazwy do siatki miesięcy w panelu selektora. */
|
||||
export const MONTH_SHORT = [
|
||||
'Sty',
|
||||
'Lut',
|
||||
'Mar',
|
||||
'Kwi',
|
||||
'Maj',
|
||||
'Cze',
|
||||
'Lip',
|
||||
'Sie',
|
||||
'Wrz',
|
||||
'Paź',
|
||||
'Lis',
|
||||
'Gru',
|
||||
];
|
||||
|
||||
/** `2026-08` → `Sierpień 2026`. */
|
||||
export function formatMonth(month: string): string {
|
||||
const [y, m] = month.split('-').map(Number);
|
||||
return `${MONTH_NAMES[m - 1]} ${y}`;
|
||||
}
|
||||
import { formatMonth, monthShort } from '../lib/format';
|
||||
|
||||
function currentMonthStr(): string {
|
||||
const d = new Date();
|
||||
@@ -75,6 +40,7 @@ export function MonthPickerCore({
|
||||
availableMonths,
|
||||
allowAll = false,
|
||||
}: MonthPickerCoreProps) {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [panelYear, setPanelYear] = useState<number | null>(null);
|
||||
|
||||
@@ -103,7 +69,7 @@ export function MonthPickerCore({
|
||||
variant="ghost"
|
||||
disabled={!prevMonth}
|
||||
onClick={() => prevMonth && setMonth(prevMonth)}
|
||||
aria-label={allowAll ? 'Poprzedni miesiąc' : 'Poprzedni miesiąc z danymi'}
|
||||
aria-label={allowAll ? t('topbar.prevMonth') : t('topbar.prevMonthWithData')}
|
||||
>
|
||||
<ChevronLeft className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -123,14 +89,14 @@ export function MonthPickerCore({
|
||||
className="max-md:flex-1"
|
||||
>
|
||||
<Calendar className="w-4 h-4" />
|
||||
{month === '' && allowAll ? 'Wszystkie' : formatMonth(month)}
|
||||
{month === '' && allowAll ? t('all') : formatMonth(month)}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
disabled={!nextMonth}
|
||||
onClick={() => nextMonth && setMonth(nextMonth)}
|
||||
aria-label={allowAll ? 'Następny miesiąc' : 'Następny miesiąc z danymi'}
|
||||
aria-label={allowAll ? t('topbar.nextMonth') : t('topbar.nextMonthWithData')}
|
||||
>
|
||||
<ChevronRight className="w-4 h-4" />
|
||||
</Button>
|
||||
@@ -156,7 +122,7 @@ export function MonthPickerCore({
|
||||
month === '' ? 'bg-accent/15 text-accent-text' : 'text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
Wszystkie
|
||||
{t('all')}
|
||||
</button>
|
||||
{/* filtr po roku: lata z danymi (nowe → stare) */}
|
||||
<div className="flex flex-wrap gap-1.5 mb-3">
|
||||
@@ -193,14 +159,14 @@ export function MonthPickerCore({
|
||||
: 'text-ink hover:bg-line/30'
|
||||
}`}
|
||||
>
|
||||
{MONTH_SHORT[i]}
|
||||
{monthShort(i)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</>
|
||||
) : availableMonths.length === 0 ? (
|
||||
<p className="text-dim text-[0.85rem] px-1">Brak danych</p>
|
||||
<p className="text-dim text-[0.85rem] px-1">{t('noData')}</p>
|
||||
) : (
|
||||
<>
|
||||
{/* filtr po roku: lata z danymi (nowe → stare) */}
|
||||
@@ -242,7 +208,7 @@ export function MonthPickerCore({
|
||||
: 'text-dim/50 cursor-default'
|
||||
}`}
|
||||
>
|
||||
{MONTH_SHORT[i]}
|
||||
{monthShort(i)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ChevronLeft, Filter, Menu, MoreHorizontal, Plus, Search, X } from 'lucide-react';
|
||||
import { useTopbarStore } from './store';
|
||||
import { useListSearch, type SearchableSection } from '../store/list-search';
|
||||
@@ -8,27 +9,28 @@ import { cn } from '../lib/utils';
|
||||
import { GroupButton, useIsMobile } from './GroupButton';
|
||||
import type { TopbarAction } from './types';
|
||||
|
||||
const SEARCH_LABELS: Record<SearchableSection, string> = {
|
||||
gyms: 'Szukaj siłowni',
|
||||
users: 'Szukaj użytkownika',
|
||||
announcements: 'Szukaj ogłoszenia',
|
||||
'focus-areas': 'Szukaj obszaru',
|
||||
exercises: 'Szukaj ćwiczenia',
|
||||
equipment: 'Szukaj urządzenia',
|
||||
logs: 'Szukaj użytkownika',
|
||||
const SEARCH_KEYS: Record<SearchableSection, string> = {
|
||||
gyms: 'topbar.searchGyms',
|
||||
users: 'topbar.searchUsers',
|
||||
announcements: 'topbar.searchAnnouncements',
|
||||
'focus-areas': 'topbar.searchFocusAreas',
|
||||
exercises: 'topbar.searchExercises',
|
||||
equipment: 'topbar.searchEquipment',
|
||||
logs: 'topbar.searchLogs',
|
||||
};
|
||||
|
||||
function SectionSearchInput({ section }: { section: SearchableSection }) {
|
||||
const { t } = useTranslation();
|
||||
const query = useListSearch((s) => s.queries[section]);
|
||||
const setQuery = useListSearch((s) => s.setQuery);
|
||||
return (
|
||||
<Input
|
||||
type="search"
|
||||
size="sm"
|
||||
placeholder="Szukaj…"
|
||||
placeholder={t('searchShort')}
|
||||
value={query}
|
||||
onChange={(e) => setQuery(section, e.target.value)}
|
||||
aria-label={SEARCH_LABELS[section]}
|
||||
aria-label={t(SEARCH_KEYS[section])}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -90,6 +92,7 @@ function useVisualViewportBottom() {
|
||||
* Konfigurację rejestruje aktywna strona (useTopbar).
|
||||
*/
|
||||
export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
const { t } = useTranslation();
|
||||
const config = useTopbarStore((s) => s.config);
|
||||
const openGroup = useTopbarStore((s) => s.openGroup);
|
||||
const setOpenGroup = useTopbarStore((s) => s.setOpenGroup);
|
||||
@@ -148,7 +151,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={onMenuOpen}
|
||||
aria-label="Otwórz menu"
|
||||
aria-label={t('topbar.openMenu')}
|
||||
/* telefon: te samo wykończenie co pigułka tytułu (tło+blur, border,
|
||||
zaokrąglenie), kreski w kolorze tekstu nagłówka */
|
||||
className="grid h-[34px] w-[34px] flex-none cursor-pointer place-items-center rounded-[10px] border border-line/60 bg-bg/72 text-ink shadow-[0_8px_24px_-10px_rgba(0,0,0,0.55)] backdrop-blur-md transition-colors hover:text-accent-text max-md:h-9 max-md:w-9 md:hidden"
|
||||
@@ -231,7 +234,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (config.onBack ? config.onBack() : navigate(config.back!))}
|
||||
aria-label="Wstecz"
|
||||
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" />
|
||||
@@ -242,7 +245,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
{hasFilters && (
|
||||
<GroupButton
|
||||
icon={Filter}
|
||||
label="Filtry"
|
||||
label={t('topbar.filters')}
|
||||
active={config?.filterActive}
|
||||
open={openGroup === 'filters'}
|
||||
onToggle={() => toggle('filters')}
|
||||
@@ -271,7 +274,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
{plusActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={Plus}
|
||||
label="Dodawanie"
|
||||
label={t('topbar.add')}
|
||||
open={openGroup === 'add'}
|
||||
onToggle={() => toggle('add')}
|
||||
>
|
||||
@@ -283,7 +286,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
{otherActions.length > 0 && (
|
||||
<GroupButton
|
||||
icon={MoreHorizontal}
|
||||
label="Akcje"
|
||||
label={t('topbar.actions')}
|
||||
open={openGroup === 'actions'}
|
||||
onToggle={() => toggle('actions')}
|
||||
flatOnMobile={config?.flatActionsMobile}
|
||||
@@ -298,7 +301,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
{config?.search && (
|
||||
<GroupButton
|
||||
icon={Search}
|
||||
label="Wyszukiwarka"
|
||||
label={t('topbar.search')}
|
||||
active={searchQuery !== ''}
|
||||
open={openGroup === 'search'}
|
||||
onToggle={() => toggle('search')}
|
||||
@@ -314,7 +317,7 @@ export function Topbar({ onMenuOpen }: { onMenuOpen?: () => void }) {
|
||||
{menuOpen && (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Zamknij menu"
|
||||
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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user