Fix frontend type mismatches

This commit is contained in:
2026-05-30 04:52:59 +00:00
parent 7a0247d78f
commit c9d2bcfdcc
3 changed files with 25 additions and 15 deletions
+5 -5
View File
@@ -227,7 +227,7 @@ import ReleaseActionMenu from "./ReleaseActionMenu.vue"
import { sortTorrentsByPreference } from "../composables/useSettings"
const props = defineProps<{
series: Series
series: Series & { root_id?: string | null }
allMovies: MovieUi[]
focusEpisode?: { seasonNumber: number; episodeNumber: number } | null
hasResumePosition: (filePath: string | null) => boolean
@@ -737,7 +737,7 @@ function handleOpenFolder(folderPath: string, rootId?: string | null) {
function handleVersionActivate(torrent: Torrent, event: MouseEvent | KeyboardEvent) {
if (!torrent.playable_file) return
const rootId = torrent.root_id || props.series.root_id
const rootId = torrent.root_id ?? props.series.root_id ?? null
if (event.altKey) {
handleOpenFolder(torrent.playable_file, rootId)
return
@@ -747,7 +747,7 @@ function handleVersionActivate(torrent: Torrent, event: MouseEvent | KeyboardEve
function handleVersionShortcutKeydown(event: KeyboardEvent, torrent: Torrent) {
if (!torrent.playable_file) return
const rootId = torrent.root_id || props.series.root_id
const rootId = torrent.root_id ?? props.series.root_id ?? null
const key = event.key.toLowerCase()
if (key === "e" && (event.metaKey || event.ctrlKey)) {
event.preventDefault()
@@ -759,7 +759,7 @@ function handleVersionShortcutKeydown(event: KeyboardEvent, torrent: Torrent) {
function handleVersionContextMenu(event: MouseEvent, torrent: Torrent) {
event.preventDefault()
event.stopPropagation()
const rootId = torrent.root_id || props.series.root_id
const rootId = torrent.root_id ?? props.series.root_id ?? null
versionActionMenu.value = {
visible: true,
x: event.clientX,
@@ -1013,7 +1013,7 @@ function handleEpisodeHover(eventOrKey: MouseEvent | string, keyOrIsEntering: st
if (isEntering) {
hoveredEpisodeAudioKey = key
videoRefs.value.forEach((v, k) => {
videoRefs.value.forEach((_, k) => {
if (k !== key) {
rampEpisodeVolume(k, 0)
}
+19 -9
View File
@@ -1,5 +1,7 @@
import { shallowRef, readonly, onUnmounted } from "vue"
import type {
CastGender,
CastMember,
Movie,
MovieUi,
Person,
@@ -162,13 +164,7 @@ export function useMediaWebSocket() {
function normalizeCastMember(
member: unknown,
people: Map<number, Person>,
): {
name: string
character: string | null
profile_path: string | null
gender: string | null
id: number | null
} {
): CastMember {
if (!Array.isArray(member)) {
return {
name: "",
@@ -187,7 +183,7 @@ export function useMediaWebSocket() {
name: person?.name || "",
character,
profile_path: person?.profile_path || null,
gender: person?.gender || null,
gender: person?.gender ?? null,
id,
}
}
@@ -204,10 +200,24 @@ export function useMediaWebSocket() {
function normalizePerson(member: unknown): Person | null {
if (!Array.isArray(member)) return null
const gender = normalizeCastGender(member[2])
return {
name: typeof member[0] === "string" ? member[0] : "",
profile_path: typeof member[1] === "string" ? member[1] : null,
gender: typeof member[2] === "string" ? member[2] : null,
gender,
}
}
function normalizeCastGender(value: unknown): CastGender | null {
if (typeof value !== "string") return null
switch (value) {
case "female":
case "male":
case "non_binary":
case "unknown":
return value
default:
return null
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ export interface Info {
tagline: string | null
similar: SimilarMedia[] | null
keywords: string[] | null
cast: CastCreditWire[] | null
cast: CastMember[] | null
director: string | null
creators: string[] | null
number_of_seasons: number | null