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:
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user