diff --git a/src/app/(app)/issues/issues-list.tsx b/src/app/(app)/issues/issues-list.tsx index 4462cf9c..2a2a974a 100644 --- a/src/app/(app)/issues/issues-list.tsx +++ b/src/app/(app)/issues/issues-list.tsx @@ -1,8 +1,20 @@ 'use client'; import { useSearchParams, useRouter } from 'next/navigation'; -import { useState, useTransition, useCallback, useEffect, useRef } from 'react'; -import { Search, ExternalLink, ChevronLeft, ChevronRight, Copy, Check, X } from 'lucide-react'; +import { useState, useTransition, useCallback, useEffect } from 'react'; +import { + Search, + ExternalLink, + ChevronLeft, + ChevronRight, + Copy, + Check, + X, + Lock, + Unlock, + SlidersHorizontal, + ArrowRight, +} from 'lucide-react'; import { claimIssue, unclaimIssue, @@ -12,23 +24,14 @@ import { type RepoOption, } from '@/app/actions/issues'; -const DIFFICULTY_LABEL: Record = { E: 'L1', M: 'L2', H: 'L3' }; -const DIFFICULTY_COLOR: Record = { - E: 'border-emerald-700 text-emerald-400', - M: 'border-yellow-700 text-yellow-400', - H: 'border-red-800 text-red-400', -}; - -const DIFFICULTY_FULL: Record = { - E: 'Easy — good for first contributions, lower XP', - M: 'Medium — requires some codebase knowledge', - H: 'Hard — significant complexity, higher XP', -}; - function timeAgo(dateStr: string): string { const diff = Date.now() - new Date(dateStr).getTime(); - const days = Math.floor(diff / 86400000); - if (days === 0) return 'today'; + const mins = Math.floor(diff / 60000); + if (mins <= 0) return 'just now'; + if (mins < 60) return `${mins}m ago`; + const hours = Math.floor(mins / 60); + if (hours < 24) return `${hours}h ago`; + const days = Math.floor(hours / 24); if (days === 1) return '1d ago'; if (days < 30) return `${days}d ago`; const months = Math.floor(days / 30); @@ -57,7 +60,6 @@ function IssueDetailDrawer({ const org = issue.repoFullName.split('/')[0] ?? ''; const [copied, setCopied] = useState(false); - // Close on Escape key useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); @@ -66,7 +68,6 @@ function IssueDetailDrawer({ return () => window.removeEventListener('keydown', onKey); }, [onClose]); - // Prevent body scroll while drawer is open useEffect(() => { document.body.style.overflow = 'hidden'; return () => { @@ -80,44 +81,53 @@ function IssueDetailDrawer({ setTimeout(() => setCopied(false), 1500); }; + const difficultyText: Record = { E: 'EASY', M: 'MEDIUM', H: 'HARD' }; + const difficultyColor: Record = { + E: 'border-emerald-800 text-emerald-400 bg-emerald-950/20', + M: 'border-amber-800 text-amber-400 bg-amber-950/20', + H: 'border-red-850 text-red-400 bg-red-950/20', + }; + return ( <> - {/* Backdrop */} -