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

User playlists as grid #4949

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
db4b49f
Implement user playlist grid view
kommunarr Apr 12, 2024
1b65a7c
Update to use listType setting for user playlist display type
kommunarr Apr 12, 2024
47e7dda
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 16, 2024
e46d897
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 17, 2024
8843c46
Implement styling fixes & adjustments
kommunarr Apr 17, 2024
5cabcc2
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 17, 2024
93e73db
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 17, 2024
8a89024
Update ft-refresh-widget to use fixed-top-bar mixin
kommunarr Apr 17, 2024
49c8165
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 18, 2024
c931596
Fix mixin
kommunarr Apr 18, 2024
0d8ce5c
Disable quick bookmark button on Quick Bookmark playlist
kommunarr Apr 18, 2024
7d2eec5
Fix isLoading artifact
kommunarr Apr 18, 2024
7e897e1
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 19, 2024
91f1e68
Implement missing Edit Mode properties for grid view
kommunarr Apr 21, 2024
a30687c
Make playlist title fixed height
kommunarr Apr 21, 2024
6684baf
Standardize gap between top bar and bottom section using CSS variable…
kommunarr Apr 21, 2024
70c8d30
Make effectiveListType computed property
kommunarr Apr 24, 2024
14f6036
Force list view on playlists for mobile devices
kommunarr Apr 24, 2024
1a47ec4
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr Apr 25, 2024
85503a6
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr May 2, 2024
c348a1a
Merge branch 'development' into feat/user-playlists-as-grid
kommunarr May 4, 2024
036712c
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr May 4, 2024
bc70bd0
Update to adjust height properly when playlist only has one item, not…
kommunarr May 4, 2024
ecc2866
Move is-side-nav-open and fixed-top-bar mixins to new partial file
kommunarr May 17, 2024
af1af9d
Add height threshold for forcing list view on playlist route
kommunarr May 19, 2024
a866963
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr May 20, 2024
63172c6
Make user playlist grid top section sticky, not fixed
kommunarr May 20, 2024
6faf21b
Merge branch 'development' of github.com:FreeTubeApp/FreeTube into fe…
kommunarr May 21, 2024
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
8 changes: 8 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ const SyncEvents = {
// Utils
const MAIN_PROFILE_ID = 'allChannels'

// Width threshold in px at which we switch to using a more heavily altered view for mobile users
const MOBILE_WIDTH_THRESHOLD = 680

// Height threshold in px at which we switch to using a more heavily altered playlist view for mobile users
const PLAYLIST_HEIGHT_FORCE_LIST_THRESHOLD = 500

// YouTube search character limit is 100 characters
const SEARCH_CHAR_LIMIT = 100

Expand All @@ -85,5 +91,7 @@ export {
DBActions,
SyncEvents,
MAIN_PROFILE_ID,
MOBILE_WIDTH_THRESHOLD,
PLAYLIST_HEIGHT_FORCE_LIST_THRESHOLD,
SEARCH_CHAR_LIMIT
}
8 changes: 8 additions & 0 deletions src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ export default defineComponent({
return this.$store.getters.getBaseTheme
},

isSideNavOpen: function () {
return this.$store.getters.getIsSideNavOpen
},

hideLabelsSideBar: function () {
return this.$store.getters.getHideLabelsSideBar
},

mainColor: function () {
return this.$store.getters.getMainColor
},
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
class="app"
:class="{
hideOutlines: outlinesHidden,
isLocaleRightToLeft: isLocaleRightToLeft
isLocaleRightToLeft: isLocaleRightToLeft,
isSideNavOpen: isSideNavOpen,
hideLabelsSideBar: hideLabelsSideBar && !isSideNavOpen
}"
>
<portal-target
Expand Down
46 changes: 46 additions & 0 deletions src/renderer/components/ft-element-list/ft-element-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,40 @@ export default defineComponent({
required: false,
default: '',
},
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,
},
playlistItemsLength: {
type: Number,
default: 0
},
playlistId: {
type: String,
default: null
},
playlistType: {
type: String,
default: null
},
},
emits: ['move-video-down', 'move-video-up', 'remove-from-playlist'],
computed: {
listType: function () {
return this.$store.getters.getListType
Expand All @@ -48,5 +81,18 @@ export default defineComponent({
displayValue: function () {
return this.display === '' ? this.listType : this.display
}
},
methods: {
moveVideoUp: function(videoId, playlistItemId) {
this.$emit('move-video-up', videoId, playlistItemId)
},

moveVideoDown: function(videoId, playlistItemId) {
this.$emit('move-video-down', videoId, playlistItemId)
},

removeFromPlaylist: function(videoId, playlistItemId) {
this.$emit('remove-from-playlist', videoId, playlistItemId)
},
}
})
11 changes: 11 additions & 0 deletions src/renderer/components/ft-element-list/ft-element-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
:show-video-with-last-viewed-playlist="showVideoWithLastViewedPlaylist"
:use-channels-hidden-preference="useChannelsHiddenPreference"
:hide-forbidden-titles="hideForbiddenTitles"
:always-show-add-to-playlist-button="alwaysShowAddToPlaylistButton"
:quick-bookmark-button-enabled="quickBookmarkButtonEnabled"
:can-move-video-up="canMoveVideoUp && index > 0"
:can-move-video-down="canMoveVideoDown && index < playlistItemsLength - 1"
:can-remove-from-playlist="canRemoveFromPlaylist"
:search-query-text="searchQueryText"
:playlist-id="playlistId"
:playlist-type="playlistType"
:playlist-item-id="result.playlistItemId"
@move-video-up="moveVideoUp(result.videoId, result.playlistItemId)"
@move-video-down="moveVideoDown(result.videoId, result.playlistItemId)"
@remove-from-playlist="removeFromPlaylist(result.videoId, result.playlistItemId)"
/>
</ft-auto-grid>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,40 @@ export default defineComponent({
required: false,
default: '',
},
playlistId: {
type: String,
default: null
},
playlistType: {
type: String,
default: null
},
playlistItemId: {
type: String,
default: null
},
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,
},
},
emits: ['move-video-down', 'move-video-up', 'remove-from-playlist'],
data: function () {
return {
visible: this.firstScreen
Expand Down Expand Up @@ -160,7 +193,17 @@ export default defineComponent({
methods: {
onVisibilityChanged: function (visible) {
this.visible = visible
}
},
moveVideoUp: function() {
this.$emit('move-video-up')
},

moveVideoDown: function() {
this.$emit('move-video-down')
},

removeFromPlaylist: function() {
this.$emit('remove-from-playlist')
},
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@
v-if="finalDataType === 'video' || finalDataType === 'shortVideo'"
:appearance="appearance"
:data="data"
:playlist-id="playlistId"
:playlist-type="playlistType"
:playlist-item-id="playlistItemId"
:show-video-with-last-viewed-playlist="showVideoWithLastViewedPlaylist"
: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"
@move-video-up="moveVideoUp"
@move-video-down="moveVideoDown"
@remove-from-playlist="removeFromPlaylist"
/>
<ft-list-channel
v-else-if="finalDataType === 'channel'"
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ export default defineComponent({
return this.$store.getters.getListType
},

effectiveListTypeIsList: function () {
return (this.listType === 'list' || this.forceListType === 'list') && this.forceListType !== 'grid'
},

thumbnailPreference: function () {
return this.$store.getters.getThumbnailPreference
},
Expand Down
11 changes: 5 additions & 6 deletions src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div
class="ft-list-video ft-list-item"
:class="{
list: (listType === 'list' || forceListType === 'list') && forceListType !== 'grid',
grid: (listType === 'grid' || forceListType === 'list') && forceListType !== 'list',
list: effectiveListTypeIsList,
grid: !effectiveListTypeIsList,
[appearance]: true,
watched: addWatchedStyle
}"
Expand Down Expand Up @@ -72,7 +72,7 @@
<ft-icon-button
v-if="inUserPlaylist && canMoveVideoUp"
:title="$t('User Playlists.Move Video Up')"
:icon="['fas', 'arrow-up']"
:icon="effectiveListTypeIsList ? ['fas', 'arrow-up'] : ['fas', 'arrow-left']"
class="upArrowIcon"
:padding="appearance === `watchPlaylistItem` ? 5 : 6"
:size="appearance === `watchPlaylistItem` ? 14 : 18"
Expand All @@ -81,7 +81,7 @@
<ft-icon-button
v-if="inUserPlaylist && canMoveVideoDown"
:title="$t('User Playlists.Move Video Down')"
:icon="['fas', 'arrow-down']"
:icon="effectiveListTypeIsList ? ['fas', 'arrow-down'] : ['fas', 'arrow-right']"
class="downArrowIcon"
:padding="appearance === `watchPlaylistItem` ? 5 : 6"
:size="appearance === `watchPlaylistItem` ? 14 : 18"
Expand Down Expand Up @@ -157,8 +157,7 @@
@click="handleOptionsClick"
/>
<p
v-if="description && ((listType === 'list' || forceListType === 'list') && forceListType !== 'grid') &&
appearance === 'result'"
v-if="description && effectiveListTypeIsList && appearance === 'result'"
class="description"
v-html="description"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ export default defineComponent({
}
},
emits: ['click'],
computed: {
isSideNavOpen: function () {
return this.$store.getters.getIsSideNavOpen
},

hideLabelsSideBar: function () {
return this.$store.getters.getHideLabelsSideBar
}
},
methods: {
click: function() {
this.$emit('click')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@use '../../scss-partials/utils';

.floatingRefreshSection {
position: fixed;
inset-block-start: 60px;
inset-inline-end: 0;
@include utils.fixed-top-bar;

box-sizing: border-box;
inline-size: calc(100% - 80px);
padding-block: 5px;
padding-inline: 10px;
box-shadow: 0 2px 1px 0 var(--primary-shadow-color);
Expand All @@ -13,21 +13,12 @@
align-items: center;
gap: 5px;
justify-content: flex-end;
z-index: 3;
}

.floatingRefreshSection:has(.lastRefreshTimestamp + .refreshButton) {
justify-content: space-between;
}

.floatingRefreshSection.sideNavOpen {
inline-size: calc(100% - 200px);
}

.floatingRefreshSection.hideLabelsSideBar {
inline-size: calc(100% - 60px);
}

.lastRefreshTimestamp {
margin-block: 0;
text-align: center;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<template>
<div
class="floatingRefreshSection"
:class="{
sideNavOpen: isSideNavOpen,
hideLabelsSideBar: hideLabelsSideBar && !isSideNavOpen
}"
>
<p
v-if="lastRefreshTimestamp"
Expand All @@ -25,4 +21,4 @@
</template>

<script src="./ft-refresh-widget.js" />
<style scoped src="./ft-refresh-widget.css" />
<style scoped lang="scss" src="./ft-refresh-widget.scss" />
4 changes: 4 additions & 0 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export default defineComponent({
type: String,
required: true,
},
theme: {
type: String,
default: 'base'
},
title: {
type: String,
required: true,
Expand Down
Loading
Loading