import { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { CaptionCue } from "@/_oldvideo/components/actions/CaptionRendererAction"; import CaptionColorSelector, { colors, } from "@/components/CaptionColorSelector"; import { Dropdown } from "@/components/Dropdown"; import { Icon, Icons } from "@/components/Icon"; import { Modal, ModalCard } from "@/components/layout/Modal"; import { Slider } from "@/components/Slider"; import { conf } from "@/setup/config"; import { appLanguageOptions } from "@/setup/i18n"; import { CaptionLanguageOption, LangCode, captionLanguages, } from "@/setup/iso6391"; import { useSettings } from "@/state/settings"; export default function SettingsModal(props: { onClose: () => void; show: boolean; }) { const { captionSettings, language, setLanguage, setCaptionLanguage, setCaptionBackgroundColor, setCaptionFontSize, } = useSettings(); const { t, i18n } = useTranslation(); const selectedCaptionLanguage = useMemo( () => captionLanguages.find((l) => l.id === captionSettings.language), [captionSettings.language] ) as CaptionLanguageOption; const appLanguage = useMemo( () => appLanguageOptions.find((l) => l.id === language), [language] ) as CaptionLanguageOption; const captionBackgroundOpacity = ( (parseInt(captionSettings.style.backgroundColor.substring(7, 9), 16) / 255) * 100 ).toFixed(0); return (
{t("settings.title")}
props.onClose()} className="hover:cursor-pointer" >
{ 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) => ( ))}
v{conf().APP_VERSION}
); }