Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
'use client'
|
||
|
||
import { useState } from 'react'
|
||
|
||
import Input from '@/components/formElements/Input'
|
||
import Modal from '@/components/modals/Modal'
|
||
import { coerceToString } from '@/helpers'
|
||
import { texts } from '@/texts'
|
||
|
||
interface AdminEventRevisionRejectModalProps {
|
||
isLoading: boolean
|
||
isOpen: boolean
|
||
onOpenChange: (open: boolean) => void
|
||
onReject: (rejectionReason: string) => void
|
||
}
|
||
|
||
const AdminEventRevisionRejectModal = ({ isLoading, isOpen, onOpenChange, onReject }: AdminEventRevisionRejectModalProps) => {
|
||
const [rejectionReason, setRejectionReason] = useState('')
|
||
|
||
const reset = () => {
|
||
setRejectionReason('')
|
||
}
|
||
|
||
return (
|
||
<Modal
|
||
acceptDanger
|
||
acceptBtnDisabled={rejectionReason.trim().length < 3}
|
||
acceptBtnText={texts.events.revisionReject}
|
||
isLoading={isLoading}
|
||
isOpen={isOpen}
|
||
rejectBtnText="انصراف"
|
||
size="lg"
|
||
title={texts.events.revisionReject}
|
||
onAccept={() => {
|
||
onReject(rejectionReason.trim())
|
||
}}
|
||
onOpenChange={(open) => {
|
||
onOpenChange(open)
|
||
if (!open) reset()
|
||
}}
|
||
onReject={() => {
|
||
onOpenChange(false)
|
||
reset()
|
||
}}
|
||
>
|
||
<div className="flex flex-col gap-4">
|
||
<p className="text-sm text-text-muted">دلیل رد برای میزبان ارسال میشود؛ نسخهٔ عمومی فعلی رویداد بدون تغییر میماند.</p>
|
||
<Input
|
||
generalType="textarea"
|
||
label={texts.events.revisionRejectReasonLabel}
|
||
name="revisionRejectionReason"
|
||
placeholder="حداقل ۳ کاراکتر"
|
||
textAreaMinRows={3}
|
||
value={rejectionReason}
|
||
onValueChange={(value) => {
|
||
setRejectionReason(coerceToString(value))
|
||
}}
|
||
/>
|
||
</div>
|
||
</Modal>
|
||
)
|
||
}
|
||
|
||
export default AdminEventRevisionRejectModal
|