import { Dropdown } from "@/components/Dropdown"; import { Icon, Icons } from "@/components/Icon"; import { Modal, ModalCard } from "@/components/layout/Modal"; import { useSettings } from "@/state/settings"; import { useTranslation } from "react-i18next"; import { CaptionCue } from "@/video/components/actions/CaptionRendererAction"; import { Slider } from "@/video/components/popouts/CaptionSettingsPopout"; import { LangCode, captionLanguages } from "@/setup/iso6391"; import { useMemo } from "react"; import { appLanguageOptions } from "@/setup/i18n"; export default function SettingsModal(props: { onClose: () => void; show: boolean; }) { const { captionSettings, language, setLanguage, setCaptionLanguage, setCaptionBackgroundColor, setCaptionColor, setCaptionFontSize, } = useSettings(); const { t, i18n } = useTranslation(); const colors = ["#ffffff", "#00ffff", "#ffff00"]; const selectedCaptionLanguage = useMemo( () => captionLanguages.find((l) => l.id === captionSettings.language)!, [captionSettings.language] ); const captionBackgroundOpacity = ( (parseInt(captionSettings.style.backgroundColor.substring(7, 9), 16) / 255) * 100 ).toFixed(0); return (
{t("settings.title")}
props.onClose()} className="hover:cursor-pointer" >
l.id === language)! } setSelectedItem={(val) => { i18n.changeLanguage(val.id); setLanguage(val.id as LangCode); }} options={appLanguageOptions} />
{ setCaptionLanguage(val.id as LangCode); }} options={captionLanguages} />
setCaptionFontSize(e.target.valueAsNumber)} /> setCaptionBackgroundColor(e.target.valueAsNumber) } />
{colors.map((color) => (
setCaptionColor(color)} >
))}
{selectedCaptionLanguage.id !== "none" ? (
) : null}
); }