feat: complete admin panel major functionalities including responsive layout, recharts, custom modals, inline editing, and loading states

This commit is contained in:
parsa committed 2026-06-12 16:19:57 +03:30
1 parent ee041d4e52
commit a7ebb8d792
33 files changed
+1311 -173

No files matched your search

@@ -0,0 +1,61 @@
import React from 'react';
import { X, AlertTriangle } from 'lucide-react';
interface ConfirmModalProps {
isOpen: boolean;
title: string;
message: string;
onConfirm: () => void;
onCancel: () => void;
confirmText?: string;
cancelText?: string;
isDestructive?: boolean;
}
export default function ConfirmModal({
isOpen,
title,
message,
onConfirm,
onCancel,
confirmText = 'تایید',
cancelText = 'لغو',
isDestructive = true
}: ConfirmModalProps) {
if (!isOpen) return null;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/40 backdrop-blur-sm">
<div className="bg-white rounded-2xl shadow-xl w-full max-w-md overflow-hidden animate-in fade-in zoom-in duration-200">
<div className="flex items-center justify-between p-4 border-b border-gray-100">
<h3 className="text-lg font-bold text-gray-900 flex items-center gap-2">
{isDestructive && <AlertTriangle className="w-5 h-5 text-red-500" />}
{title}
</h3>
<button onClick={onCancel} className="text-gray-400 hover:bg-gray-100 p-1.5 rounded-lg transition-colors">
<X className="w-5 h-5" />
</button>
</div>
<div className="p-6">
<p className="text-gray-600 font-medium leading-relaxed">{message}</p>
</div>
<div className="p-4 border-t border-gray-100 bg-gray-50 flex justify-end gap-3">
<button
onClick={onCancel}
className="px-4 py-2 font-bold text-gray-700 bg-white border border-gray-200 rounded-xl hover:bg-gray-50 transition-colors"
>
{cancelText}
</button>
<button
onClick={onConfirm}
className={`px-4 py-2 font-bold text-white rounded-xl transition-colors ${
isDestructive ? 'bg-red-600 hover:bg-red-700 shadow-md shadow-red-200' : 'bg-purple-600 hover:bg-purple-700 shadow-md shadow-purple-200'
}`}
>
{confirmText}
</button>
</div>
</div>
</div>
);
}
@@ -0,0 +1,7 @@
import React from 'react';
export default function Skeleton({ className = '' }: { className?: string }) {
return (
<div className={`animate-pulse bg-gray-200 rounded-md ${className}`}></div>
);
}
@@ -0,0 +1,17 @@
import React from 'react';
export default function Spinner({ size = 'md', className = '' }: { size?: 'sm' | 'md' | 'lg', className?: string }) {
const sizeClasses = {
sm: 'w-4 h-4',
md: 'w-6 h-6',
lg: 'w-8 h-8'
};
return (
<div className={`inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite] ${sizeClasses[size]} ${className}`} role="status">
<span className="!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]">
درحال بارگذاری...
</span>
</div>
);
}