import { Edit, Trash2 } from "lucide-react"; import { TextPair } from "./InFolder"; import { updatePairById } from "@/lib/server/services/pairService"; import { useState } from "react"; import UpdateTextPairModal from "./UpdateTextPairModal"; import { useTranslations } from "next-intl"; import { PairUpdateInput } from "../../../../generated/prisma/models"; interface TextPairCardProps { textPair: TextPair; onDel: () => void; refreshTextPairs: () => void; } export default function TextPairCard({ textPair, onDel, refreshTextPairs, }: TextPairCardProps) { const [openUpdateModal, setOpenUpdateModal] = useState(false); const t = useTranslations("folder_id"); return (
{textPair.locale1.toUpperCase()} {textPair.locale2.toUpperCase()}
{textPair.text1.length > 30 ? textPair.text1.substring(0, 30) + "..." : textPair.text1}
{textPair.text2.length > 30 ? textPair.text2.substring(0, 30) + "..." : textPair.text2}
setOpenUpdateModal(false)} onUpdate={async (id: number, data: PairUpdateInput) => { await updatePairById(id, data); setOpenUpdateModal(false); refreshTextPairs(); }} textPair={textPair} />
); }