Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions devboard/client/src/components/Board/TaskCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const PRIORITY_COLORS = {
low: "bg-green-500/20 text-green-400",
};

const timeAgo = (date) => {
const diff = Date.now() - new Date(date);
const days = Math.floor(diff / 86400000);
if (days === 0) return "today";
if (days === 1) return "1 day ago";
return `${days} days ago`;
};

const TaskCard = ({ task, index, onSelect }) => {
const [expanded, setExpanded] = useState(false);
const [selectedSnippet, setSelectedSnippet] = useState(0);
Expand Down Expand Up @@ -150,6 +158,9 @@ const TaskCard = ({ task, index, onSelect }) => {
{task.snippets?.length > 0 && (
<span>📎 {task.snippets.length}</span>
)}
{task.createdAt && (
<span>🕐 {timeAgo(task.createdAt)}</span>
)}
</div>
{task.assignee?.name && (
<div className="w-5 h-5 rounded-full bg-purple-700 flex items-center justify-center text-[9px] font-bold text-white">
Expand Down