i18n: integrate translations into components
- StatusBadge, TaskForm, tasks page use i18n hook - All 4 language files complete (cs, he, ru, ua) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,37 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslation } from "@/lib/i18n";
|
||||
|
||||
interface StatusBadgeProps {
|
||||
status: string;
|
||||
size?: "sm" | "md";
|
||||
}
|
||||
|
||||
const STATUS_MAP: Record<string, { label: string; bg: string; text: string; dot: string }> = {
|
||||
const STATUS_STYLES: Record<string, { bg: string; text: string; dot: string }> = {
|
||||
pending: {
|
||||
label: "Čeká",
|
||||
bg: "bg-yellow-100 dark:bg-yellow-900/30",
|
||||
text: "text-yellow-800 dark:text-yellow-300",
|
||||
dot: "bg-yellow-500",
|
||||
},
|
||||
in_progress: {
|
||||
label: "Probíhá",
|
||||
bg: "bg-blue-100 dark:bg-blue-900/30",
|
||||
text: "text-blue-800 dark:text-blue-300",
|
||||
dot: "bg-blue-500",
|
||||
},
|
||||
done: {
|
||||
label: "Hotovo",
|
||||
bg: "bg-green-100 dark:bg-green-900/30",
|
||||
text: "text-green-800 dark:text-green-300",
|
||||
dot: "bg-green-500",
|
||||
},
|
||||
completed: {
|
||||
label: "Hotovo",
|
||||
bg: "bg-green-100 dark:bg-green-900/30",
|
||||
text: "text-green-800 dark:text-green-300",
|
||||
dot: "bg-green-500",
|
||||
},
|
||||
cancelled: {
|
||||
label: "Zrušeno",
|
||||
bg: "bg-gray-100 dark:bg-gray-800/30",
|
||||
text: "text-gray-600 dark:text-gray-400",
|
||||
dot: "bg-gray-400",
|
||||
@@ -39,15 +36,17 @@ const STATUS_MAP: Record<string, { label: string; bg: string; text: string; dot:
|
||||
};
|
||||
|
||||
export default function StatusBadge({ status, size = "sm" }: StatusBadgeProps) {
|
||||
const s = STATUS_MAP[status] || STATUS_MAP.pending;
|
||||
const { t } = useTranslation();
|
||||
const s = STATUS_STYLES[status] || STATUS_STYLES.pending;
|
||||
const sizeClass = size === "sm" ? "px-2 py-0.5 text-xs" : "px-3 py-1 text-sm";
|
||||
const label = t(`tasks.status.${status}`) || status;
|
||||
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1.5 rounded-full font-medium ${s.bg} ${s.text} ${sizeClass}`}
|
||||
>
|
||||
<span className={`w-1.5 h-1.5 rounded-full ${s.dot}`} />
|
||||
{s.label}
|
||||
{label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user