"use client"; import type { ReactNode } from "react"; import { TriangleAlertIcon } from "lucide-react"; import { CopyButton } from "@/components/copyButton"; import { LanguageSelect } from "@/components/languageSelect"; import { TokenizedText } from "@/components/tokenizedText"; import { Card, CardContent, CardHeader } from "@/components/ui/card"; import { Marker, MarkerContent, MarkerIcon } from "@/components/ui/marker"; import { Separator } from "@/components/ui/separator"; import { Textarea } from "@/components/ui/textarea"; import type { ApiError } from "@/lib/api"; import { cn } from "@/lib/utils"; import { useApiErrorMessage } from "@/lib/useApiErrorMessage"; import type { Language } from "@/types/api"; import type { UiLanguage } from "@/types/language"; import { useTranslations } from "next-intl"; interface TranslationCardProps { variant: "source" | "target"; lang: UiLanguage; onLangChange: (lang: UiLanguage) => void; excludeLangId?: Language; placeholder: string; text: string; onTextChange?: (text: string) => void; isLoading?: boolean; error?: ApiError | null; onSelectWord: (word: string) => void; footerExtra?: ReactNode; } export function TranslationCard({ variant, lang, onLangChange, excludeLangId, placeholder, text, onTextChange, isLoading, error, onSelectWord, footerExtra, }: TranslationCardProps) { const isSource = variant === "source"; const t = useTranslations("Home"); const apiErrorMessage = useApiErrorMessage(error?.kind); return ( {isSource ? (