diff --git a/taskncoffee-app/src/App.jsx b/taskncoffee-app/src/App.jsx index 2ed40e6..4735723 100644 --- a/taskncoffee-app/src/App.jsx +++ b/taskncoffee-app/src/App.jsx @@ -5,7 +5,7 @@ import { AuthLayout } from './layouts/AuthLayout' import { Routes, Route, Navigate } from 'react-router' import Dashboard from './pages/Dashboard' import RootRedirect from './pages/RootRedirect' -import CardComponent from './components/Card' +import { TaskButton } from './components/Card' function App() { @@ -24,7 +24,7 @@ function App() { } /> + } /> } /> diff --git a/taskncoffee-app/src/components/Card.jsx b/taskncoffee-app/src/components/Card.jsx index f4e7635..88987c5 100644 --- a/taskncoffee-app/src/components/Card.jsx +++ b/taskncoffee-app/src/components/Card.jsx @@ -1,21 +1,134 @@ +import { useState } from 'react' import styles from '@/lib/styles' import { cn } from '@/lib/utils' +import { X } from 'lucide-react' + + +export function TaskButton({ taskData }) { + const [isModalOpen, setIsModalOpen] = useState(false) + + const openModal = () => setIsModalOpen(true) + const closeModal = () => setIsModalOpen(false) -export default function CardComponent() { return ( -
-
-

Card

+ <> +
+ {taskData?.title || "Sample task card"}
-
-
- Low - Medium - High - Critical + + {isModalOpen && ( +
+
e.stopPropagation()} + > + {/* Кнопка закрытия */} + + + +
-

Card description

- + )} + + ) +} + +export function CardComponent({ + status = "todo", + time_spent = 0, + description = "No description", + title = "Task", + priority = "medium", + due_date = null +}) { + const formatTimeSpent = (minutes) => { + if (!minutes || minutes === 0) return "0 min"; + const hours = Math.floor(minutes / 60); + const mins = minutes % 60; + if (hours > 0) { + return `${hours}h ${mins > 0 ? `${mins}m` : ''}`; + } + return `${mins}m`; + }; + + const formatDate = (dateString) => { + if (!dateString) return "No due date"; + const date = new Date(dateString); + return date.toLocaleDateString('en-US', { + month: 'short', + day: 'numeric', + year: 'numeric' + }); + }; + + const priorityBadgeStyle = { + low: styles.badge.low, + medium: styles.badge.medium, + high: styles.badge.high, + critical: styles.badge.critical, + }; + + const statusLabels = { + open: "Open", + closed: "Closed", + in_progress: "In Progress", + todo: "To Do" + }; + + return ( +
+
+

{title}

+
+
+
+ + {priority.charAt(0).toUpperCase() + priority.slice(1)} + + + Status: {statusLabels[status]} + +
+ +
+ + ⏱️ {formatTimeSpent(time_spent)} + + + 📅 {formatDate(due_date)} + +
+ +

+ {description} +

+ +
)