Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit "preview" in video flavors drop down of subtitle editor #978

Merged
merged 2 commits into from
Mar 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/main/SubtitleVideoArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,21 @@ const VideoSelectDropdown : React.FC<{
return flavor.type + "/" + flavor.subtype
}

const getFlavorLabel = (flavor: Flavor) => {
// Omit subtype if all flavour subtypes are equal
if (flavors.every((f) => f.subtype === flavors[0].subtype)) {
return flavor.type
}

return stringifyFlavor(flavor)
}

// Data to populate the dropdown with
const selectData = () => {
const data = []
for (let flavor of flavors) {
// We have to deconstruct the flavor object for the value as well and put it back together
data.push({label: stringifyFlavor(flavor), value: stringifyFlavor(flavor)})
data.push({label: getFlavorLabel(flavor), value: stringifyFlavor(flavor)})
}
return data
}
Expand Down