mirror of
https://github.com/p-stream/p-stream.git
synced 2026-01-11 20:10:32 +00:00
update captions selecting view
This commit is contained in:
parent
5f2d623fc3
commit
739d2814fb
4 changed files with 16 additions and 4 deletions
|
|
@ -467,6 +467,7 @@
|
|||
"customChoice": "Drop or upload file",
|
||||
"customizeLabel": "Customize",
|
||||
"offChoice": "Off",
|
||||
"onChoice": "On",
|
||||
"SourceChoice": "Source Captions",
|
||||
"OpenSubtitlesChoice": "OpenSubtitles",
|
||||
"settings": {
|
||||
|
|
|
|||
|
|
@ -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={() =>
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ export function OpenSubtitlesCaptionView({
|
|||
: undefined
|
||||
}
|
||||
onClick={() => startDownload(v.id)}
|
||||
flag
|
||||
>
|
||||
{v.languageName}
|
||||
</CaptionOption>
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ export function SourceCaptionsView({
|
|||
: undefined
|
||||
}
|
||||
onClick={() => startDownload(v.id)}
|
||||
flag
|
||||
>
|
||||
{v.languageName}
|
||||
</CaptionOption>
|
||||
|
|
|
|||
Loading…
Reference in a new issue