Fix for falsy types

This commit is contained in:
Kavin
2026-03-27 00:55:11 +05:30
parent 5f647ffe2a
commit 3e79a04fe3
3 changed files with 17 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
<template>
<ErrorHandler v-if="playlist && playlist.error" :message="playlist.message" :error="playlist.error" />
<LoadingIndicatorPage v-show="!playlist?.error" :show-content="playlist">
<LoadingIndicatorPage v-show="!playlist?.error" :show-content="playlist != null">
<h1 class="mb-1 ml-1 mt-4 text-3xl!" v-text="playlist.name" />
<CollapsableText v-if="playlist?.description" :text="playlist.description" />
@@ -16,7 +16,9 @@
<div class="flex flex-wrap items-center gap-1">
<strong
v-text="
`${playlist.videos} ${$t('video.videos')} - ${timeFormat(totalDuration)}${playlist.nextpage ? '+' : ''}`
`${playlist.videos} ${$t('video.videos')} - ${timeFormat(totalDuration)}${
playlist.nextpage ? '+' : ''
}`
"
/>
<button v-if="!isPipedPlaylist" class="btn mx-1" @click="bookmarkPlaylist">

View File

@@ -18,7 +18,7 @@
</i18n-t>
</div>
<LoadingIndicatorPage :show-content="results != null && results.items?.length" class="video-grid">
<LoadingIndicatorPage :show-content="Boolean(results != null && results.items?.length)" class="video-grid">
<template v-for="result in results.items" :key="result.url">
<ContentItem :item="result" height="94" width="168" />
</template>

View File

@@ -10,7 +10,7 @@
/>
</div>
<div id="theaterModeSpot" class="-mx-1vw"></div>
<LoadingIndicatorPage :show-content="video && !isEmbed" class="w-full">
<LoadingIndicatorPage :show-content="video != null && !isEmbed" class="w-full">
<ErrorHandler v-if="video && video.error" :message="video.message" :error="video.error" />
<Transition>
<ToastComponent v-if="shouldShowToast" @dismissed="dismiss">
@@ -27,7 +27,7 @@
ref="videoPlayer"
:video="video"
:sponsors="sponsors"
:selected-auto-play="selectedAutoPlay"
:selected-auto-play="selectedAutoPlayEnabled"
:selected-auto-loop="selectedAutoLoop"
@timeupdate="onTimeUpdate"
@ended="onVideoEnded"
@@ -251,7 +251,12 @@
/>
<br />
<label for="chkAutoPlay"><strong v-text="`${$t('actions.auto_play_next_video')}:`" /></label>
<select id="chkAutoPlay" v-model="selectedAutoPlay" class="select ml-1.5" @change="onChange($event)">
<select
id="chkAutoPlay"
v-model.number="selectedAutoPlay"
class="select ml-1.5"
@change="onChange($event)"
>
<option v-t="'actions.never'" value="0" />
<option v-t="'actions.playlists_only'" value="1" />
<option v-t="'actions.always'" value="2" />
@@ -419,6 +424,10 @@ const isListening = computed(() => {
return getPreferenceBoolean("listen", false);
});
const selectedAutoPlayEnabled = computed(() => {
return Number(selectedAutoPlay.value) >= 1;
});
const toggleListenUrl = computed(() => {
const url = new URL(window.location.href);
url.searchParams.set("listen", isListening.value ? "0" : "1");