admin/features/events/detail/admin-event-detail/AdminEventLifecycleActions.tsx
alisaza 82593dc18c refactor(events): update event management components and remove unused files
- Replaced `LIST_PUBLIC_CATEGORIES` with `LIST_ADMIN_CATEGORIES_FLAT` in `ArticleFormModal.tsx`.
- Removed the "Add Event" button from the dashboard page.
- Simplified the `EventsPage` by removing the button and adjusting the layout.
- Cleaned up the `AdminEventEditPage` by removing unnecessary props.
- Deleted unused layout and page files related to event creation.
- Updated `AdminAuthContent` to use `useAdminCitiesQuery` instead of `useDiscoveryCitiesQuery`.
- Refactored `EventGuestListAccessPanel` to remove the `accessMode` prop and adjust API calls accordingly.
- Removed several unused components and tests related to event creation, enhancing project maintainability.
2026-09-07 18:09:55 +03:30

123 lines
3.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

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 { AdminEventDetailData } from './types'
import Button from '@/components/formElements/Button'
import { APP_ROUTES } from '@/constants/routes'
interface AdminEventLifecycleActionsProps {
event: AdminEventDetailData
pendingId: string | null
onApprove: () => void
onOpenReject: () => void
onForcePublish: () => void
onComplete: () => void
onCancel: () => void
onDelete: () => void
}
const AdminEventLifecycleActions = ({
event,
pendingId,
onApprove,
onOpenReject,
onForcePublish,
onComplete,
onCancel,
onDelete,
}: AdminEventLifecycleActionsProps) => (
<div className="flex max-w-full flex-nowrap items-center justify-end gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
{['draft', 'pending_review', 'published', 'full'].includes(event.status) ? (
<Button
size="sm"
to={APP_ROUTES.MANAGE_EVENT_EDIT(event.id)}
variant="flat"
>
ویرایش
</Button>
) : null}
{event.status === 'draft' && !event.adminApprovedAt ? (
<Button
isLoading={pendingId === 'approve'}
size="sm"
onClick={() => {
onApprove()
}}
>
تأیید برای انتشار
</Button>
) : null}
{event.status === 'draft' && event.adminApprovedAt ? (
<span className="shrink-0 self-center whitespace-nowrap text-xs font-semibold text-fifth-700">تأییدشده؛ منتظر میزبان</span>
) : null}
{event.status === 'pending_review' ? (
<>
<Button
isLoading={pendingId === 'approve'}
size="sm"
onClick={() => {
onApprove()
}}
>
تأیید و انتشار
</Button>
<Button
color="danger"
size="sm"
variant="flat"
onClick={onOpenReject}
>
رد
</Button>
</>
) : null}
{event.status === 'draft' || event.status === 'pending_review' ? (
<Button
aria-label="انتشار فوری بدون تایید میزبان"
isLoading={pendingId === 'force-publish'}
size="sm"
variant="flat"
onClick={() => {
onForcePublish()
}}
>
انتشار فوری
</Button>
) : null}
{event.status === 'published' || event.status === 'full' ? (
<>
<Button
isLoading={pendingId === 'complete'}
size="sm"
variant="flat"
onClick={onComplete}
>
پایان
</Button>
<Button
color="danger"
isLoading={pendingId === 'cancel'}
size="sm"
variant="flat"
onClick={onCancel}
>
لغو
</Button>
</>
) : null}
{event.bookedCount === 0 ? (
<Button
color="danger"
isLoading={pendingId === 'delete'}
size="sm"
variant="flat"
onClick={onDelete}
>
حذف
</Button>
) : null}
</div>
)
export default AdminEventLifecycleActions