update captions selecting view

This commit is contained in:
Pas 2025-04-17 14:34:13 -06:00
parent 5f2d623fc3
commit 739d2814fb
4 changed files with 16 additions and 4 deletions

View file

@ -467,6 +467,7 @@
"customChoice": "Drop or upload file",
"customizeLabel": "Customize",
"offChoice": "Off",
"onChoice": "On",
"SourceChoice": "Source Captions",
"OpenSubtitlesChoice": "OpenSubtitles",
"settings": {

View file

@ -22,6 +22,7 @@ export function CaptionOption(props: {
loading?: boolean;
onClick?: () => void;
error?: React.ReactNode;
flag?: boolean;
}) {
return (
<SelectableLink
@ -34,9 +35,11 @@ export function CaptionOption(props: {
data-active-link={props.selected ? true : undefined}
className="flex items-center"
>
<span data-code={props.countryCode} className="mr-3 inline-flex">
<FlagIcon langCode={props.countryCode} />
</span>
{props.flag ? (
<span data-code={props.countryCode} className="mr-3 inline-flex">
<FlagIcon langCode={props.countryCode} />
</span>
) : null}
<span>{props.children}</span>
</span>
</SelectableLink>
@ -92,7 +95,7 @@ export function CaptionsView({
const { t } = useTranslation();
const router = useOverlayRouter(id);
const selectedCaptionId = usePlayerStore((s) => s.caption.selected?.id);
const { disable } = useCaptions();
const { disable, toggleLastUsed } = useCaptions();
const [dragging, setDragging] = useState(false);
const setCaption = usePlayerStore((s) => s.setCaption);
const selectedCaptionLanguage = usePlayerStore(
@ -192,6 +195,12 @@ export function CaptionsView({
>
{t("player.menus.subtitles.offChoice")}
</CaptionOption>
<CaptionOption
onClick={() => toggleLastUsed().catch(() => {})}
selected={!!selectedCaptionId}
>
{t("player.menus.subtitles.onChoice")}
</CaptionOption>
<CustomCaptionOption />
<Menu.ChevronLink
onClick={() =>

View file

@ -63,6 +63,7 @@ export function OpenSubtitlesCaptionView({
: undefined
}
onClick={() => startDownload(v.id)}
flag
>
{v.languageName}
</CaptionOption>

View file

@ -95,6 +95,7 @@ export function SourceCaptionsView({
: undefined
}
onClick={() => startDownload(v.id)}
flag
>
{v.languageName}
</CaptionOption>