Sidebar fixes (#916)

* Correctly bind theatre mode options

Theatre mode is now bound to both "recommended videos" and "live chat"
distraction settings, rather than just "recommended videos".

The settings switch, the button, and the layout have all been updated
to reflect this.

Most likely closes: https://github.com/FreeTubeApp/FreeTube/issues/910

* Fix watch layout when no sidebar

If there's nothing to display in the sidebar according to the
distraction settings and live status, the watch page will adopt a
single column layout. If the sidebar still exists due to faulty logic,
it will be placed at the very bottom of the page.

Most likely closes: https://github.com/FreeTubeApp/FreeTube/issues/909

* Unlink default theatre mode switch

* Normalise theatre calculation, consider playlists
This commit is contained in:
Cadence Ember 2021-01-13 17:13:36 +13:00 committed by GitHub
parent 7be4bf28f2
commit 9424a90fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 5 deletions

View File

@ -48,7 +48,6 @@ export default Vue.extend({
handleHideRecommendedVideos: function (value) { handleHideRecommendedVideos: function (value) {
if (value) { if (value) {
this.updatePlayNextVideo(false) this.updatePlayNextVideo(false)
this.updateDefaultTheatreMode(true)
} }
this.updateHideRecommendedVideos(value) this.updateHideRecommendedVideos(value)

View File

@ -34,7 +34,6 @@
<ft-toggle-switch <ft-toggle-switch
:label="$t('Settings.Player Settings.Enable Theatre Mode by Default')" :label="$t('Settings.Player Settings.Enable Theatre Mode by Default')"
:compact="true" :compact="true"
:disabled="hideRecommendedVideos"
:default-value="defaultTheatreMode" :default-value="defaultTheatreMode"
@change="updateDefaultTheatreMode" @change="updateDefaultTheatreMode"
/> />

View File

@ -78,6 +78,14 @@ export default Vue.extend({
downloadLinks: { downloadLinks: {
type: Array, type: Array,
required: true required: true
},
watchingPlaylist: {
type: Boolean,
required: true
},
theatrePossible: {
type: Boolean,
required: true
} }
}, },
data: function () { data: function () {
@ -111,6 +119,10 @@ export default Vue.extend({
return this.$store.getters.getHideRecommendedVideos return this.$store.getters.getHideRecommendedVideos
}, },
hideLiveChat: function () {
return this.$store.getters.getHideLiveChat
},
hideVideoLikesAndDislikes: function () { hideVideoLikesAndDislikes: function () {
return this.$store.getters.getHideVideoLikesAndDislikes return this.$store.getters.getHideVideoLikesAndDislikes
}, },

View File

@ -63,7 +63,7 @@
</div> </div>
<div class="videoOptions"> <div class="videoOptions">
<ft-icon-button <ft-icon-button
v-if="!hideRecommendedVideos" v-if="theatrePossible"
:title="$t('Toggle Theatre Mode')" :title="$t('Toggle Theatre Mode')"
class="theatreModeButton option" class="theatreModeButton option"
icon="expand-alt" icon="expand-alt"

View File

@ -119,6 +119,12 @@ export default Vue.extend({
playNextVideo: function () { playNextVideo: function () {
return this.$store.getters.getPlayNextVideo return this.$store.getters.getPlayNextVideo
}, },
hideRecommendedVideos: function () {
return this.$store.getters.getHideRecommendedVideos
},
hideLiveChat: function () {
return this.$store.getters.getHideLiveChat
},
youtubeNoCookieEmbeddedFrame: function () { youtubeNoCookieEmbeddedFrame: function () {
return `<iframe width='560' height='315' src='https://www.youtube-nocookie.com/embed/${this.videoId}?rel=0' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe>` return `<iframe width='560' height='315' src='https://www.youtube-nocookie.com/embed/${this.videoId}?rel=0' frameborder='0' allow='autoplay; encrypted-media' allowfullscreen></iframe>`
@ -128,6 +134,9 @@ export default Vue.extend({
}, },
hideVideoLikesAndDislikes: function () { hideVideoLikesAndDislikes: function () {
return this.$store.getters.getHideVideoLikesAndDislikes return this.$store.getters.getHideVideoLikesAndDislikes
},
theatrePossible: function() {
return !this.hideRecommendedVideos || (!this.hideLiveChat && this.isLive) || this.watchingPlaylist
} }
}, },
watch: { watch: {

View File

@ -22,7 +22,7 @@
@media only screen and (max-width: 900px) @media only screen and (max-width: 900px)
+single-column-template +single-column-template
&.isLoading &.isLoading, &.noSidebar
+single-column-template +single-column-template
.videoArea .videoArea
@ -73,6 +73,9 @@
@media only screen and (min-width: 901px) @media only screen and (min-width: 901px)
min-width: 380px min-width: 380px
@at-root .noSidebar#{&}
grid-area: auto
.watchVideoPlaylist, .watchVideoSidebar, .theatrePlaylist .watchVideoPlaylist, .watchVideoSidebar, .theatrePlaylist
margin: 0 8px 16px margin: 0 8px 16px

View File

@ -3,7 +3,8 @@
class="videoLayout" class="videoLayout"
:class="{ :class="{
isLoading, isLoading,
useTheatreMode useTheatreMode,
noSidebar: !theatrePossible
}" }"
> >
<ft-loader <ft-loader
@ -78,6 +79,8 @@
:is-live="isLive" :is-live="isLive"
:is-upcoming="isUpcoming" :is-upcoming="isUpcoming"
:download-links="downloadLinks" :download-links="downloadLinks"
:watching-playlist="watchingPlaylist"
:theatre-possible="theatrePossible"
class="watchVideo" class="watchVideo"
:class="{ theatreWatchVideo: useTheatreMode }" :class="{ theatreWatchVideo: useTheatreMode }"
@theatre-mode="toggleTheatreMode" @theatre-mode="toggleTheatreMode"