admin/features/events/detail/admin-event-detail/AdminEventPendingRevisionCard.tsx
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

77 lines
2.9 KiB
TypeScript
Raw 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 { formatNumber } from '@/helpers'
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, capacity } = 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-3">
{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}
{capacity != null && Number.isFinite(Number(capacity)) ? (
<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">{formatNumber(Number(capacity))}</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