mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Use a slot for displaying the loading indicator content
				
					
				
			This commit is contained in:
		
							parent
							
								
									cc48fe8e27
								
							
						
					
					
						commit
						ae855c2bac
					
				
					 7 changed files with 41 additions and 45 deletions
				
			
		| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <ErrorHandler v-if="channel && channel.error" :message="channel.message" :error="channel.error" />
 | 
					    <ErrorHandler v-if="channel && channel.error" :message="channel.message" :error="channel.error" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div v-if="channel" v-show="!channel.error">
 | 
					    <LoadingIndicatorPage :show-content="channel != null && !channel.error">
 | 
				
			||||||
        <div class="flex justify-center place-items-center">
 | 
					        <div class="flex justify-center place-items-center">
 | 
				
			||||||
            <img height="48" width="48" class="rounded-full m-1" :src="channel.avatarUrl" />
 | 
					            <img height="48" width="48" class="rounded-full m-1" :src="channel.avatarUrl" />
 | 
				
			||||||
            <h1 v-text="channel.name" />
 | 
					            <h1 v-text="channel.name" />
 | 
				
			||||||
| 
						 | 
					@ -61,24 +61,21 @@
 | 
				
			||||||
                hide-channel
 | 
					                hide-channel
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </LoadingIndicatorPage>
 | 
				
			||||||
    <div v-else>
 | 
					 | 
				
			||||||
        <LoadingIndicator />
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import ErrorHandler from "./ErrorHandler.vue";
 | 
					import ErrorHandler from "./ErrorHandler.vue";
 | 
				
			||||||
import ContentItem from "./ContentItem.vue";
 | 
					import ContentItem from "./ContentItem.vue";
 | 
				
			||||||
import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
 | 
					import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
 | 
				
			||||||
import LoadingIndicator from "./LoadingIndicator.vue";
 | 
					import LoadingIndicatorPage from "./LoadingIndicatorPage.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    components: {
 | 
					    components: {
 | 
				
			||||||
        ErrorHandler,
 | 
					        ErrorHandler,
 | 
				
			||||||
        ContentItem,
 | 
					        ContentItem,
 | 
				
			||||||
        WatchOnYouTubeButton,
 | 
					        WatchOnYouTubeButton,
 | 
				
			||||||
        LoadingIndicator,
 | 
					        LoadingIndicatorPage,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,32 +24,29 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <hr />
 | 
					    <hr />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div v-if="videos.length != 0" class="video-grid">
 | 
					    <LoadingIndicatorPage :show-content="videosStore != null" class="video-grid">
 | 
				
			||||||
        <template v-for="video in videos" :key="video.url">
 | 
					        <template v-for="video in videos" :key="video.url">
 | 
				
			||||||
            <VideoItem v-if="shouldShowVideo(video)" :is-feed="true" :item="video" />
 | 
					            <VideoItem v-if="shouldShowVideo(video)" :is-feed="true" :item="video" />
 | 
				
			||||||
        </template>
 | 
					        </template>
 | 
				
			||||||
    </div>
 | 
					    </LoadingIndicatorPage>
 | 
				
			||||||
    <div v-else>
 | 
					 | 
				
			||||||
        <LoadingIndicator />
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import VideoItem from "./VideoItem.vue";
 | 
					import VideoItem from "./VideoItem.vue";
 | 
				
			||||||
import SortingSelector from "./SortingSelector.vue";
 | 
					import SortingSelector from "./SortingSelector.vue";
 | 
				
			||||||
import LoadingIndicator from "./LoadingIndicator.vue";
 | 
					import LoadingIndicatorPage from "./LoadingIndicatorPage.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    components: {
 | 
					    components: {
 | 
				
			||||||
        VideoItem,
 | 
					        VideoItem,
 | 
				
			||||||
        SortingSelector,
 | 
					        SortingSelector,
 | 
				
			||||||
        LoadingIndicator,
 | 
					        LoadingIndicatorPage,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            currentVideoCount: 0,
 | 
					            currentVideoCount: 0,
 | 
				
			||||||
            videoStep: 100,
 | 
					            videoStep: 100,
 | 
				
			||||||
            videosStore: [],
 | 
					            videosStore: null,
 | 
				
			||||||
            videos: [],
 | 
					            videos: [],
 | 
				
			||||||
            availableFilters: ["all", "shorts", "videos"],
 | 
					            availableFilters: ["all", "shorts", "videos"],
 | 
				
			||||||
            selectedFilter: "all",
 | 
					            selectedFilter: "all",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,9 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <div class="flex min-h-[75vh] w-full justify-center items-center">
 | 
					    <div v-if="!showContent" class="flex min-h-[75vh] w-full justify-center items-center">
 | 
				
			||||||
        <span id="spinner"></span>
 | 
					        <span id="spinner" />
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    <div v-else>
 | 
				
			||||||
 | 
					        <slot />
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,3 +42,14 @@
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
					    props: {
 | 
				
			||||||
 | 
					        showContent: {
 | 
				
			||||||
 | 
					            type: Boolean,
 | 
				
			||||||
 | 
					            required: true,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <ErrorHandler v-if="playlist && playlist.error" :message="playlist.message" :error="playlist.error" />
 | 
					    <ErrorHandler v-if="playlist && playlist.error" :message="playlist.message" :error="playlist.error" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div v-if="playlist" v-show="!playlist.error">
 | 
					    <LoadingIndicatorPage :show-content="playlist" v-show="!playlist.error">
 | 
				
			||||||
        <h1 class="text-center my-4" v-text="playlist.name" />
 | 
					        <h1 class="text-center my-4" v-text="playlist.name" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div class="flex justify-between items-center">
 | 
					        <div class="flex justify-between items-center">
 | 
				
			||||||
| 
						 | 
					@ -46,15 +46,12 @@
 | 
				
			||||||
                width="168"
 | 
					                width="168"
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </LoadingIndicatorPage>
 | 
				
			||||||
    <div v-else>
 | 
					 | 
				
			||||||
        <LoadingIndicator />
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import ErrorHandler from "./ErrorHandler.vue";
 | 
					import ErrorHandler from "./ErrorHandler.vue";
 | 
				
			||||||
import LoadingIndicator from "./LoadingIndicator.vue";
 | 
					import LoadingIndicatorPage from "./LoadingIndicatorPage.vue";
 | 
				
			||||||
import VideoItem from "./VideoItem.vue";
 | 
					import VideoItem from "./VideoItem.vue";
 | 
				
			||||||
import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
 | 
					import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,7 +60,7 @@ export default {
 | 
				
			||||||
        ErrorHandler,
 | 
					        ErrorHandler,
 | 
				
			||||||
        VideoItem,
 | 
					        VideoItem,
 | 
				
			||||||
        WatchOnYouTubeButton,
 | 
					        WatchOnYouTubeButton,
 | 
				
			||||||
        LoadingIndicator,
 | 
					        LoadingIndicatorPage,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,24 +18,21 @@
 | 
				
			||||||
        </i18n-t>
 | 
					        </i18n-t>
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div v-if="results != null && results.items.length != 0" class="video-grid">
 | 
					    <LoadingIndicatorPage :show-content="results != null && results.items?.length" class="video-grid">
 | 
				
			||||||
        <template v-for="result in results.items" :key="result.url">
 | 
					        <template v-for="result in results.items" :key="result.url">
 | 
				
			||||||
            <ContentItem :item="result" height="94" width="168" />
 | 
					            <ContentItem :item="result" height="94" width="168" />
 | 
				
			||||||
        </template>
 | 
					        </template>
 | 
				
			||||||
    </div>
 | 
					    </LoadingIndicatorPage>
 | 
				
			||||||
    <div v-else>
 | 
					 | 
				
			||||||
        <LoadingIndicator />
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import ContentItem from "./ContentItem.vue";
 | 
					import ContentItem from "./ContentItem.vue";
 | 
				
			||||||
import LoadingIndicator from "./LoadingIndicator.vue";
 | 
					import LoadingIndicatorPage from "./LoadingIndicatorPage.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    components: {
 | 
					    components: {
 | 
				
			||||||
        ContentItem,
 | 
					        ContentItem,
 | 
				
			||||||
        LoadingIndicator,
 | 
					        LoadingIndicatorPage,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,22 +3,19 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <hr />
 | 
					    <hr />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div v-if="videos.length != 0" class="video-grid">
 | 
					    <LoadingIndicatorPage :show-content="videos.length != 0" class="video-grid">
 | 
				
			||||||
        <VideoItem v-for="video in videos" :key="video.url" :item="video" height="118" width="210" />
 | 
					        <VideoItem v-for="video in videos" :key="video.url" :item="video" height="118" width="210" />
 | 
				
			||||||
    </div>
 | 
					    </LoadingIndicatorPage>
 | 
				
			||||||
    <div v-else>
 | 
					 | 
				
			||||||
        <LoadingIndicator />
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import LoadingIndicator from "./LoadingIndicator.vue";
 | 
					import LoadingIndicatorPage from "./LoadingIndicatorPage.vue";
 | 
				
			||||||
import VideoItem from "./VideoItem.vue";
 | 
					import VideoItem from "./VideoItem.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    components: {
 | 
					    components: {
 | 
				
			||||||
        VideoItem,
 | 
					        VideoItem,
 | 
				
			||||||
        LoadingIndicator,
 | 
					        LoadingIndicatorPage,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -12,7 +12,7 @@
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <div v-if="video && !isEmbed" class="w-full">
 | 
					    <LoadingIndicatorPage :show-content="video && !isEmbed" class="w-full">
 | 
				
			||||||
        <ErrorHandler v-if="video && video.error" :message="video.message" :error="video.error" />
 | 
					        <ErrorHandler v-if="video && video.error" :message="video.message" :error="video.error" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <div v-show="!video.error">
 | 
					        <div v-show="!video.error">
 | 
				
			||||||
| 
						 | 
					@ -217,10 +217,7 @@
 | 
				
			||||||
                <hr class="sm:hidden" />
 | 
					                <hr class="sm:hidden" />
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    </div>
 | 
					    </LoadingIndicatorPage>
 | 
				
			||||||
    <div v-else>
 | 
					 | 
				
			||||||
        <LoadingIndicator />
 | 
					 | 
				
			||||||
    </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
| 
						 | 
					@ -233,7 +230,7 @@ import PlaylistAddModal from "./PlaylistAddModal.vue";
 | 
				
			||||||
import ShareModal from "./ShareModal.vue";
 | 
					import ShareModal from "./ShareModal.vue";
 | 
				
			||||||
import PlaylistVideos from "./PlaylistVideos.vue";
 | 
					import PlaylistVideos from "./PlaylistVideos.vue";
 | 
				
			||||||
import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
 | 
					import WatchOnYouTubeButton from "./WatchOnYouTubeButton.vue";
 | 
				
			||||||
import LoadingIndicator from "./LoadingIndicator.vue";
 | 
					import LoadingIndicatorPage from "./LoadingIndicatorPage.vue";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    name: "App",
 | 
					    name: "App",
 | 
				
			||||||
| 
						 | 
					@ -247,7 +244,7 @@ export default {
 | 
				
			||||||
        ShareModal,
 | 
					        ShareModal,
 | 
				
			||||||
        PlaylistVideos,
 | 
					        PlaylistVideos,
 | 
				
			||||||
        WatchOnYouTubeButton,
 | 
					        WatchOnYouTubeButton,
 | 
				
			||||||
        LoadingIndicator,
 | 
					        LoadingIndicatorPage,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        const smallViewQuery = window.matchMedia("(max-width: 640px)");
 | 
					        const smallViewQuery = window.matchMedia("(max-width: 640px)");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue