forked from FreeTubeApp/FreeTube
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/playlist-search-videos-in-one-user-playlist-2' …
…into custom-builds/current * feature/playlist-search-videos-in-one-user-playlist-2: ! Fix load more button appears when searching & visible items under pagination limit * Update single playlist view for user playlists to add search video function Playlist performance improvements (FreeTubeApp#4597) ! Fix playlist type not passed when playing next/prev item in a user playlist (FreeTubeApp#4623) Properly localize playlist view and video counts (FreeTubeApp#4620) Translated using Weblate (Croatian)
- Loading branch information
Showing
17 changed files
with
409 additions
and
119 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
src/renderer/components/ft-list-video-numbered/ft-list-video-numbered.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
Set a height to invisible/unloaded elements, so that lazy loading actually works. | ||
If we don't set a height, they all get a height of 0px (because they have no content), | ||
so they all bunch up together and end up loading all of them in one go. | ||
*/ | ||
.placeholder { | ||
block-size: 40px; | ||
} | ||
|
||
.videoIndex { | ||
color: var(--tertiary-text-color); | ||
text-align: center; | ||
} | ||
|
||
.videoIndexIcon { | ||
font-size: 14px; | ||
} |
124 changes: 124 additions & 0 deletions
124
src/renderer/components/ft-list-video-numbered/ft-list-video-numbered.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import { defineComponent } from 'vue' | ||
import FtListVideo from '../ft-list-video/ft-list-video.vue' | ||
|
||
export default defineComponent({ | ||
name: 'FtListVideoNumbered', | ||
components: { | ||
'ft-list-video': FtListVideo | ||
}, | ||
props: { | ||
data: { | ||
type: Object, | ||
required: true | ||
}, | ||
playlistId: { | ||
type: String, | ||
default: null | ||
}, | ||
playlistType: { | ||
type: String, | ||
default: null | ||
}, | ||
playlistIndex: { | ||
type: Number, | ||
default: null | ||
}, | ||
playlistReverse: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
playlistShuffle: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
playlistLoop: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
playlistItemId: { | ||
type: String, | ||
default: null, | ||
}, | ||
appearance: { | ||
type: String, | ||
required: true | ||
}, | ||
initialVisibleState: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
alwaysShowAddToPlaylistButton: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
quickBookmarkButtonEnabled: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
canMoveVideoUp: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
canMoveVideoDown: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
canRemoveFromPlaylist: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
videoIndex: { | ||
type: Number, | ||
default: -1 | ||
}, | ||
isCurrentVideo: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
useChannelsHiddenPreference: { | ||
type: Boolean, | ||
default: false, | ||
} | ||
}, | ||
data: function () { | ||
return { | ||
visible: false, | ||
show: true | ||
} | ||
}, | ||
computed: { | ||
channelsHidden() { | ||
// Some component users like channel view will have this disabled | ||
if (!this.useChannelsHiddenPreference) { return [] } | ||
|
||
return JSON.parse(this.$store.getters.getChannelsHidden).map((ch) => { | ||
// Legacy support | ||
if (typeof ch === 'string') { | ||
return { name: ch, preferredName: '', icon: '' } | ||
} | ||
return ch | ||
}) | ||
}, | ||
|
||
// As we only use this component in Playlist and watch-video-playlist, | ||
// where title filtering is never desired, we don't have any title filtering logic here, | ||
// like we do in ft-list-video-lazy | ||
|
||
shouldBeVisible() { | ||
return !(this.channelsHidden.some(ch => ch.name === this.data.authorId) || | ||
this.channelsHidden.some(ch => ch.name === this.data.author)) | ||
} | ||
}, | ||
created() { | ||
this.visible = this.initialVisibleState | ||
}, | ||
methods: { | ||
onVisibilityChanged: function (visible) { | ||
if (visible && this.shouldBeVisible) { | ||
this.visible = visible | ||
} else if (visible) { | ||
this.show = false | ||
} | ||
} | ||
} | ||
}) |
53 changes: 53 additions & 0 deletions
53
src/renderer/components/ft-list-video-numbered/ft-list-video-numbered.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<template> | ||
<div | ||
v-show="show" | ||
v-observe-visibility="!initialVisibleState ? { | ||
callback: onVisibilityChanged, | ||
once: true, | ||
} : null" | ||
:class="{ placeholder: !visible }" | ||
> | ||
<template | ||
v-if="visible" | ||
> | ||
<p | ||
class="videoIndex" | ||
> | ||
<font-awesome-icon | ||
v-if="isCurrentVideo" | ||
class="videoIndexIcon" | ||
:icon="['fas', 'play']" | ||
/> | ||
<template | ||
v-else | ||
> | ||
{{ videoIndex + 1 }} | ||
</template> | ||
</p> | ||
<ft-list-video | ||
:data="data" | ||
:playlist-id="playlistId" | ||
:playlist-type="playlistType" | ||
:playlist-index="playlistIndex" | ||
:playlist-reverse="playlistReverse" | ||
:playlist-shuffle="playlistShuffle" | ||
:playlist-loop="playlistLoop" | ||
:playlist-item-id="playlistItemId" | ||
force-list-type="list" | ||
:appearance="appearance" | ||
:always-show-add-to-playlist-button="alwaysShowAddToPlaylistButton" | ||
:quick-bookmark-button-enabled="quickBookmarkButtonEnabled" | ||
:can-move-video-up="canMoveVideoUp" | ||
:can-move-video-down="canMoveVideoDown" | ||
:can-remove-from-playlist="canRemoveFromPlaylist" | ||
@pause-player="$emit('pause-player')" | ||
@move-video-up="$emit('move-video-up')" | ||
@move-video-down="$emit('move-video-down')" | ||
@remove-from-playlist="$emit('remove-from-playlist')" | ||
/> | ||
</template> | ||
</div> | ||
</template> | ||
|
||
<script src="./ft-list-video-numbered.js" /> | ||
<style scoped src="./ft-list-video-numbered.css" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.