import { useState, useRef, useEffect } from "react";
import { useT } from "@/lib/i18n";
interface ConfirmModalProps {
message: string;
onConfirm: () => void;
onCancel: () => void;
}
export function ConfirmModal({ message, onConfirm, onCancel }: ConfirmModalProps) {
const t = useT();
return (
e.stopPropagation()}>
{message}
);
}
interface InputModalProps {
title: string;
onSubmit: (value: string) => void;
onCancel: () => void;
}
export function InputModal({ title, onSubmit, onCancel }: InputModalProps) {
const t = useT();
const [value, setValue] = useState("");
const inputRef = useRef(null);
useEffect(() => {
inputRef.current?.focus();
}, []);
return (
e.stopPropagation()}>
{title}
setValue(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && value && onSubmit(value)}
className="w-full bg-dark-700 border border-dark-600 rounded px-3 py-2 text-sm mb-3"
/>
);
}