mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-10 11:20:49 +00:00
fix: correctly use track for selection
This commit is contained in:
parent
3c417a3306
commit
0d1358d6cb
2 changed files with 6 additions and 3 deletions
|
|
@ -39,6 +39,9 @@ const SubtitleVariant = ({ track, selected, onSelect }: Props) => {
|
|||
const variantLabel = hasValidLabel(track.label) ? track.label : languages.label(track.lang);
|
||||
const downloadFileName = hasValidLabel(track.label) ? track.label : `subtitle-${track.lang || 'unknown'}`;
|
||||
const canCopyUrl = typeof downloadUrl === 'string' && !downloadUrl.startsWith('blob:');
|
||||
const hoverTitle = hasValidLabel(track.label)
|
||||
? track.label
|
||||
: downloadUrl?.split('/').pop()?.split('?')[0] || variantLabel;
|
||||
|
||||
const onSelectClick = useCallback(() => {
|
||||
onSelect(track);
|
||||
|
|
@ -65,7 +68,7 @@ const SubtitleVariant = ({ track, selected, onSelect }: Props) => {
|
|||
return (
|
||||
<Button
|
||||
ref={buttonRef}
|
||||
title={variantLabel}
|
||||
title={hoverTitle}
|
||||
onClick={onSelectClick}
|
||||
className={classNames(styles['variant-option'], { 'selected': selected })}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -106,11 +106,11 @@ const SubtitlesMenu = React.memo(React.forwardRef((props, ref) => {
|
|||
const subtitlesTrackOnSelect = React.useCallback((track) => {
|
||||
if (track.embedded) {
|
||||
if (typeof props.onSubtitlesTrackSelected === 'function') {
|
||||
props.onSubtitlesTrackSelected(track.id);
|
||||
props.onSubtitlesTrackSelected(track);
|
||||
}
|
||||
} else {
|
||||
if (typeof props.onExtraSubtitlesTrackSelected === 'function') {
|
||||
props.onExtraSubtitlesTrackSelected(track.id);
|
||||
props.onExtraSubtitlesTrackSelected(track);
|
||||
}
|
||||
}
|
||||
}, [props.onSubtitlesTrackSelected, props.onExtraSubtitlesTrackSelected]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue