From 4a6b5e54983a16db1b62388324d10ea189c2a625 Mon Sep 17 00:00:00 2001 From: Claude CLI Agent Date: Sun, 29 Mar 2026 11:16:07 +0000 Subject: [PATCH] UI fixes: emoji icons, modal form, Czech labels, polish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixed group emoji icons in DB (💼🛒📚🗺️🏃✨🏠🌿) - Added TaskModal component for + button - Czech status labels (Čeká, Probíhá, Hotovo, Zrušeno) - Improved TaskCard, GroupSelector, Header, StatusBadge - Better dark/light mode transitions Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/tasks/.eslintrc.json | 5 +- apps/tasks/app/globals.css | 52 ++++++++++ apps/tasks/app/layout.tsx | 2 +- apps/tasks/app/tasks/[id]/page.tsx | 126 +++++++++++++++++------- apps/tasks/app/tasks/page.tsx | 80 ++++++++------- apps/tasks/components/GroupSelector.tsx | 25 +++-- apps/tasks/components/Header.tsx | 47 ++++++--- apps/tasks/components/StatusBadge.tsx | 41 ++++++-- apps/tasks/components/TaskCard.tsx | 106 +++++++++++++------- apps/tasks/components/TaskForm.tsx | 80 +++++++++------ apps/tasks/components/TaskModal.tsx | 98 ++++++++++++++++++ 11 files changed, 499 insertions(+), 163 deletions(-) create mode 100644 apps/tasks/components/TaskModal.tsx diff --git a/apps/tasks/.eslintrc.json b/apps/tasks/.eslintrc.json index 13015d6..40be9a4 100644 --- a/apps/tasks/.eslintrc.json +++ b/apps/tasks/.eslintrc.json @@ -1,6 +1,9 @@ { "extends": "next/core-web-vitals", "rules": { - "@typescript-eslint/no-explicit-any": "off" + "@typescript-eslint/no-explicit-any": "off", + "react-hooks/exhaustive-deps": "warn", + "@next/next/no-img-element": "off", + "react/no-unescaped-entities": "off" } } diff --git a/apps/tasks/app/globals.css b/apps/tasks/app/globals.css index bb982a3..ec7a22a 100644 --- a/apps/tasks/app/globals.css +++ b/apps/tasks/app/globals.css @@ -24,6 +24,26 @@ body { background: var(--background); color: var(--foreground); font-family: system-ui, -apple-system, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 16px; /* prevent auto-zoom on iOS */ + max-width: 100vw; + overflow-x: hidden; +} + +/* Mobile-first base */ +* { + box-sizing: border-box; + -webkit-tap-highlight-color: transparent; +} + +input[type="text"], +input[type="email"], +input[type="password"], +input[type="datetime-local"], +textarea, +select { + font-size: 16px; /* Prevent zoom on iOS */ } @layer utilities { @@ -34,4 +54,36 @@ body { .scrollbar-hide::-webkit-scrollbar { display: none; } + + .text-muted { + color: var(--muted); + } +} + +/* Smooth page transitions */ +main { + animation: fadeIn 0.15s ease-out; +} + +@keyframes fadeIn { + from { + opacity: 0; + transform: translateY(4px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +/* Mobile overscroll behavior */ +@media (max-width: 640px) { + html { + overscroll-behavior-y: contain; + } +} + +/* Selection color */ +::selection { + background: rgba(59, 130, 246, 0.3); } diff --git a/apps/tasks/app/layout.tsx b/apps/tasks/app/layout.tsx index 120d1ce..c1e2365 100644 --- a/apps/tasks/app/layout.tsx +++ b/apps/tasks/app/layout.tsx @@ -37,7 +37,7 @@ export default function RootLayout({
-
+
{children}
diff --git a/apps/tasks/app/tasks/[id]/page.tsx b/apps/tasks/app/tasks/[id]/page.tsx index 2009531..9df4f8f 100644 --- a/apps/tasks/app/tasks/[id]/page.tsx +++ b/apps/tasks/app/tasks/[id]/page.tsx @@ -3,10 +3,21 @@ import { useEffect, useState, useCallback } from "react"; import { useRouter, useParams } from "next/navigation"; import { useAuth } from "@/lib/auth"; -import { getTask, getGroups, updateTask, deleteTask, Task, Group } from "@/lib/api"; +import { + getTask, + getGroups, + updateTask, + deleteTask, + Task, + Group, +} from "@/lib/api"; import TaskForm from "@/components/TaskForm"; import StatusBadge from "@/components/StatusBadge"; +function isDone(status: string): boolean { + return status === "done" || status === "completed"; +} + export default function TaskDetailPage() { const { token } = useAuth(); const router = useRouter(); @@ -30,7 +41,9 @@ export default function TaskDetailPage() { setTask(taskData); setGroups(groupsData.data || []); } catch (err) { - setError(err instanceof Error ? err.message : "Chyba pri nacitani ukolu"); + setError( + err instanceof Error ? err.message : "Chyba p\u0159i na\u010d\u00edt\u00e1n\u00ed \u00fakolu" + ); } finally { setLoading(false); } @@ -53,13 +66,15 @@ export default function TaskDetailPage() { async function handleDelete() { if (!token || !id) return; - if (!confirm("Opravdu smazat tento ukol?")) return; + if (!confirm("Opravdu smazat tento \u00fakol?")) return; setDeleting(true); try { await deleteTask(token, id); router.push("/tasks"); } catch (err) { - setError(err instanceof Error ? err.message : "Chyba pri mazani"); + setError( + err instanceof Error ? err.message : "Chyba p\u0159i maz\u00e1n\u00ed" + ); setDeleting(false); } } @@ -70,7 +85,9 @@ export default function TaskDetailPage() { await updateTask(token, id, { status: newStatus }); loadTask(); } catch (err) { - setError(err instanceof Error ? err.message : "Chyba pri zmene stavu"); + setError( + err instanceof Error ? err.message : "Chyba p\u0159i zm\u011bn\u011b stavu" + ); } } @@ -79,7 +96,7 @@ export default function TaskDetailPage() { if (loading) { return (
-
+
); } @@ -87,12 +104,12 @@ export default function TaskDetailPage() { if (error || !task) { return (
-

{error || "Ukol nenalezen"}

+

{error || "\u00dakol nenalezen"}

); @@ -101,25 +118,28 @@ export default function TaskDetailPage() { if (editing) { return (
-

Upravit ukol

+

Upravit \u00fakol

setEditing(false)} - submitLabel="Ulozit zmeny" + submitLabel="Ulo\u017eit zm\u011bny" />
); } - const PRIORITY_LABELS: Record = { - low: "Nizka", - medium: "Stredni", - high: "Vysoka", - urgent: "Urgentni", + const PRIORITY_LABELS: Record = { + low: { label: "N\u00edzk\u00e1", dot: "\ud83d\udfe2" }, + medium: { label: "St\u0159edn\u00ed", dot: "\ud83d\udfe1" }, + high: { label: "Vysok\u00e1", dot: "\ud83d\udfe0" }, + urgent: { label: "Urgentn\u00ed", dot: "\ud83d\udd34" }, }; + const pri = PRIORITY_LABELS[task.priority] || PRIORITY_LABELS.medium; + const taskDone = isDone(task.status); + return (
{/* Back button */} @@ -127,55 +147,89 @@ export default function TaskDetailPage() { onClick={() => router.push("/tasks")} className="text-sm text-muted hover:text-foreground flex items-center gap-1" > - - + + - Zpet + Zp\u011bt {/* Task detail card */}
-

- {task.title} -

+
+ {task.group_icon && ( + {task.group_icon} + )} +

+ {task.title} +

+
{task.description && ( -

{task.description}

+

+ {task.description} +

)}
Priorita: - {PRIORITY_LABELS[task.priority]} + + {pri.dot} {pri.label} +
{task.group_name && (
Skupina: + {task.group_icon && ( + {task.group_icon} + )} {task.group_name}
)} {task.due_at && (
- Termin: - {new Date(task.due_at).toLocaleString("cs-CZ")} + Term\u00edn: + + {new Date(task.due_at).toLocaleString("cs-CZ")} +
)}
- Vytvoreno: - {new Date(task.created_at).toLocaleString("cs-CZ")} + Vytvo\u0159eno: + + {new Date(task.created_at).toLocaleString("cs-CZ")} +
{task.completed_at && (
- Dokonceno: - {new Date(task.completed_at).toLocaleString("cs-CZ")} + Dokon\u010deno: + + {new Date(task.completed_at).toLocaleString("cs-CZ")} +
)}
@@ -183,12 +237,12 @@ export default function TaskDetailPage() { {/* Quick status buttons */}
- {task.status !== "done" && ( + {!taskDone && ( )} {task.status === "pending" && ( @@ -196,15 +250,15 @@ export default function TaskDetailPage() { onClick={() => handleQuickStatus("in_progress")} className="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm font-medium transition-colors" > - Zahajit + Zah\u00e1jit )} - {task.status === "done" && ( + {taskDone && ( )}
@@ -222,7 +276,7 @@ export default function TaskDetailPage() { disabled={deleting} className="px-6 py-2.5 border border-red-300 dark:border-red-800 text-red-600 dark:text-red-400 rounded-lg hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors font-medium disabled:opacity-50" > - {deleting ? "Mazu..." : "Smazat"} + {deleting ? "Ma\u017eu..." : "Smazat"}
diff --git a/apps/tasks/app/tasks/page.tsx b/apps/tasks/app/tasks/page.tsx index bbf04ce..9a023c3 100644 --- a/apps/tasks/app/tasks/page.tsx +++ b/apps/tasks/app/tasks/page.tsx @@ -6,7 +6,7 @@ import { useAuth } from "@/lib/auth"; import { getTasks, getGroups, createTask, Task, Group } from "@/lib/api"; import TaskCard from "@/components/TaskCard"; import GroupSelector from "@/components/GroupSelector"; -import TaskForm from "@/components/TaskForm"; +import TaskModal from "@/components/TaskModal"; type StatusFilter = "all" | "pending" | "in_progress" | "done" | "cancelled"; @@ -35,7 +35,7 @@ export default function TasksPage() { setTasks(tasksRes.data || []); setGroups(groupsRes.data || []); } catch (err) { - console.error("Chyba pri nacitani:", err); + console.error("Chyba p\u0159i na\u010d\u00edt\u00e1n\u00ed:", err); } finally { setLoading(false); } @@ -57,19 +57,23 @@ export default function TasksPage() { } const statusOptions: { value: StatusFilter; label: string }[] = [ - { value: "all", label: "Vse" }, - { value: "pending", label: "Ceka" }, - { value: "in_progress", label: "Probiha" }, + { value: "all", label: "V\u0161e" }, + { value: "pending", label: "\u010Cek\u00e1" }, + { value: "in_progress", label: "Prob\u00edh\u00e1" }, { value: "done", label: "Hotovo" }, - { value: "cancelled", label: "Zruseno" }, + { value: "cancelled", label: "Zru\u0161eno" }, ]; if (!token) return null; return ( -
+
{/* Group tabs */} - + {/* Status filter */}
@@ -77,7 +81,7 @@ export default function TasksPage() {
- {/* Task creation form */} - {showForm && ( -
-

Novy ukol

- setShowForm(false)} - submitLabel="Vytvorit" - /> -
- )} - {/* Task list */} {loading ? (
-
+
) : tasks.length === 0 ? (
-
-

Zadne ukoly

-

Vytvorte prvni ukol pomoci tlacitka +

+
+

\u017d\u00e1dn\u00e9 \u00fakoly

+

+ Vytvo\u0159te prvn\u00ed \u00fakol pomoc\u00ed tla\u010d\u00edtka + +

) : (
@@ -120,15 +113,34 @@ export default function TasksPage() {
)} - {/* Floating add button */} - {!showForm && ( - + + + + + {/* Add task modal */} + {showForm && ( + setShowForm(false)} + /> )}
); diff --git a/apps/tasks/components/GroupSelector.tsx b/apps/tasks/components/GroupSelector.tsx index f49e8a2..94255ae 100644 --- a/apps/tasks/components/GroupSelector.tsx +++ b/apps/tasks/components/GroupSelector.tsx @@ -8,34 +8,43 @@ interface GroupSelectorProps { onSelect: (id: string | null) => void; } -export default function GroupSelector({ groups, selected, onSelect }: GroupSelectorProps) { +export default function GroupSelector({ + groups, + selected, + onSelect, +}: GroupSelectorProps) { return ( -
+
{groups.map((g) => ( ))}
diff --git a/apps/tasks/components/Header.tsx b/apps/tasks/components/Header.tsx index 7cd3ebe..ce7f38f 100644 --- a/apps/tasks/components/Header.tsx +++ b/apps/tasks/components/Header.tsx @@ -18,43 +18,66 @@ export default function Header() { return (
- - Task Team + +
+ + + +
+ Task Team -
+
+ {/* Theme toggle */} {token && user ? (
- {user.name || user.email} +
+
+ {(user.name || user.email || "?").charAt(0).toUpperCase()} +
+ + {user.name || user.email} + +
) : ( - Prihlasit + P\u0159ihl\u00e1sit )}
diff --git a/apps/tasks/components/StatusBadge.tsx b/apps/tasks/components/StatusBadge.tsx index a78061b..93f08a0 100644 --- a/apps/tasks/components/StatusBadge.tsx +++ b/apps/tasks/components/StatusBadge.tsx @@ -5,11 +5,37 @@ interface StatusBadgeProps { size?: "sm" | "md"; } -const STATUS_MAP: Record = { - pending: { label: "Ceka", bg: "bg-yellow-100 dark:bg-yellow-900/30", text: "text-yellow-800 dark:text-yellow-300" }, - in_progress: { label: "Probiha", bg: "bg-blue-100 dark:bg-blue-900/30", text: "text-blue-800 dark:text-blue-300" }, - done: { label: "Hotovo", bg: "bg-green-100 dark:bg-green-900/30", text: "text-green-800 dark:text-green-300" }, - cancelled: { label: "Zruseno", bg: "bg-gray-100 dark:bg-gray-800/30", text: "text-gray-600 dark:text-gray-400" }, +const STATUS_MAP: Record = { + pending: { + label: "\u010Cek\u00e1", + 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\u00edh\u00e1", + 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\u0161eno", + bg: "bg-gray-100 dark:bg-gray-800/30", + text: "text-gray-600 dark:text-gray-400", + dot: "bg-gray-400", + }, }; export default function StatusBadge({ status, size = "sm" }: StatusBadgeProps) { @@ -17,7 +43,10 @@ export default function StatusBadge({ status, size = "sm" }: StatusBadgeProps) { const sizeClass = size === "sm" ? "px-2 py-0.5 text-xs" : "px-3 py-1 text-sm"; return ( - + + {s.label} ); diff --git a/apps/tasks/components/TaskCard.tsx b/apps/tasks/components/TaskCard.tsx index 7d47836..8a5e341 100644 --- a/apps/tasks/components/TaskCard.tsx +++ b/apps/tasks/components/TaskCard.tsx @@ -8,54 +8,86 @@ interface TaskCardProps { task: Task; } -const PRIORITY_INDICATOR: Record = { - urgent: "border-l-red-500", - high: "border-l-orange-500", - medium: "border-l-yellow-500", - low: "border-l-green-500", +const PRIORITY_DOT: Record = { + urgent: "\ud83d\udd34", + high: "\ud83d\udfe0", + medium: "\ud83d\udfe1", + low: "\ud83d\udfe2", }; +function isDone(status: string): boolean { + return status === "done" || status === "completed"; +} + export default function TaskCard({ task }: TaskCardProps) { - const priorityClass = PRIORITY_INDICATOR[task.priority] || PRIORITY_INDICATOR.medium; + const dot = PRIORITY_DOT[task.priority] || PRIORITY_DOT.medium; + const groupColor = task.group_color || "#6b7280"; + const taskDone = isDone(task.status); return ( - -
-
-
-

- {task.title} -

- {task.description && ( -

{task.description}

+ +
+ {/* Color bar on left */} +
+ +
+
+ {/* Group icon */} + {task.group_icon && ( + {task.group_icon} )} -
- - {task.group_name && ( - +
+

- {task.group_name} - - )} - {task.due_at && ( - - {new Date(task.due_at).toLocaleDateString("cs-CZ")} + {task.title} +

+ + {dot} +
+ + {task.description && ( +

+ {task.description} +

)} + +
+ + {task.group_name && ( + + {task.group_name} + + )} + {task.due_at && ( + + + + + {new Date(task.due_at).toLocaleDateString("cs-CZ")} + + )} +
-
- - {task.priority === "urgent" ? "!!!" : task.priority === "high" ? "!!" : task.priority === "medium" ? "!" : ""} - + + {/* Swipe hint on mobile */} +
+ + +
diff --git a/apps/tasks/components/TaskForm.tsx b/apps/tasks/components/TaskForm.tsx index 82f79d6..dfd300c 100644 --- a/apps/tasks/components/TaskForm.tsx +++ b/apps/tasks/components/TaskForm.tsx @@ -12,33 +12,41 @@ interface TaskFormProps { } const STATUSES = [ - { value: "pending", label: "Ceka" }, - { value: "in_progress", label: "Probiha" }, + { value: "pending", label: "\u010Cek\u00e1" }, + { value: "in_progress", label: "Prob\u00edh\u00e1" }, { value: "done", label: "Hotovo" }, - { value: "cancelled", label: "Zruseno" }, + { value: "cancelled", label: "Zru\u0161eno" }, ]; const PRIORITIES = [ - { value: "low", label: "Nizka" }, - { value: "medium", label: "Stredni" }, - { value: "high", label: "Vysoka" }, - { value: "urgent", label: "Urgentni" }, + { value: "low", label: "N\u00edzk\u00e1" }, + { value: "medium", label: "St\u0159edn\u00ed" }, + { value: "high", label: "Vysok\u00e1" }, + { value: "urgent", label: "Urgentn\u00ed" }, ]; -export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLabel = "Ulozit" }: TaskFormProps) { +export default function TaskForm({ + groups, + initial, + onSubmit, + onCancel, + submitLabel = "Ulo\u017eit", +}: TaskFormProps) { const [title, setTitle] = useState(initial?.title || ""); const [description, setDescription] = useState(initial?.description || ""); const [status, setStatus] = useState(initial?.status || "pending"); const [priority, setPriority] = useState(initial?.priority || "medium"); const [groupId, setGroupId] = useState(initial?.group_id || ""); - const [dueAt, setDueAt] = useState(initial?.due_at ? initial.due_at.slice(0, 16) : ""); + const [dueAt, setDueAt] = useState( + initial?.due_at ? initial.due_at.slice(0, 16) : "" + ); const [loading, setLoading] = useState(false); const [error, setError] = useState(""); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); if (!title.trim()) { - setError("Nazev je povinny"); + setError("N\u00e1zev je povinn\u00fd"); return; } setLoading(true); @@ -53,7 +61,9 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa due_at: dueAt ? new Date(dueAt).toISOString() : null, }); } catch (err) { - setError(err instanceof Error ? err.message : "Chyba pri ukladani"); + setError( + err instanceof Error ? err.message : "Chyba p\u0159i ukl\u00e1d\u00e1n\u00ed" + ); } finally { setLoading(false); } @@ -68,13 +78,13 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa )}
- + setTitle(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none" - placeholder="Co je treba udelat..." + className="w-full px-3 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-shadow" + placeholder="Co je t\u0159eba ud\u011blat..." autoFocus />
@@ -85,7 +95,7 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa value={description} onChange={(e) => setDescription(e.target.value)} rows={3} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none resize-none" + className="w-full px-3 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none resize-none transition-shadow" placeholder="Podrobnosti..." />
@@ -95,11 +105,21 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa
@@ -109,10 +129,12 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa
@@ -124,22 +146,24 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa
- + setDueAt(e.target.value)} - className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 outline-none" + className="w-full px-3 py-2.5 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 focus:ring-2 focus:ring-blue-500 outline-none min-h-[44px]" />
@@ -148,16 +172,16 @@ export default function TaskForm({ groups, initial, onSubmit, onCancel, submitLa
diff --git a/apps/tasks/components/TaskModal.tsx b/apps/tasks/components/TaskModal.tsx new file mode 100644 index 0000000..67be9de --- /dev/null +++ b/apps/tasks/components/TaskModal.tsx @@ -0,0 +1,98 @@ +"use client"; + +import { useEffect, useState, useCallback } from "react"; +import { Group, Task } from "@/lib/api"; +import TaskForm from "@/components/TaskForm"; + +interface TaskModalProps { + groups: Group[]; + onSubmit: (data: Partial) => Promise; + onClose: () => void; +} + +export default function TaskModal({ groups, onSubmit, onClose }: TaskModalProps) { + const [visible, setVisible] = useState(false); + + const handleClose = useCallback(() => { + setVisible(false); + setTimeout(onClose, 200); + }, [onClose]); + + useEffect(() => { + // Trigger enter animation on next frame + requestAnimationFrame(() => setVisible(true)); + }, []); + + useEffect(() => { + function handleKeyDown(e: KeyboardEvent) { + if (e.key === "Escape") handleClose(); + } + document.addEventListener("keydown", handleKeyDown); + // Prevent body scroll + document.body.style.overflow = "hidden"; + return () => { + document.removeEventListener("keydown", handleKeyDown); + document.body.style.overflow = ""; + }; + }, [handleClose]); + + return ( +
+ {/* Backdrop */} +
+ + {/* Modal panel with slide-up animation */} +
+ {/* Drag handle for mobile */} +
+
+
+ +
+

Nov\u00fd \u00fakol

+ +
+ + +
+
+ ); +}