mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-12-13 21:19:45 +01:00
Add distraction free setting to hide channel shorts (#3569)
* Add distraction free setting to hide channel shorts * Add support for channel shorts URLs
This commit is contained in:
parent
bc492255ac
commit
c53f5b6dac
@ -65,6 +65,9 @@ export default defineComponent({
|
|||||||
hideFeaturedChannels: function() {
|
hideFeaturedChannels: function() {
|
||||||
return this.$store.getters.getHideFeaturedChannels
|
return this.$store.getters.getHideFeaturedChannels
|
||||||
},
|
},
|
||||||
|
hideChannelShorts: function() {
|
||||||
|
return this.$store.getters.getHideChannelShorts
|
||||||
|
},
|
||||||
hideChannelPlaylists: function() {
|
hideChannelPlaylists: function() {
|
||||||
return this.$store.getters.getHideChannelPlaylists
|
return this.$store.getters.getHideChannelPlaylists
|
||||||
},
|
},
|
||||||
@ -112,6 +115,7 @@ export default defineComponent({
|
|||||||
'updateChannelsHidden',
|
'updateChannelsHidden',
|
||||||
'updateShowDistractionFreeTitles',
|
'updateShowDistractionFreeTitles',
|
||||||
'updateHideFeaturedChannels',
|
'updateHideFeaturedChannels',
|
||||||
|
'updateHideChannelShorts',
|
||||||
'updateHideChannelPlaylists',
|
'updateHideChannelPlaylists',
|
||||||
'updateHideChannelCommunity'
|
'updateHideChannelCommunity'
|
||||||
])
|
])
|
||||||
|
@ -64,6 +64,12 @@
|
|||||||
:default-value="hideChannelPlaylists"
|
:default-value="hideChannelPlaylists"
|
||||||
@change="updateHideChannelPlaylists"
|
@change="updateHideChannelPlaylists"
|
||||||
/>
|
/>
|
||||||
|
<ft-toggle-switch
|
||||||
|
:label="$t('Settings.Distraction Free Settings.Hide Channel Shorts')"
|
||||||
|
:compact="true"
|
||||||
|
:default-value="hideChannelShorts"
|
||||||
|
@change="updateHideChannelShorts"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="switchColumn">
|
<div class="switchColumn">
|
||||||
<ft-toggle-switch
|
<ft-toggle-switch
|
||||||
|
@ -194,6 +194,7 @@ const state = {
|
|||||||
hideActiveSubscriptions: false,
|
hideActiveSubscriptions: false,
|
||||||
hideChannelCommunity: false,
|
hideChannelCommunity: false,
|
||||||
hideChannelPlaylists: false,
|
hideChannelPlaylists: false,
|
||||||
|
hideChannelShorts: false,
|
||||||
hideChannelSubscriptions: false,
|
hideChannelSubscriptions: false,
|
||||||
hideCommentLikes: false,
|
hideCommentLikes: false,
|
||||||
hideComments: false,
|
hideComments: false,
|
||||||
|
@ -315,7 +315,7 @@ const actions = {
|
|||||||
let urlType = 'unknown'
|
let urlType = 'unknown'
|
||||||
|
|
||||||
const channelPattern =
|
const channelPattern =
|
||||||
/^\/(?:(?:channel|user|c)\/)?(?<channelId>[^/]+)(?:\/(?<tab>join|featured|videos|live|streams|playlists|about|community|channels))?\/?$/
|
/^\/(?:(?:channel|user|c)\/)?(?<channelId>[^/]+)(?:\/(?<tab>join|featured|videos|shorts|live|streams|playlists|about|community|channels))?\/?$/
|
||||||
|
|
||||||
const hashtagPattern = /^\/hashtag\/(?<tag>[^#&/?]+)$/
|
const hashtagPattern = /^\/hashtag\/(?<tag>[^#&/?]+)$/
|
||||||
|
|
||||||
@ -427,6 +427,9 @@ const actions = {
|
|||||||
|
|
||||||
let subPath = null
|
let subPath = null
|
||||||
switch (match.groups.tab) {
|
switch (match.groups.tab) {
|
||||||
|
case 'shorts':
|
||||||
|
subPath = 'shorts'
|
||||||
|
break
|
||||||
case 'live':
|
case 'live':
|
||||||
case 'streams':
|
case 'streams':
|
||||||
subPath = 'live'
|
subPath = 'live'
|
||||||
|
@ -184,6 +184,10 @@ export default defineComponent({
|
|||||||
return this.$store.getters.getHideSharingActions
|
return this.$store.getters.getHideSharingActions
|
||||||
},
|
},
|
||||||
|
|
||||||
|
hideChannelShorts: function () {
|
||||||
|
return this.$store.getters.getHideChannelShorts
|
||||||
|
},
|
||||||
|
|
||||||
hideLiveStreams: function () {
|
hideLiveStreams: function () {
|
||||||
return this.$store.getters.getHideLiveStreams
|
return this.$store.getters.getHideLiveStreams
|
||||||
},
|
},
|
||||||
@ -207,6 +211,11 @@ export default defineComponent({
|
|||||||
]
|
]
|
||||||
|
|
||||||
// remove tabs from the array based on user settings
|
// remove tabs from the array based on user settings
|
||||||
|
if (this.hideChannelShorts) {
|
||||||
|
const index = values.indexOf('shorts')
|
||||||
|
values.splice(index, 1)
|
||||||
|
}
|
||||||
|
|
||||||
if (this.hideLiveStreams) {
|
if (this.hideLiveStreams) {
|
||||||
const index = values.indexOf('live')
|
const index = values.indexOf('live')
|
||||||
values.splice(index, 1)
|
values.splice(index, 1)
|
||||||
@ -264,6 +273,10 @@ export default defineComponent({
|
|||||||
this.showLiveSortBy = true
|
this.showLiveSortBy = true
|
||||||
this.showPlaylistSortBy = true
|
this.showPlaylistSortBy = true
|
||||||
|
|
||||||
|
if (this.hideChannelShorts && currentTab === 'shorts') {
|
||||||
|
currentTab = 'videos'
|
||||||
|
}
|
||||||
|
|
||||||
if (this.hideLiveStreams && currentTab === 'live') {
|
if (this.hideLiveStreams && currentTab === 'live') {
|
||||||
currentTab = 'videos'
|
currentTab = 'videos'
|
||||||
}
|
}
|
||||||
@ -367,6 +380,10 @@ export default defineComponent({
|
|||||||
|
|
||||||
let currentTab = this.$route.params.currentTab ?? 'videos'
|
let currentTab = this.$route.params.currentTab ?? 'videos'
|
||||||
|
|
||||||
|
if (this.hideChannelShorts && currentTab === 'shorts') {
|
||||||
|
currentTab = 'videos'
|
||||||
|
}
|
||||||
|
|
||||||
if (this.hideLiveStreams && currentTab === 'live') {
|
if (this.hideLiveStreams && currentTab === 'live') {
|
||||||
currentTab = 'videos'
|
currentTab = 'videos'
|
||||||
}
|
}
|
||||||
@ -591,7 +608,7 @@ export default defineComponent({
|
|||||||
this.getChannelVideosLocal()
|
this.getChannelVideosLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.has_shorts) {
|
if (!this.hideChannelShorts && channel.has_shorts) {
|
||||||
this.getChannelShortsLocal()
|
this.getChannelShortsLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,7 +900,7 @@ export default defineComponent({
|
|||||||
this.channelInvidiousVideos()
|
this.channelInvidiousVideos()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.tabs.includes('shorts')) {
|
if (!this.hideChannelShorts && response.tabs.includes('shorts')) {
|
||||||
this.channelInvidiousShorts()
|
this.channelInvidiousShorts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@
|
|||||||
{{ $t("Channel.Videos.Videos").toUpperCase() }}
|
{{ $t("Channel.Videos.Videos").toUpperCase() }}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
v-if="!hideChannelShorts"
|
||||||
id="shortsTab"
|
id="shortsTab"
|
||||||
class="tab"
|
class="tab"
|
||||||
:class="(currentTab==='shorts')?'selectedTab':''"
|
:class="(currentTab==='shorts')?'selectedTab':''"
|
||||||
@ -203,7 +204,7 @@
|
|||||||
@change="videoSortBy = $event"
|
@change="videoSortBy = $event"
|
||||||
/>
|
/>
|
||||||
<ft-select
|
<ft-select
|
||||||
v-if="showShortSortBy"
|
v-if="!hideChannelShorts && showShortSortBy"
|
||||||
v-show="currentTab === 'shorts' && latestShorts.length > 0"
|
v-show="currentTab === 'shorts' && latestShorts.length > 0"
|
||||||
class="sortSelect"
|
class="sortSelect"
|
||||||
:value="videoShortLiveSelectValues[0]"
|
:value="videoShortLiveSelectValues[0]"
|
||||||
@ -254,14 +255,14 @@
|
|||||||
</p>
|
</p>
|
||||||
</ft-flex-box>
|
</ft-flex-box>
|
||||||
<ft-element-list
|
<ft-element-list
|
||||||
v-if="currentTab === 'shorts'"
|
v-if="!hideChannelShorts && currentTab === 'shorts'"
|
||||||
id="shortPanel"
|
id="shortPanel"
|
||||||
:data="latestShorts"
|
:data="latestShorts"
|
||||||
role="tabpanel"
|
role="tabpanel"
|
||||||
aria-labelledby="shortsTab"
|
aria-labelledby="shortsTab"
|
||||||
/>
|
/>
|
||||||
<ft-flex-box
|
<ft-flex-box
|
||||||
v-if="currentTab === 'shorts' && latestShorts.length === 0"
|
v-if="!hideChannelShorts && currentTab === 'shorts' && latestShorts.length === 0"
|
||||||
>
|
>
|
||||||
<p class="message">
|
<p class="message">
|
||||||
{{ $t("Channel.Shorts.This channel does not currently have any shorts") }}
|
{{ $t("Channel.Shorts.This channel does not currently have any shorts") }}
|
||||||
|
Loading…
Reference in New Issue
Block a user