import { useNavigate } from "react-router-dom"; import { ChevronRight, ExternalLink, Loader2, MoreHorizontal, Upload, } from "lucide-react"; import { BookingConfirmDialog } from "./BookingConfirmDialog"; import { useBookingActionDialog } from "./useBookingActionDialog"; import { listRowHasActions, type BookingActionContext, } from "@/features/bookings/booking-actions.config"; import type { BookingListRow } from "@/types/booking"; import { cn } from "@/lib/utils"; import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@edr/ui-common"; interface BookingActionsMenuProps { row: BookingListRow; /** Compact table cell vs. larger detail toolbar */ variant?: "table" | "toolbar"; className?: string; } export function BookingActionsMenu({ row, variant = "table", className, }: BookingActionsMenuProps) { const navigate = useNavigate(); const context: BookingActionContext = { status: row.status, paymentCurrency: row.paymentCurrency, reference: row.reference, }; const flow = useBookingActionDialog(row.id, context); const { actions, pendingAction, mutations } = flow; const goToContract = () => navigate(`/dashboard/booking-requests/${row.id}/contract`); const showUsdPaymentHint = row.status === "FULLY_EXECUTED" && row.paymentCurrency === "USD"; const hasMenu = listRowHasActions(row) || showUsdPaymentHint; const primary = actions.find((a) => a.primary) ?? actions[0]; if (!hasMenu && variant === "table") { return ( ); } return ( <>
No pending approval step found. Accept the submission on the detail page first.
) : null } /> > ); }