import type { ReactNode } from "react"; import { useTranslation } from "react-i18next"; import { Loader2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; interface FormActionsProps { isPending?: boolean; submitDisabled?: boolean; onSubmit?: () => void; onCancel?: () => void; submitLabel?: ReactNode; cancelLabel?: ReactNode; loadingLabel?: ReactNode; cancelVariant?: "outline" | "ghost"; className?: string; onNext?: () => void; onPrev?: () => void; nextLabel?: ReactNode; prevLabel?: ReactNode; showSubmit?: boolean; /** * When true and not on the last step, render an extra "Save" button so an * edit can be persisted without navigating through every step. Suppressed * on the last step to avoid a duplicate submit button. */ saveOnEveryStep?: boolean; } export function FormActions({ isPending = false, submitDisabled = false, onSubmit, onCancel, submitLabel, cancelLabel, loadingLabel, cancelVariant = "outline", className, onNext, onPrev, nextLabel, prevLabel, showSubmit = true, saveOnEveryStep = false, }: FormActionsProps) { const { t } = useTranslation(); const cancelText = cancelLabel ?? t("common.cancel", "Ýatyr"); const loadingText = loadingLabel ?? t("common.saving", "Saklanýar..."); const prevText = prevLabel ?? t("common.prev", "Yza"); const nextText = nextLabel ?? t("common.next", "Indiki"); return (