import LightButton from "@/components/ui/buttons/LightButton"; import { useRef } from "react"; import { useTranslations } from "next-intl"; export default function UploadArea({ setVideoUrl, setSrtUrl, }: { setVideoUrl: (url: string | null) => void; setSrtUrl: (url: string | null) => void; }) { const t = useTranslations("srt_player"); const inputRef = useRef(null); const uploadVideo = () => { const input = inputRef.current; if (input) { input.setAttribute("accept", "video/*"); input.click(); input.onchange = () => { const file = input.files?.[0]; if (file) { setVideoUrl(URL.createObjectURL(file)); } }; } }; const uploadSRT = () => { const input = inputRef.current; if (input) { input.setAttribute("accept", ".srt"); input.click(); input.onchange = () => { const file = input.files?.[0]; if (file) { setSrtUrl(URL.createObjectURL(file)); } }; } }; return (
{t("uploadVideo")} {t("uploadSubtitle")}
); }