forked from Lumina-eX/TaskChain
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.tsx
More file actions
233 lines (220 loc) · 8.19 KB
/
Copy pathpage.tsx
File metadata and controls
233 lines (220 loc) · 8.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
"use client";
import { useState } from "react";
import {
AlertCircle,
Plus,
MessageSquare,
Clock,
CheckCircle2,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { DisputeForm } from "@/components/dashboard/dispute-form";
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { DisputeDetailsDialog } from "@/components/dashboard/dispute-details-dialog";
interface Dispute {
id: string;
projectTitle: string;
reason: string;
status: "open" | "in-review" | "resolved";
createdDate: string;
messages: number;
evidence: string[];
}
const mockDisputes: Dispute[] = [
{
id: "1",
projectTitle: "Logo Design - Revision Required",
reason:
"Deliverables do not match the agreed-upon specifications. Colors and fonts are different from requirements.",
status: "in-review",
createdDate: "2024-02-20",
messages: 5,
evidence: ["design_spec.pdf", "screenshot_comparison.png"],
},
];
const statusConfig = {
open: {
color: "bg-amber-500/20",
text: "Open",
textColor: "text-amber-500",
icon: AlertCircle,
},
"in-review": {
color: "bg-secondary/20",
text: "In Review",
textColor: "text-secondary",
icon: Clock,
},
resolved: {
color: "bg-accent/20",
text: "Resolved",
textColor: "text-accent",
icon: CheckCircle2,
},
};
export default function DisputesPage() {
const [showDisputeForm, setShowDisputeForm] = useState(false);
const [selectedDispute, setSelectedDispute] = useState<Dispute | null>(null);
return (
<div className="p-8">
<div className="space-y-8">
{/* Header */}
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4">
<div>
<h1 className="text-3xl font-bold">Disputes</h1>
<p className="text-muted-foreground mt-2">
Manage disputes and resolutions
</p>
</div>
<Button
onClick={() => setShowDisputeForm(true)}
className="group"
size="lg"
>
<Plus className="mr-2 h-4 w-4 group-hover:scale-110 transition-transform" />
Raise Dispute
</Button>
</div>
{/* Stats */}
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
<div className="p-6 rounded-xl bg-card/50 backdrop-blur-sm border border-border/40">
<p className="text-sm text-muted-foreground mb-2">Total Disputes</p>
<p className="text-3xl font-bold">1</p>
</div>
<div className="p-6 rounded-xl bg-card/50 backdrop-blur-sm border border-border/40">
<p className="text-sm text-muted-foreground mb-2">In Review</p>
<p className="text-3xl font-bold text-secondary">1</p>
</div>
<div className="p-6 rounded-xl bg-card/50 backdrop-blur-sm border border-border/40">
<p className="text-sm text-muted-foreground mb-2">Resolved</p>
<p className="text-3xl font-bold text-accent">0</p>
</div>
</div>
{/* Disputes List */}
{mockDisputes.length > 0 ? (
<div className="space-y-4">
{mockDisputes.map((dispute) => {
const config = statusConfig[dispute.status];
const Icon = config.icon;
return (
<div
key={dispute.id}
className="group p-6 rounded-xl bg-card/50 backdrop-blur-sm border border-border/40 hover:border-primary/50 transition-all duration-300 cursor-pointer"
onClick={() => setSelectedDispute(dispute)}
>
<div className="space-y-4">
{/* Header */}
<div className="flex items-start justify-between gap-4">
<div className="flex-1 space-y-2">
<div className="flex items-center gap-3 flex-wrap gap-y-1">
<AlertCircle className="h-5 w-5 text-amber-500 flex-shrink-0" />
<h3 className="text-lg font-semibold">
{dispute.projectTitle}
</h3>
<Badge
className={`${config.color} ${config.textColor} border-0`}
>
{config.text}
</Badge>
</div>
<p className="text-sm text-muted-foreground">
{dispute.reason}
</p>
</div>
</div>
{/* Details */}
<div className="grid grid-cols-3 gap-4 text-sm pl-7">
<div>
<p className="text-muted-foreground text-xs mb-1">
Created
</p>
<p className="font-semibold">
{new Date(dispute.createdDate).toLocaleDateString()}
</p>
</div>
<div>
<p className="text-muted-foreground text-xs mb-1">
Messages
</p>
<div className="flex items-center gap-1">
<MessageSquare className="h-4 w-4 text-primary" />
<p className="font-semibold">{dispute.messages}</p>
</div>
</div>
<div>
<p className="text-muted-foreground text-xs mb-1">
Evidence
</p>
<p className="font-semibold">
{dispute.evidence.length} files
</p>
</div>
</div>
{/* Evidence */}
{dispute.evidence.length > 0 && (
<div className="pl-7 pt-2">
<p className="text-xs text-muted-foreground mb-2">
Evidence:
</p>
<div className="flex flex-wrap gap-2">
{dispute.evidence.map((file, idx) => (
<div
key={idx}
className="text-xs px-3 py-1 rounded bg-card/50 border border-border/40"
>
📎 {file}
</div>
))}
</div>
</div>
)}
{/* Action */}
<div className="pl-7 pt-2">
<Button
size="sm"
variant="outline"
onClick={(e) => {
e.stopPropagation();
setSelectedDispute(dispute);
}}
>
<MessageSquare className="mr-2 h-4 w-4" />
View Details
</Button>
</div>
</div>
</div>
);
})}
</div>
) : (
<div className="text-center py-12">
<div className="inline-flex items-center justify-center h-16 w-16 rounded-full bg-primary/10 mb-4">
<CheckCircle2 className="h-8 w-8 text-primary" />
</div>
<h3 className="text-lg font-semibold mb-2">No Disputes</h3>
<p className="text-muted-foreground mb-6">
You don't have any active disputes.
</p>
<Button onClick={() => setShowDisputeForm(true)} variant="outline">
Learn More About Disputes
</Button>
</div>
)}
</div>
{/* Dialogs */}
<DisputeForm open={showDisputeForm} onOpenChange={setShowDisputeForm} />
<DisputeDetailsDialog
dispute={selectedDispute}
open={!!selectedDispute}
onOpenChange={() => setSelectedDispute(null)}
/>
</div>
);
}