admin/features/events/detail/admin-event-detail/AdminEventPendingRevisionCard.tsx
alisaza 2da1c5e80f fix(events): align admin capacity API with direct live edits
Support optional capacity on the reserved-capacity patch and stop showing
proposed capacity on pending revision cards.
2026-09-11 15:52:29 +03:30

70 lines
2.4 KiB
TypeScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client'
import type { EventRevision } from '@/services/events'
import Button from '@/components/formElements/Button'
import { Card, CardBody } from '@/components/heroui/Card'
import { texts } from '@/texts'
interface AdminEventPendingRevisionCardProps {
pendingId: string | null
revision: EventRevision
onApprove: () => void
onReject: () => void
}
const AdminEventPendingRevisionCard = ({ pendingId, revision, onApprove, onReject }: AdminEventPendingRevisionCardProps) => {
const { title, slug } = revision.payload
return (
<Card className="admin-surface">
<CardBody className="flex flex-col gap-4 p-4">
<div className="flex flex-col gap-1">
<h2 className="text-base font-bold text-secondary-10">{texts.events.revisionPendingCardTitle}</h2>
<p className="text-xs text-text-muted">ارسالشده: {new Date(revision.submittedAt).toLocaleString('fa-IR')}</p>
</div>
<dl className="grid gap-2 sm:grid-cols-2">
{title != null && title !== '' ? (
<div className="rounded-xl border border-secondary-40 bg-secondary-50/60 p-3 text-right">
<dt className="text-xs text-secondary-30">عنوان پیشنهادی</dt>
<dd className="mt-1 text-sm font-semibold text-secondary-20">{String(title)}</dd>
</div>
) : null}
{slug != null && slug !== '' ? (
<div className="rounded-xl border border-secondary-40 bg-secondary-50/60 p-3 text-right">
<dt className="text-xs text-secondary-30">اسلاگ پیشنهادی</dt>
<dd
className="mt-1 break-all text-sm font-semibold text-secondary-20"
dir="ltr"
>
{String(slug)}
</dd>
</div>
) : null}
</dl>
<div className="flex flex-wrap items-center justify-end gap-2">
<Button
isLoading={pendingId === 'approve-revision'}
size="sm"
onClick={onApprove}
>
{texts.events.revisionApprove}
</Button>
<Button
color="danger"
disabled={pendingId === 'approve-revision'}
size="sm"
variant="flat"
onClick={onReject}
>
{texts.events.revisionReject}
</Button>
</div>
</CardBody>
</Card>
)
}
export default AdminEventPendingRevisionCard