@moontra/moonui-pro 2.20.1 → 2.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +691 -261
- package/dist/index.mjs +7418 -4934
- package/package.json +11 -5
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postbuild.js +27 -0
- package/scripts/postinstall.js +176 -23
- package/src/__tests__/use-intersection-observer.test.tsx +0 -216
- package/src/__tests__/use-local-storage.test.tsx +0 -174
- package/src/__tests__/use-pro-access.test.tsx +0 -183
- package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
- package/src/components/advanced-chart/index.tsx +0 -1242
- package/src/components/advanced-forms/index.tsx +0 -426
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -372
- package/src/components/calendar/index.tsx +0 -1073
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -462
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -222
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/metric-card.tsx +0 -343
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/data-table.test.tsx +0 -187
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/enhanced/badge.tsx +0 -191
- package/src/components/enhanced/button.tsx +0 -362
- package/src/components/enhanced/card.tsx +0 -266
- package/src/components/enhanced/dialog.tsx +0 -246
- package/src/components/enhanced/index.ts +0 -4
- package/src/components/error-boundary/index.tsx +0 -109
- package/src/components/file-upload/file-upload.test.tsx +0 -243
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -307
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -76
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -516
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -513
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -530
- package/src/components/index.ts +0 -128
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1684
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -29
- package/src/components/magnetic-button/index.tsx +0 -167
- package/src/components/memory-efficient-data/index.tsx +0 -1016
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -589
- package/src/components/performance-monitor/index.tsx +0 -794
- package/src/components/phone-number-input/index.tsx +0 -338
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
- package/src/components/rich-text-editor/index.tsx +0 -2324
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -865
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1148
- package/src/components/ui/accordion.tsx +0 -73
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -153
- package/src/components/ui/badge.tsx +0 -228
- package/src/components/ui/breadcrumb.tsx +0 -214
- package/src/components/ui/button.tsx +0 -222
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -214
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -135
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -225
- package/src/components/ui/dialog.tsx +0 -334
- package/src/components/ui/dropdown-menu.tsx +0 -218
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -190
- package/src/components/ui/input.tsx +0 -222
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -612
- package/src/components/ui/pagination.tsx +0 -123
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -374
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -329
- package/src/components/ui/tabs.tsx +0 -198
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -14
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -85
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/moonui.d.ts +0 -22
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
|
@@ -1,761 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React, { useState, useEffect } from 'react'
|
|
4
|
-
import { motion, AnimatePresence } from 'framer-motion'
|
|
5
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/dialog'
|
|
6
|
-
import { Button } from '../ui/button'
|
|
7
|
-
import { Input } from '../ui/input'
|
|
8
|
-
import { Textarea } from '../ui/textarea'
|
|
9
|
-
import { Label } from '../ui/label'
|
|
10
|
-
import { MoonUIBadgePro as Badge } from '../ui/badge'
|
|
11
|
-
import { MoonUIAvatarPro, MoonUIAvatarFallbackPro, MoonUIAvatarImagePro, AvatarGroup as MoonUIAvatarGroupPro } from '../ui/avatar'
|
|
12
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../ui/select'
|
|
13
|
-
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
|
|
14
|
-
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem } from '../ui/command'
|
|
15
|
-
import { Calendar as CalendarComponent } from '../ui/calendar'
|
|
16
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs'
|
|
17
|
-
import { ScrollArea } from '../ui/scroll-area'
|
|
18
|
-
import { Progress } from '../ui/progress'
|
|
19
|
-
import { Separator } from '../ui/separator'
|
|
20
|
-
import { Checkbox } from '../ui/checkbox'
|
|
21
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '../ui/dropdown-menu'
|
|
22
|
-
import {
|
|
23
|
-
X,
|
|
24
|
-
Calendar,
|
|
25
|
-
User,
|
|
26
|
-
Tag,
|
|
27
|
-
Paperclip,
|
|
28
|
-
MessageCircle,
|
|
29
|
-
Clock,
|
|
30
|
-
Flag,
|
|
31
|
-
CheckSquare,
|
|
32
|
-
Plus,
|
|
33
|
-
MoreHorizontal,
|
|
34
|
-
Edit2,
|
|
35
|
-
Trash2,
|
|
36
|
-
Download,
|
|
37
|
-
Eye,
|
|
38
|
-
Link2,
|
|
39
|
-
Archive,
|
|
40
|
-
Copy,
|
|
41
|
-
Activity,
|
|
42
|
-
AlertCircle,
|
|
43
|
-
Check,
|
|
44
|
-
ChevronDown,
|
|
45
|
-
Upload,
|
|
46
|
-
FileText,
|
|
47
|
-
Image,
|
|
48
|
-
FileIcon,
|
|
49
|
-
Send,
|
|
50
|
-
Star,
|
|
51
|
-
StarOff
|
|
52
|
-
} from 'lucide-react'
|
|
53
|
-
import { format } from 'date-fns'
|
|
54
|
-
import { cn } from '../../lib/utils'
|
|
55
|
-
import type { KanbanCard, KanbanAssignee, KanbanLabel, KanbanActivity, KanbanChecklist } from './types'
|
|
56
|
-
|
|
57
|
-
interface CardDetailModalProps {
|
|
58
|
-
card: KanbanCard
|
|
59
|
-
isOpen: boolean
|
|
60
|
-
onClose: () => void
|
|
61
|
-
onUpdate: (card: KanbanCard) => void
|
|
62
|
-
onDelete: (card: KanbanCard) => void
|
|
63
|
-
availableAssignees?: KanbanAssignee[]
|
|
64
|
-
availableLabels?: KanbanLabel[]
|
|
65
|
-
currentColumn?: string
|
|
66
|
-
availableColumns?: { id: string; title: string }[]
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const PRIORITY_OPTIONS = [
|
|
70
|
-
{ value: 'low', label: 'Low', icon: Flag, color: 'text-green-600' },
|
|
71
|
-
{ value: 'medium', label: 'Medium', icon: Flag, color: 'text-yellow-600' },
|
|
72
|
-
{ value: 'high', label: 'High', icon: Flag, color: 'text-orange-600' },
|
|
73
|
-
{ value: 'urgent', label: 'Urgent', icon: AlertCircle, color: 'text-red-600' }
|
|
74
|
-
]
|
|
75
|
-
|
|
76
|
-
const formatFileSize = (bytes: number) => {
|
|
77
|
-
if (bytes === 0) return '0 Bytes'
|
|
78
|
-
const k = 1024
|
|
79
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB']
|
|
80
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
81
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const getInitials = (name: string) => {
|
|
85
|
-
return name.split(' ').map(n => n[0]).join('').toUpperCase()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function CardDetailModal({
|
|
89
|
-
card: initialCard,
|
|
90
|
-
isOpen,
|
|
91
|
-
onClose,
|
|
92
|
-
onUpdate,
|
|
93
|
-
onDelete,
|
|
94
|
-
availableAssignees = [],
|
|
95
|
-
availableLabels = [],
|
|
96
|
-
currentColumn,
|
|
97
|
-
availableColumns = []
|
|
98
|
-
}: CardDetailModalProps) {
|
|
99
|
-
const [card, setCard] = useState(initialCard)
|
|
100
|
-
const [isEditingTitle, setIsEditingTitle] = useState(false)
|
|
101
|
-
const [isEditingDescription, setIsEditingDescription] = useState(false)
|
|
102
|
-
const [newComment, setNewComment] = useState('')
|
|
103
|
-
const [newChecklistItem, setNewChecklistItem] = useState('')
|
|
104
|
-
const [selectedTab, setSelectedTab] = useState('overview')
|
|
105
|
-
|
|
106
|
-
useEffect(() => {
|
|
107
|
-
setCard(initialCard)
|
|
108
|
-
}, [initialCard])
|
|
109
|
-
|
|
110
|
-
const updateCard = (updates: Partial<KanbanCard>) => {
|
|
111
|
-
const updatedCard = { ...card, ...updates }
|
|
112
|
-
setCard(updatedCard)
|
|
113
|
-
onUpdate(updatedCard)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const addComment = () => {
|
|
117
|
-
if (!newComment.trim()) return
|
|
118
|
-
|
|
119
|
-
const newActivity: KanbanActivity = {
|
|
120
|
-
id: Date.now().toString(),
|
|
121
|
-
user: {
|
|
122
|
-
id: 'current-user',
|
|
123
|
-
name: 'Current User',
|
|
124
|
-
email: 'user@example.com'
|
|
125
|
-
},
|
|
126
|
-
action: 'commented',
|
|
127
|
-
timestamp: new Date(),
|
|
128
|
-
details: newComment
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
updateCard({
|
|
132
|
-
activities: [newActivity, ...(card.activities || [])],
|
|
133
|
-
comments: (card.comments || 0) + 1
|
|
134
|
-
})
|
|
135
|
-
setNewComment('')
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
const addChecklistItem = () => {
|
|
139
|
-
if (!newChecklistItem.trim()) return
|
|
140
|
-
|
|
141
|
-
const checklist = card.checklist || {
|
|
142
|
-
id: Date.now().toString(),
|
|
143
|
-
title: 'Checklist',
|
|
144
|
-
items: []
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
checklist.items.push({
|
|
148
|
-
id: Date.now().toString(),
|
|
149
|
-
text: newChecklistItem,
|
|
150
|
-
completed: false
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
updateCard({ checklist })
|
|
154
|
-
setNewChecklistItem('')
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const toggleChecklistItem = (itemId: string) => {
|
|
158
|
-
if (!card.checklist) return
|
|
159
|
-
|
|
160
|
-
const updatedChecklist = {
|
|
161
|
-
...card.checklist,
|
|
162
|
-
items: card.checklist.items.map(item =>
|
|
163
|
-
item.id === itemId ? { ...item, completed: !item.completed } : item
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
updateCard({ checklist: updatedChecklist })
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const deleteChecklistItem = (itemId: string) => {
|
|
171
|
-
if (!card.checklist) return
|
|
172
|
-
|
|
173
|
-
const updatedChecklist = {
|
|
174
|
-
...card.checklist,
|
|
175
|
-
items: card.checklist.items.filter(item => item.id !== itemId)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
updateCard({ checklist: updatedChecklist })
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const completedChecklistItems = card.checklist?.items.filter(item => item.completed).length || 0
|
|
182
|
-
const totalChecklistItems = card.checklist?.items.length || 0
|
|
183
|
-
const checklistProgress = totalChecklistItems > 0 ? (completedChecklistItems / totalChecklistItems) * 100 : 0
|
|
184
|
-
|
|
185
|
-
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
186
|
-
const files = e.target.files
|
|
187
|
-
if (!files) return
|
|
188
|
-
|
|
189
|
-
const newAttachments = Array.from(files).map(file => ({
|
|
190
|
-
id: Date.now().toString() + Math.random(),
|
|
191
|
-
name: file.name,
|
|
192
|
-
type: file.type,
|
|
193
|
-
url: URL.createObjectURL(file),
|
|
194
|
-
size: file.size
|
|
195
|
-
}))
|
|
196
|
-
|
|
197
|
-
updateCard({
|
|
198
|
-
attachments: [...(card.attachments || []), ...newAttachments]
|
|
199
|
-
})
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const removeAttachment = (attachmentId: string) => {
|
|
203
|
-
updateCard({
|
|
204
|
-
attachments: card.attachments?.filter(a => a.id !== attachmentId)
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return (
|
|
209
|
-
<Dialog open={isOpen} onOpenChange={onClose}>
|
|
210
|
-
<DialogContent className="max-w-4xl max-h-[90vh] overflow-hidden p-0">
|
|
211
|
-
{/* Header */}
|
|
212
|
-
<div className="p-6 pb-0">
|
|
213
|
-
<div className="flex items-start justify-between">
|
|
214
|
-
<div className="flex-1">
|
|
215
|
-
{isEditingTitle ? (
|
|
216
|
-
<Input
|
|
217
|
-
value={card.title}
|
|
218
|
-
onChange={(e) => updateCard({ title: e.target.value })}
|
|
219
|
-
onBlur={() => setIsEditingTitle(false)}
|
|
220
|
-
onKeyDown={(e) => {
|
|
221
|
-
if (e.key === 'Enter') setIsEditingTitle(false)
|
|
222
|
-
if (e.key === 'Escape') {
|
|
223
|
-
setCard(initialCard)
|
|
224
|
-
setIsEditingTitle(false)
|
|
225
|
-
}
|
|
226
|
-
}}
|
|
227
|
-
className="text-xl font-semibold"
|
|
228
|
-
autoFocus
|
|
229
|
-
/>
|
|
230
|
-
) : (
|
|
231
|
-
<h2
|
|
232
|
-
className="text-xl font-semibold cursor-pointer hover:bg-muted rounded px-2 -mx-2 py-1"
|
|
233
|
-
onClick={() => setIsEditingTitle(true)}
|
|
234
|
-
>
|
|
235
|
-
{card.title}
|
|
236
|
-
</h2>
|
|
237
|
-
)}
|
|
238
|
-
{currentColumn && (
|
|
239
|
-
<p className="text-sm text-muted-foreground mt-1">
|
|
240
|
-
in {currentColumn}
|
|
241
|
-
</p>
|
|
242
|
-
)}
|
|
243
|
-
</div>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
|
|
247
|
-
{/* Tabs */}
|
|
248
|
-
<Tabs value={selectedTab} onValueChange={setSelectedTab} className="flex-1">
|
|
249
|
-
<div className="px-6 pt-4">
|
|
250
|
-
<TabsList>
|
|
251
|
-
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
252
|
-
<TabsTrigger value="activity">
|
|
253
|
-
Activity
|
|
254
|
-
{card.activities && card.activities.length > 0 && (
|
|
255
|
-
<Badge variant="secondary" className="ml-2">
|
|
256
|
-
{card.activities.length}
|
|
257
|
-
</Badge>
|
|
258
|
-
)}
|
|
259
|
-
</TabsTrigger>
|
|
260
|
-
<TabsTrigger value="comments">
|
|
261
|
-
Comments
|
|
262
|
-
{card.comments && card.comments > 0 && (
|
|
263
|
-
<Badge variant="secondary" className="ml-2">
|
|
264
|
-
{card.comments}
|
|
265
|
-
</Badge>
|
|
266
|
-
)}
|
|
267
|
-
</TabsTrigger>
|
|
268
|
-
</TabsList>
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
<ScrollArea className="flex-1 max-h-[calc(90vh-200px)]">
|
|
272
|
-
<div className="p-6">
|
|
273
|
-
<TabsContent value="overview" className="mt-0">
|
|
274
|
-
<div className="space-y-6">
|
|
275
|
-
{/* Description */}
|
|
276
|
-
<div>
|
|
277
|
-
<Label className="text-base font-semibold mb-2 block">Description</Label>
|
|
278
|
-
{isEditingDescription ? (
|
|
279
|
-
<div className="space-y-2">
|
|
280
|
-
<Textarea
|
|
281
|
-
value={card.description || ''}
|
|
282
|
-
onChange={(e) => updateCard({ description: e.target.value })}
|
|
283
|
-
placeholder="Add a description..."
|
|
284
|
-
className="min-h-[100px]"
|
|
285
|
-
autoFocus
|
|
286
|
-
/>
|
|
287
|
-
<div className="flex gap-2">
|
|
288
|
-
<Button
|
|
289
|
-
size="sm"
|
|
290
|
-
onClick={() => setIsEditingDescription(false)}
|
|
291
|
-
>
|
|
292
|
-
Save
|
|
293
|
-
</Button>
|
|
294
|
-
<Button
|
|
295
|
-
size="sm"
|
|
296
|
-
variant="ghost"
|
|
297
|
-
onClick={() => {
|
|
298
|
-
setCard(initialCard)
|
|
299
|
-
setIsEditingDescription(false)
|
|
300
|
-
}}
|
|
301
|
-
>
|
|
302
|
-
Cancel
|
|
303
|
-
</Button>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
306
|
-
) : (
|
|
307
|
-
<div
|
|
308
|
-
className="min-h-[50px] p-3 rounded-md border cursor-pointer hover:bg-muted/50"
|
|
309
|
-
onClick={() => setIsEditingDescription(true)}
|
|
310
|
-
>
|
|
311
|
-
{card.description || (
|
|
312
|
-
<span className="text-muted-foreground">Add a description...</span>
|
|
313
|
-
)}
|
|
314
|
-
</div>
|
|
315
|
-
)}
|
|
316
|
-
</div>
|
|
317
|
-
|
|
318
|
-
{/* Details Grid */}
|
|
319
|
-
<div className="grid grid-cols-2 gap-4">
|
|
320
|
-
{/* Assignees */}
|
|
321
|
-
<div>
|
|
322
|
-
<Label className="text-sm font-medium mb-2 block">Assignees</Label>
|
|
323
|
-
<Popover>
|
|
324
|
-
<PopoverTrigger asChild>
|
|
325
|
-
<Button variant="outline" className="w-full justify-start">
|
|
326
|
-
{card.assignees && card.assignees.length > 0 ? (
|
|
327
|
-
<div className="flex items-center gap-2">
|
|
328
|
-
<MoonUIAvatarGroupPro max={3} size="xs">
|
|
329
|
-
{card.assignees.map((assignee) => (
|
|
330
|
-
<MoonUIAvatarPro key={assignee.id} className="h-5 w-5">
|
|
331
|
-
<MoonUIAvatarImagePro src={assignee.avatar} />
|
|
332
|
-
<MoonUIAvatarFallbackPro className="text-xs">
|
|
333
|
-
{getInitials(assignee.name)}
|
|
334
|
-
</MoonUIAvatarFallbackPro>
|
|
335
|
-
</MoonUIAvatarPro>
|
|
336
|
-
))}
|
|
337
|
-
</MoonUIAvatarGroupPro>
|
|
338
|
-
<span className="text-sm">
|
|
339
|
-
{card.assignees.map(a => a.name).join(', ')}
|
|
340
|
-
</span>
|
|
341
|
-
</div>
|
|
342
|
-
) : (
|
|
343
|
-
<span className="text-muted-foreground">Add assignee</span>
|
|
344
|
-
)}
|
|
345
|
-
</Button>
|
|
346
|
-
</PopoverTrigger>
|
|
347
|
-
<PopoverContent className="p-0" align="start">
|
|
348
|
-
<Command>
|
|
349
|
-
<CommandInput placeholder="Search assignees..." />
|
|
350
|
-
<CommandEmpty>No assignees found.</CommandEmpty>
|
|
351
|
-
<CommandGroup>
|
|
352
|
-
{availableAssignees.map((assignee) => {
|
|
353
|
-
const isSelected = card.assignees?.some(a => a.id === assignee.id)
|
|
354
|
-
return (
|
|
355
|
-
<CommandItem
|
|
356
|
-
key={assignee.id}
|
|
357
|
-
onSelect={() => {
|
|
358
|
-
if (isSelected) {
|
|
359
|
-
updateCard({
|
|
360
|
-
assignees: card.assignees?.filter(a => a.id !== assignee.id)
|
|
361
|
-
})
|
|
362
|
-
} else {
|
|
363
|
-
updateCard({
|
|
364
|
-
assignees: [...(card.assignees || []), assignee]
|
|
365
|
-
})
|
|
366
|
-
}
|
|
367
|
-
}}
|
|
368
|
-
>
|
|
369
|
-
<Check
|
|
370
|
-
className={cn(
|
|
371
|
-
"mr-2 h-4 w-4",
|
|
372
|
-
isSelected ? "opacity-100" : "opacity-0"
|
|
373
|
-
)}
|
|
374
|
-
/>
|
|
375
|
-
<MoonUIAvatarPro className="h-6 w-6 mr-2">
|
|
376
|
-
<MoonUIAvatarImagePro src={assignee.avatar} />
|
|
377
|
-
<MoonUIAvatarFallbackPro className="text-xs">
|
|
378
|
-
{getInitials(assignee.name)}
|
|
379
|
-
</MoonUIAvatarFallbackPro>
|
|
380
|
-
</MoonUIAvatarPro>
|
|
381
|
-
<span>{assignee.name}</span>
|
|
382
|
-
</CommandItem>
|
|
383
|
-
)
|
|
384
|
-
})}
|
|
385
|
-
</CommandGroup>
|
|
386
|
-
</Command>
|
|
387
|
-
</PopoverContent>
|
|
388
|
-
</Popover>
|
|
389
|
-
</div>
|
|
390
|
-
|
|
391
|
-
{/* Priority */}
|
|
392
|
-
<div>
|
|
393
|
-
<Label className="text-sm font-medium mb-2 block">Priority</Label>
|
|
394
|
-
<Select value={card.priority || 'medium'} onValueChange={(value: any) => updateCard({ priority: value })}>
|
|
395
|
-
<SelectTrigger>
|
|
396
|
-
<SelectValue />
|
|
397
|
-
</SelectTrigger>
|
|
398
|
-
<SelectContent>
|
|
399
|
-
{PRIORITY_OPTIONS.map((option) => (
|
|
400
|
-
<SelectItem key={option.value} value={option.value}>
|
|
401
|
-
<div className="flex items-center gap-2">
|
|
402
|
-
<option.icon className={cn("h-4 w-4", option.color)} />
|
|
403
|
-
<span>{option.label}</span>
|
|
404
|
-
</div>
|
|
405
|
-
</SelectItem>
|
|
406
|
-
))}
|
|
407
|
-
</SelectContent>
|
|
408
|
-
</Select>
|
|
409
|
-
</div>
|
|
410
|
-
|
|
411
|
-
{/* Due Date */}
|
|
412
|
-
<div>
|
|
413
|
-
<Label className="text-sm font-medium mb-2 block">Due Date</Label>
|
|
414
|
-
<Popover>
|
|
415
|
-
<PopoverTrigger asChild>
|
|
416
|
-
<Button variant="outline" className="w-full justify-start">
|
|
417
|
-
{card.dueDate ? (
|
|
418
|
-
<>
|
|
419
|
-
<Calendar className="mr-2 h-4 w-4" />
|
|
420
|
-
{format(card.dueDate, 'PPP')}
|
|
421
|
-
</>
|
|
422
|
-
) : (
|
|
423
|
-
<span className="text-muted-foreground">Set due date</span>
|
|
424
|
-
)}
|
|
425
|
-
</Button>
|
|
426
|
-
</PopoverTrigger>
|
|
427
|
-
<PopoverContent className="w-auto p-0" align="start">
|
|
428
|
-
<CalendarComponent
|
|
429
|
-
mode="single"
|
|
430
|
-
selected={card.dueDate}
|
|
431
|
-
onSelect={(date) => {
|
|
432
|
-
if (date instanceof Date) {
|
|
433
|
-
updateCard({ dueDate: date })
|
|
434
|
-
} else {
|
|
435
|
-
updateCard({ dueDate: undefined })
|
|
436
|
-
}
|
|
437
|
-
}}
|
|
438
|
-
initialFocus
|
|
439
|
-
/>
|
|
440
|
-
</PopoverContent>
|
|
441
|
-
</Popover>
|
|
442
|
-
</div>
|
|
443
|
-
|
|
444
|
-
{/* Labels */}
|
|
445
|
-
<div>
|
|
446
|
-
<Label className="text-sm font-medium mb-2 block">Labels</Label>
|
|
447
|
-
<Popover>
|
|
448
|
-
<PopoverTrigger asChild>
|
|
449
|
-
<Button variant="outline" className="w-full justify-start">
|
|
450
|
-
{card.labels && card.labels.length > 0 ? (
|
|
451
|
-
<div className="flex flex-wrap gap-1">
|
|
452
|
-
{card.labels.map((label) => (
|
|
453
|
-
<div
|
|
454
|
-
key={label.id}
|
|
455
|
-
className="px-2 py-0.5 rounded text-xs text-white"
|
|
456
|
-
style={{ backgroundColor: label.color }}
|
|
457
|
-
>
|
|
458
|
-
{label.name}
|
|
459
|
-
</div>
|
|
460
|
-
))}
|
|
461
|
-
</div>
|
|
462
|
-
) : (
|
|
463
|
-
<span className="text-muted-foreground">Add labels</span>
|
|
464
|
-
)}
|
|
465
|
-
</Button>
|
|
466
|
-
</PopoverTrigger>
|
|
467
|
-
<PopoverContent className="p-3" align="start">
|
|
468
|
-
<div className="space-y-2">
|
|
469
|
-
{availableLabels.map((label) => {
|
|
470
|
-
const isSelected = card.labels?.some(l => l.id === label.id)
|
|
471
|
-
return (
|
|
472
|
-
<div
|
|
473
|
-
key={label.id}
|
|
474
|
-
className={cn(
|
|
475
|
-
"flex items-center gap-2 p-2 rounded cursor-pointer hover:bg-muted",
|
|
476
|
-
isSelected && "bg-muted"
|
|
477
|
-
)}
|
|
478
|
-
onClick={() => {
|
|
479
|
-
if (isSelected) {
|
|
480
|
-
updateCard({
|
|
481
|
-
labels: card.labels?.filter(l => l.id !== label.id)
|
|
482
|
-
})
|
|
483
|
-
} else {
|
|
484
|
-
updateCard({
|
|
485
|
-
labels: [...(card.labels || []), label]
|
|
486
|
-
})
|
|
487
|
-
}
|
|
488
|
-
}}
|
|
489
|
-
>
|
|
490
|
-
<div
|
|
491
|
-
className="w-6 h-6 rounded"
|
|
492
|
-
style={{ backgroundColor: label.color }}
|
|
493
|
-
/>
|
|
494
|
-
<span className="text-sm">{label.name}</span>
|
|
495
|
-
{isSelected && <Check className="h-4 w-4 ml-auto" />}
|
|
496
|
-
</div>
|
|
497
|
-
)
|
|
498
|
-
})}
|
|
499
|
-
</div>
|
|
500
|
-
</PopoverContent>
|
|
501
|
-
</Popover>
|
|
502
|
-
</div>
|
|
503
|
-
</div>
|
|
504
|
-
|
|
505
|
-
{/* Checklist */}
|
|
506
|
-
<div>
|
|
507
|
-
<div className="flex items-center justify-between mb-3">
|
|
508
|
-
<Label className="text-base font-semibold">Checklist</Label>
|
|
509
|
-
{totalChecklistItems > 0 && (
|
|
510
|
-
<div className="flex items-center gap-2">
|
|
511
|
-
<span className="text-sm text-muted-foreground">
|
|
512
|
-
{completedChecklistItems}/{totalChecklistItems}
|
|
513
|
-
</span>
|
|
514
|
-
<Progress value={checklistProgress} className="w-20 h-2" />
|
|
515
|
-
</div>
|
|
516
|
-
)}
|
|
517
|
-
</div>
|
|
518
|
-
<div className="space-y-2">
|
|
519
|
-
{card.checklist?.items.map((item) => (
|
|
520
|
-
<div key={item.id} className="flex items-center gap-2 group">
|
|
521
|
-
<Checkbox
|
|
522
|
-
checked={item.completed}
|
|
523
|
-
onCheckedChange={() => toggleChecklistItem(item.id)}
|
|
524
|
-
/>
|
|
525
|
-
<span className={cn(
|
|
526
|
-
"flex-1",
|
|
527
|
-
item.completed && "line-through text-muted-foreground"
|
|
528
|
-
)}>
|
|
529
|
-
{item.text}
|
|
530
|
-
</span>
|
|
531
|
-
<Button
|
|
532
|
-
variant="ghost"
|
|
533
|
-
size="icon"
|
|
534
|
-
className="h-6 w-6 opacity-0 group-hover:opacity-100"
|
|
535
|
-
onClick={() => deleteChecklistItem(item.id)}
|
|
536
|
-
>
|
|
537
|
-
<Trash2 className="h-3 w-3" />
|
|
538
|
-
</Button>
|
|
539
|
-
</div>
|
|
540
|
-
))}
|
|
541
|
-
<div className="flex items-center gap-2">
|
|
542
|
-
<Checkbox disabled className="invisible" />
|
|
543
|
-
<Input
|
|
544
|
-
placeholder="Add an item..."
|
|
545
|
-
value={newChecklistItem}
|
|
546
|
-
onChange={(e) => setNewChecklistItem(e.target.value)}
|
|
547
|
-
onKeyDown={(e) => {
|
|
548
|
-
if (e.key === 'Enter') {
|
|
549
|
-
e.preventDefault()
|
|
550
|
-
addChecklistItem()
|
|
551
|
-
}
|
|
552
|
-
}}
|
|
553
|
-
/>
|
|
554
|
-
<Button
|
|
555
|
-
size="sm"
|
|
556
|
-
onClick={addChecklistItem}
|
|
557
|
-
disabled={!newChecklistItem.trim()}
|
|
558
|
-
>
|
|
559
|
-
Add
|
|
560
|
-
</Button>
|
|
561
|
-
</div>
|
|
562
|
-
</div>
|
|
563
|
-
</div>
|
|
564
|
-
|
|
565
|
-
{/* Attachments */}
|
|
566
|
-
<div>
|
|
567
|
-
<Label className="text-base font-semibold mb-3 block">Attachments</Label>
|
|
568
|
-
<div className="space-y-2">
|
|
569
|
-
{card.attachments?.map((attachment) => (
|
|
570
|
-
<div key={attachment.id} className="flex items-center gap-3 p-3 border rounded-lg group">
|
|
571
|
-
<div className="flex-shrink-0">
|
|
572
|
-
{attachment.type.startsWith('image/') ? (
|
|
573
|
-
<Image className="h-8 w-8 text-muted-foreground" />
|
|
574
|
-
) : (
|
|
575
|
-
<FileText className="h-8 w-8 text-muted-foreground" />
|
|
576
|
-
)}
|
|
577
|
-
</div>
|
|
578
|
-
<div className="flex-1 min-w-0">
|
|
579
|
-
<p className="text-sm font-medium truncate">{attachment.name}</p>
|
|
580
|
-
<p className="text-xs text-muted-foreground">{formatFileSize(attachment.size)}</p>
|
|
581
|
-
</div>
|
|
582
|
-
<div className="flex items-center gap-1 opacity-0 group-hover:opacity-100">
|
|
583
|
-
<Button
|
|
584
|
-
variant="ghost"
|
|
585
|
-
size="icon"
|
|
586
|
-
className="h-8 w-8"
|
|
587
|
-
onClick={() => window.open(attachment.url, '_blank')}
|
|
588
|
-
>
|
|
589
|
-
<Download className="h-4 w-4" />
|
|
590
|
-
</Button>
|
|
591
|
-
<Button
|
|
592
|
-
variant="ghost"
|
|
593
|
-
size="icon"
|
|
594
|
-
className="h-8 w-8"
|
|
595
|
-
onClick={() => removeAttachment(attachment.id)}
|
|
596
|
-
>
|
|
597
|
-
<Trash2 className="h-4 w-4" />
|
|
598
|
-
</Button>
|
|
599
|
-
</div>
|
|
600
|
-
</div>
|
|
601
|
-
))}
|
|
602
|
-
<div>
|
|
603
|
-
<input
|
|
604
|
-
type="file"
|
|
605
|
-
id="file-upload"
|
|
606
|
-
className="hidden"
|
|
607
|
-
multiple
|
|
608
|
-
onChange={handleFileUpload}
|
|
609
|
-
/>
|
|
610
|
-
<Button
|
|
611
|
-
variant="outline"
|
|
612
|
-
className="w-full"
|
|
613
|
-
onClick={() => document.getElementById('file-upload')?.click()}
|
|
614
|
-
>
|
|
615
|
-
<Upload className="mr-2 h-4 w-4" />
|
|
616
|
-
Add attachment
|
|
617
|
-
</Button>
|
|
618
|
-
</div>
|
|
619
|
-
</div>
|
|
620
|
-
</div>
|
|
621
|
-
</div>
|
|
622
|
-
</TabsContent>
|
|
623
|
-
|
|
624
|
-
<TabsContent value="activity" className="mt-0">
|
|
625
|
-
<div className="space-y-4">
|
|
626
|
-
{card.activities?.map((activity) => (
|
|
627
|
-
<div key={activity.id} className="flex gap-3">
|
|
628
|
-
<MoonUIAvatarPro className="h-8 w-8">
|
|
629
|
-
<MoonUIAvatarImagePro src={activity.user.avatar} />
|
|
630
|
-
<MoonUIAvatarFallbackPro className="text-xs">
|
|
631
|
-
{getInitials(activity.user.name)}
|
|
632
|
-
</MoonUIAvatarFallbackPro>
|
|
633
|
-
</MoonUIAvatarPro>
|
|
634
|
-
<div className="flex-1">
|
|
635
|
-
<div className="flex items-center gap-2 mb-1">
|
|
636
|
-
<span className="font-medium text-sm">{activity.user.name}</span>
|
|
637
|
-
<span className="text-sm text-muted-foreground">{activity.action}</span>
|
|
638
|
-
<span className="text-xs text-muted-foreground">
|
|
639
|
-
{format(activity.timestamp, 'PPp')}
|
|
640
|
-
</span>
|
|
641
|
-
</div>
|
|
642
|
-
{activity.details && (
|
|
643
|
-
<p className="text-sm text-muted-foreground">{activity.details}</p>
|
|
644
|
-
)}
|
|
645
|
-
</div>
|
|
646
|
-
</div>
|
|
647
|
-
))}
|
|
648
|
-
{(!card.activities || card.activities.length === 0) && (
|
|
649
|
-
<div className="text-center py-8 text-muted-foreground">
|
|
650
|
-
<Activity className="h-8 w-8 mx-auto mb-2 opacity-50" />
|
|
651
|
-
<p>No activity yet</p>
|
|
652
|
-
</div>
|
|
653
|
-
)}
|
|
654
|
-
</div>
|
|
655
|
-
</TabsContent>
|
|
656
|
-
|
|
657
|
-
<TabsContent value="comments" className="mt-0">
|
|
658
|
-
<div className="space-y-4">
|
|
659
|
-
{/* Comment Input */}
|
|
660
|
-
<div className="flex gap-3">
|
|
661
|
-
<MoonUIAvatarPro className="h-8 w-8">
|
|
662
|
-
<MoonUIAvatarFallbackPro>U</MoonUIAvatarFallbackPro>
|
|
663
|
-
</MoonUIAvatarPro>
|
|
664
|
-
<div className="flex-1 space-y-2">
|
|
665
|
-
<Textarea
|
|
666
|
-
placeholder="Add a comment..."
|
|
667
|
-
value={newComment}
|
|
668
|
-
onChange={(e) => setNewComment(e.target.value)}
|
|
669
|
-
className="min-h-[80px]"
|
|
670
|
-
/>
|
|
671
|
-
<div className="flex justify-end">
|
|
672
|
-
<Button
|
|
673
|
-
size="sm"
|
|
674
|
-
onClick={addComment}
|
|
675
|
-
disabled={!newComment.trim()}
|
|
676
|
-
>
|
|
677
|
-
<Send className="mr-2 h-4 w-4" />
|
|
678
|
-
Comment
|
|
679
|
-
</Button>
|
|
680
|
-
</div>
|
|
681
|
-
</div>
|
|
682
|
-
</div>
|
|
683
|
-
|
|
684
|
-
<Separator />
|
|
685
|
-
|
|
686
|
-
{/* Comments List */}
|
|
687
|
-
{card.activities?.filter(a => a.action === 'commented').map((comment) => (
|
|
688
|
-
<div key={comment.id} className="flex gap-3">
|
|
689
|
-
<MoonUIAvatarPro className="h-8 w-8">
|
|
690
|
-
<MoonUIAvatarImagePro src={comment.user.avatar} />
|
|
691
|
-
<MoonUIAvatarFallbackPro className="text-xs">
|
|
692
|
-
{getInitials(comment.user.name)}
|
|
693
|
-
</MoonUIAvatarFallbackPro>
|
|
694
|
-
</MoonUIAvatarPro>
|
|
695
|
-
<div className="flex-1">
|
|
696
|
-
<div className="flex items-center gap-2 mb-1">
|
|
697
|
-
<span className="font-medium text-sm">{comment.user.name}</span>
|
|
698
|
-
<span className="text-xs text-muted-foreground">
|
|
699
|
-
{format(comment.timestamp, 'PPp')}
|
|
700
|
-
</span>
|
|
701
|
-
</div>
|
|
702
|
-
<p className="text-sm">{comment.details}</p>
|
|
703
|
-
</div>
|
|
704
|
-
</div>
|
|
705
|
-
))}
|
|
706
|
-
{!card.activities?.some(a => a.action === 'commented') && (
|
|
707
|
-
<div className="text-center py-8 text-muted-foreground">
|
|
708
|
-
<MessageCircle className="h-8 w-8 mx-auto mb-2 opacity-50" />
|
|
709
|
-
<p>No comments yet</p>
|
|
710
|
-
<p className="text-sm">Be the first to comment</p>
|
|
711
|
-
</div>
|
|
712
|
-
)}
|
|
713
|
-
</div>
|
|
714
|
-
</TabsContent>
|
|
715
|
-
</div>
|
|
716
|
-
</ScrollArea>
|
|
717
|
-
</Tabs>
|
|
718
|
-
|
|
719
|
-
{/* Footer Actions */}
|
|
720
|
-
<div className="border-t p-4 flex items-center justify-between">
|
|
721
|
-
<div className="flex items-center gap-2">
|
|
722
|
-
<DropdownMenu>
|
|
723
|
-
<DropdownMenuTrigger asChild>
|
|
724
|
-
<Button variant="outline" size="sm">
|
|
725
|
-
<MoreHorizontal className="h-4 w-4 mr-2" />
|
|
726
|
-
Actions
|
|
727
|
-
</Button>
|
|
728
|
-
</DropdownMenuTrigger>
|
|
729
|
-
<DropdownMenuContent align="start">
|
|
730
|
-
<DropdownMenuItem>
|
|
731
|
-
<Copy className="mr-2 h-4 w-4" />
|
|
732
|
-
Duplicate card
|
|
733
|
-
</DropdownMenuItem>
|
|
734
|
-
<DropdownMenuItem>
|
|
735
|
-
<Archive className="mr-2 h-4 w-4" />
|
|
736
|
-
Archive card
|
|
737
|
-
</DropdownMenuItem>
|
|
738
|
-
<DropdownMenuItem>
|
|
739
|
-
<Link2 className="mr-2 h-4 w-4" />
|
|
740
|
-
Copy link
|
|
741
|
-
</DropdownMenuItem>
|
|
742
|
-
<DropdownMenuSeparator />
|
|
743
|
-
<DropdownMenuItem
|
|
744
|
-
onClick={() => {
|
|
745
|
-
onDelete(card)
|
|
746
|
-
onClose()
|
|
747
|
-
}}
|
|
748
|
-
className="text-destructive"
|
|
749
|
-
>
|
|
750
|
-
<Trash2 className="mr-2 h-4 w-4" />
|
|
751
|
-
Delete card
|
|
752
|
-
</DropdownMenuItem>
|
|
753
|
-
</DropdownMenuContent>
|
|
754
|
-
</DropdownMenu>
|
|
755
|
-
</div>
|
|
756
|
-
<Button onClick={onClose}>Close</Button>
|
|
757
|
-
</div>
|
|
758
|
-
</DialogContent>
|
|
759
|
-
</Dialog>
|
|
760
|
-
)
|
|
761
|
-
}
|