2026-01-07 09:31:02 +00:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import { Button } from '../../ui/button';
|
|
|
|
|
import { X, RefreshCcw, UploadCloud } from 'lucide-react';
|
2026-01-26 13:12:17 +00:00
|
|
|
import { useToast } from '../../../components/feedback/ToastProvider';
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
interface RefundRequestModalProps {
|
|
|
|
|
orderId: string;
|
|
|
|
|
onClose: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const RefundRequestModal: React.FC<RefundRequestModalProps> = ({
|
|
|
|
|
orderId,
|
|
|
|
|
onClose,
|
|
|
|
|
}) => {
|
2026-01-07 09:31:02 +00:00
|
|
|
const { addToast } = useToast();
|
|
|
|
|
const [reason, setReason] = useState('Duplicate Purchase');
|
|
|
|
|
const [details, setDetails] = useState('');
|
|
|
|
|
|
|
|
|
|
const handleSubmit = () => {
|
2026-01-13 18:47:57 +00:00
|
|
|
addToast(`Refund request submitted for Order #${orderId}`, 'success');
|
|
|
|
|
onClose();
|
2026-01-07 09:31:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div
|
|
|
|
|
className="absolute inset-0 bg-kodo-void/90 backdrop-blur-sm"
|
|
|
|
|
onClick={onClose}
|
|
|
|
|
></div>
|
2026-01-07 09:31:02 +00:00
|
|
|
<div className="relative w-full max-w-lg bg-kodo-graphite border border-kodo-steel rounded-xl shadow-2xl animate-scaleIn overflow-hidden">
|
|
|
|
|
<div className="p-4 border-b border-kodo-steel bg-kodo-ink flex justify-between items-center">
|
|
|
|
|
<h3 className="font-bold text-white flex items-center gap-2">
|
|
|
|
|
<RefreshCcw className="w-4 h-4 text-kodo-orange" /> Request Refund
|
|
|
|
|
</h3>
|
2026-01-13 18:47:57 +00:00
|
|
|
<button onClick={onClose}>
|
2026-01-16 00:59:31 +00:00
|
|
|
<X className="w-5 h-5 text-kodo-content-dim hover:text-white" />
|
2026-01-13 18:47:57 +00:00
|
|
|
</button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="p-6 space-y-4">
|
2026-01-16 00:59:31 +00:00
|
|
|
<p className="text-sm text-kodo-content-dim">
|
2026-01-13 18:47:57 +00:00
|
|
|
Refund requests are subject to approval. Please provide details
|
|
|
|
|
below for Order{' '}
|
|
|
|
|
<span className="font-mono text-white">#{orderId}</span>.
|
|
|
|
|
</p>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div>
|
2026-01-16 00:59:31 +00:00
|
|
|
<label className="block text-xs font-bold text-kodo-content-dim uppercase mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Reason
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
2026-01-16 10:40:13 +00:00
|
|
|
className="w-full bg-kodo-void border border-kodo-steel rounded-lg px-4 py-2.5 text-white focus:border-kodo-steel outline-none"
|
2026-01-13 18:47:57 +00:00
|
|
|
value={reason}
|
|
|
|
|
onChange={(e) => setReason(e.target.value)}
|
|
|
|
|
>
|
|
|
|
|
<option>Duplicate Purchase</option>
|
|
|
|
|
<option>Accidental Purchase</option>
|
|
|
|
|
<option>Quality Issue / Corrupted File</option>
|
|
|
|
|
<option>Other</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div>
|
2026-01-16 00:59:31 +00:00
|
|
|
<label className="block text-xs font-bold text-kodo-content-dim uppercase mb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Details
|
|
|
|
|
</label>
|
|
|
|
|
<textarea
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
className="w-full bg-kodo-void border border-kodo-steel rounded-lg p-4 text-white focus:border-kodo-steel outline-none text-sm resize-none h-24"
|
2026-01-13 18:47:57 +00:00
|
|
|
placeholder="Please explain why you are requesting a refund..."
|
|
|
|
|
value={details}
|
|
|
|
|
onChange={(e) => setDetails(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="border-2 border-dashed border-kodo-steel rounded-lg p-6 flex flex-col items-center justify-center text-kodo-content-dim hover:text-white hover:border-kodo-steel cursor-pointer transition-colors">
|
2026-01-13 18:47:57 +00:00
|
|
|
<UploadCloud className="w-8 h-8 mb-2" />
|
|
|
|
|
<span className="text-xs font-bold uppercase">
|
|
|
|
|
Upload Evidence (Optional)
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
<div className="p-4 border-t border-kodo-steel bg-kodo-ink flex justify-end gap-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Button variant="ghost" onClick={onClose}>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
<Button variant="primary" onClick={handleSubmit}>
|
|
|
|
|
Submit Request
|
|
|
|
|
</Button>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|