feat(admin): standardize Buttons and Modals across CMS, Catalog, Payment, and FAQ managers
This commit is contained in:
1 parent
32f8b8b656
commit
a92cd7fc85
16 files changed
+895
-748
No files matched your search
@@ -4,6 +4,9 @@ import { toast } from 'react-hot-toast';
|
||||
import api, { BASE_DOMAIN } from '../services/api';
|
||||
import ConfirmModal from '../components/ui/ConfirmModal';
|
||||
import MediaSelector from '../components/ui/MediaSelector';
|
||||
import Button from '../components/ui/Button';
|
||||
import Modal from '../components/ui/Modal';
|
||||
|
||||
|
||||
interface Video {
|
||||
id: string;
|
||||
@@ -179,15 +182,17 @@ export default function Videos() {
|
||||
آپلود و انتخاب مستقیم ویدئو/کاور از گالری رسانه یا درج کد آیفرم آپارات/یوتیوب برای مشاوره ویدئویی دامپزشکان کنینا
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
startIcon={Plus}
|
||||
onClick={() => handleOpenModal()}
|
||||
className="bg-purple-600 hover:bg-purple-700 text-white px-5 py-3 rounded-xl font-black text-sm flex items-center gap-2 shadow-lg shadow-purple-600/20 transition-all hover:scale-105 shrink-0 cursor-pointer"
|
||||
>
|
||||
<Plus className="w-5 h-5" />
|
||||
<span>افزودن ویدئوی جدید</span>
|
||||
</button>
|
||||
افزودن ویدئوی جدید
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="bg-white p-4 rounded-2xl border border-gray-100 shadow-xs flex items-center gap-4">
|
||||
<div className="relative flex-1">
|
||||
<Search className="w-5 h-5 text-gray-400 absolute right-4 top-1/2 -translate-y-1/2" />
|
||||
@@ -310,22 +315,35 @@ export default function Videos() {
|
||||
)}
|
||||
|
||||
{isModalOpen && (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs font-vazir">
|
||||
<div className="bg-white rounded-3xl max-w-2xl w-full p-6 sm:p-8 shadow-2xl border border-gray-100 max-h-[90vh] overflow-y-auto">
|
||||
<div className="flex items-center justify-between pb-4 border-b border-gray-100 mb-6">
|
||||
<h3 className="text-lg font-black text-gray-900 flex items-center gap-2">
|
||||
<VideoIcon className="w-5 h-5 text-purple-600" />
|
||||
{editingVideo ? 'ویرایش ویدئوی آموزشی' : 'افزودن ویدئوی جدید به آکادمی'}
|
||||
</h3>
|
||||
<button
|
||||
<Modal
|
||||
isOpen={isModalOpen}
|
||||
onClose={() => setIsModalOpen(false)}
|
||||
title={editingVideo ? 'ویرایش ویدئوی آموزشی' : 'افزودن ویدئوی جدید به آکادمی'}
|
||||
icon={VideoIcon}
|
||||
maxWidth="2xl"
|
||||
footer={
|
||||
<div className="flex justify-end gap-2.5 w-full">
|
||||
<Button
|
||||
variant="secondary"
|
||||
size="sm"
|
||||
type="button"
|
||||
onClick={() => setIsModalOpen(false)}
|
||||
className="p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-xl transition-colors cursor-pointer"
|
||||
>
|
||||
<X className="w-5 h-5" />
|
||||
</button>
|
||||
انصراف
|
||||
</Button>
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
type="submit"
|
||||
form="videoForm"
|
||||
>
|
||||
ذخیره اطلاعات
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<form onSubmit={handleSave} className="space-y-5">
|
||||
}
|
||||
>
|
||||
<div className="space-y-5 text-right font-vazir">
|
||||
<form id="videoForm" onSubmit={handleSave} className="space-y-5">
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-xs font-black text-gray-700 block">عنوان ویدئو *</label>
|
||||
<input
|
||||
@@ -404,14 +422,15 @@ export default function Videos() {
|
||||
placeholder="آدرس تصویر یا انتخاب از گالری..."
|
||||
className="flex-1 bg-gray-50 border border-gray-200 rounded-xl py-3 px-4 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-purple-500/20"
|
||||
/>
|
||||
<button
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
startIcon={ImageIcon}
|
||||
onClick={() => setIsThumbnailMediaOpen(true)}
|
||||
className="px-4 py-3 bg-purple-50 text-purple-700 hover:bg-purple-100 rounded-xl text-xs font-black flex items-center gap-1.5 border border-purple-200 shrink-0 cursor-pointer"
|
||||
>
|
||||
<ImageIcon className="w-4 h-4" />
|
||||
<span>انتخاب از گالری</span>
|
||||
</button>
|
||||
انتخاب کاور
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -437,14 +456,15 @@ export default function Videos() {
|
||||
placeholder="https://... یا کد آیفرم آپارات/یوتیوب"
|
||||
className="flex-1 bg-gray-50 border border-gray-200 rounded-xl py-3 px-4 text-xs font-mono focus:outline-none focus:ring-2 focus:ring-purple-500/20"
|
||||
/>
|
||||
<button
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
startIcon={Film}
|
||||
onClick={() => setIsVideoMediaOpen(true)}
|
||||
className="px-4 py-3 bg-purple-50 text-purple-700 hover:bg-purple-100 rounded-xl text-xs font-black flex items-center gap-1.5 border border-purple-200 shrink-0 cursor-pointer"
|
||||
>
|
||||
<Film className="w-4 h-4" />
|
||||
<span>انتخاب ویدئو</span>
|
||||
</button>
|
||||
انتخاب ویدئو
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -471,27 +491,12 @@ export default function Videos() {
|
||||
نمایش به عنوان ویدئوی ویژه در بخش «مشاوره ویدئویی» صفحه اصلی سایت
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="pt-4 flex justify-end gap-3 border-t border-gray-100">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsModalOpen(false)}
|
||||
className="px-5 py-2.5 rounded-xl border border-gray-200 text-gray-600 font-bold text-sm hover:bg-gray-50 cursor-pointer"
|
||||
>
|
||||
انصراف
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-6 py-2.5 rounded-xl bg-purple-600 text-white font-bold text-sm hover:bg-purple-700 shadow-md cursor-pointer"
|
||||
>
|
||||
ذخیره اطلاعات
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
|
||||
{/* Cover Thumbnail Media Selector Modal */}
|
||||
<MediaSelector
|
||||
isOpen={isThumbnailMediaOpen}
|
||||
|
||||
Reference in new issue
Block a user