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

Local API: Add support for home tab on channels #6033

Merged
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
638db70
Add support for home tab on channels
ChunkyProgrammer Oct 30, 2024
70fff8f
Remove some unneeded code
ChunkyProgrammer Oct 30, 2024
4ee89e0
Add setting to hide channel home tab
ChunkyProgrammer Oct 30, 2024
4c2e832
Switch to Composition API
ChunkyProgrammer Oct 30, 2024
170e473
Add Play All link when possible, parse more types
ChunkyProgrammer Oct 30, 2024
396589d
fix typo for home tab aria-controls
ChunkyProgrammer Oct 30, 2024
230effd
move distraction free hide home setting
ChunkyProgrammer Oct 30, 2024
73ceadc
Filter home data for setting featured channels
ChunkyProgrammer Oct 30, 2024
eaa1409
fix publish date parsing
ChunkyProgrammer Oct 30, 2024
85204ea
Add support for shelf subtitle
ChunkyProgrammer Oct 30, 2024
8b827bb
run lint-fix
ChunkyProgrammer Nov 4, 2024
7a9cd8a
add jsdoc for added function
ChunkyProgrammer Nov 4, 2024
95f4de4
implement code suggestions, fix lockupview
ChunkyProgrammer Nov 17, 2024
bbe1000
add support for parsing subtitle and playlistId for richshelf
ChunkyProgrammer Nov 17, 2024
51ef0dc
exclude home tab for IV
ChunkyProgrammer Nov 18, 2024
2143008
implement code suggestions, change `Play all` to `View playlist`
ChunkyProgrammer Nov 19, 2024
1d257ed
remove lockupview case since #6196 will handle parsing it in this fun…
ChunkyProgrammer Nov 19, 2024
691fde1
use list icon instead of bookmark icon
ChunkyProgrammer Nov 20, 2024
5ada1f6
open all details by default
ChunkyProgrammer Nov 24, 2024
8a984d7
add case 'ALBUM' for lockupView parsing
ChunkyProgrammer Nov 25, 2024
e516619
change default page to home page when local api is enabled and home p…
ChunkyProgrammer Nov 25, 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
16 changes: 16 additions & 0 deletions src/renderer/components/ChannelDetails/ChannelDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@
role="tablist"
:aria-label="$t('Channel.Channel Tabs')"
>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="visibleTabs.includes('home')"
id="homeTab"
class="tab"
:class="{ selectedTab: currentTab === 'home' }"
role="tab"
:aria-selected="String(currentTab === 'home')"
aria-controls="homePanel"
:tabindex="(currentTab === 'home' || currentTab === 'search') ? 0 : -1"
@click="changeTab('home')"
@keydown.left.right="focusTab('home', $event)"
@keydown.enter.space.prevent="changeTab('home')"
>
{{ $t("Channel.Home.Home").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="visibleTabs.includes('videos')"
Expand Down
35 changes: 35 additions & 0 deletions src/renderer/components/ChannelHome/ChannelHome.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.shelfTitle {
font-size: 24px;
cursor: pointer;
}

.shelfTitle::marker {
font-size: 20px;
color: var(--accent-color);
}

.shelfUnderline {
border-color: var(--primary-color);
}

.playAllSpan {
font-size: 18px;
margin-inline-start: 10px;
}

.playAllLink {
font-style: italic;
padding-block: 5px;
padding-inline: 7px;
border-radius: 10px;
text-decoration: none;
}

.playAllLink:hover {
background-color: var(--bg-color);
}

.shelfSubtitle {
font-style: italic;
color: var(--tertiary-text-color);
}
77 changes: 77 additions & 0 deletions src/renderer/components/ChannelHome/ChannelHome.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<template>
<div>
<div
v-for="(shelf, index) in filteredShelves"
:key="index"
>
<details
:open="index == 0"
>
<summary
class="shelfTitle"
>
{{ shelf.title }}
<span
v-if="shelf.playlistId"
class="playAllSpan"
>
<router-link
class="playAllLink"
:to="{
path: `/playlist/${shelf.playlistId}`
}"
>
<FontAwesomeIcon
class="thumbnail"
:icon="['fas', 'list']"
/>
{{ $t('Channel.Home.View Playlist') }}
</router-link>
</span>
<hr class="shelfUnderline">
</summary>
<p
v-if="shelf.subtitle"
class="shelfSubtitle"
>
{{ shelf.subtitle }}
</p>
<FtElementList
:data="shelf.content"
:use-channels-hidden-preference="false"
:display="shelf.isCommunity ? 'list' : null"
/>
</details>
</div>
</div>
</template>

<script setup>

import { computed } from 'vue'
import FtElementList from '../FtElementList/FtElementList.vue'
import store from '../../store/index'

const props = defineProps({
shelves: {
type: Array,
default: () => []
}
})

/** @type {import('vue').ComputedRef<bool>} */
const hideFeaturedChannels = computed(() => {
return store.getters.getHideFeaturedChannels
})

const filteredShelves = computed(() => {
let shelves = props.shelves
if (hideFeaturedChannels.value) {
shelves = shelves.filter(shelf => shelf.content[0].type !== 'channel')
}

return shelves.filter(shelf => shelf.content.length > 0)
})
</script>

<style scoped src="./ChannelHome.css" />
4 changes: 3 additions & 1 deletion src/renderer/components/FtListChannel/FtListChannel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
>
<img
:src="thumbnail"
class="channelImage"
:class="!isGame ? 'channelImage' : 'gameImage'"
alt=""
>
</router-link>
Expand Down Expand Up @@ -116,6 +116,7 @@ let videoCount = null
/** @type {string?} */
let handle = null
let description = ''
let isGame = null
if (process.env.SUPPORTS_LOCAL_API && props.data.dataSource === 'local') {
parseLocalData()
Expand Down Expand Up @@ -157,6 +158,7 @@ function parseLocalData() {
}
description = props.data.descriptionShort
isGame = props.data.isGame
}
function parseInvidiousData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ export default defineComponent({
hideChannelCommunity: function () {
return this.$store.getters.getHideChannelCommunity
},
hideChannelHome: function () {
return this.$store.getters.getHideChannelHome
},
hideSubscriptionsVideos: function () {
return this.$store.getters.getHideSubscriptionsVideos
},
Expand Down Expand Up @@ -218,6 +221,7 @@ export default defineComponent({
'updateHideChannelShorts',
'updateHideChannelPlaylists',
'updateHideChannelCommunity',
'updateHideChannelHome',
'updateHideChannelPodcasts',
'updateHideChannelReleases',
'updateHideSubscriptionsVideos',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@
</h4>
<div class="switchColumnGrid">
<div class="switchColumn">
<ft-toggle-switch
:label="$t('Settings.Distraction Free Settings.Hide Channel Home')"
:compact="true"
:default-value="hideChannelHome"
@change="updateHideChannelHome"
/>
<ft-toggle-switch
:label="$t('Settings.Distraction Free Settings.Hide Channel Shorts')"
:compact="true"
Expand Down
Loading