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

Chapters Redesign #3437

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
139 changes: 72 additions & 67 deletions src/components/ChaptersBar.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,19 @@
<template>
<!-- desktop view -->
<div v-if="!mobileLayout" class="pp-chapters flex-col max-h-75vh min-h-64 lt-lg:hidden">
<h6 aria-label="chapters" title="chapters" class="efy_trans_filter efy_shadow_trans">
{{ $t("video.chapters") }} - {{ chapters.length }}
</h6>
<div class="pp-chapters max-h-75vh">
<h6 class="title efy_trans_filter efy_shadow_trans">{{ $t("video.chapters") }} - {{ chapters.length }}</h6>
<div
v-for="(chapter, index) in chapters"
:key="chapter.start"
class="chapter efy_anim_pulse"
class="chapter flex efy_anim_pulse"
:class="isCurrentChapter(index) ? 'pp-chapter-active' : 'efy_shadow_trans efy_trans_filter'"
:role="isCurrentChapter(index) ? 'button' : ''"
@click="$emit('seek', chapter.start)"
>
<div class="flex">
<img :src="chapter.image" :alt="chapter.title" />
<div class="flex flex-col m-2">
<span :title="chapter.title" v-text="index + 1 + '. ' + chapter.title" class="font-bold" />
<span class="font-bold" v-text="timeFormat(chapter.start)" />
</div>
</div>
</div>
</div>
<!-- mobile view -->
<div v-else class="pp-chapters pp-mobile flex overflow-x-auto">
<div
v-for="(chapter, index) in chapters"
:key="chapter.start"
class="chapter efy_anim_pulse efy_trans_filter"
:class="{ 'pp-chapter-active': isCurrentChapter(index) }"
@click="$emit('seek', chapter.start)"
>
<img :src="chapter.image" :alt="chapter.title" />
<div class="m-1 flex">
<span class="text-truncate font-bold" :title="chapter.title" v-text="chapter.title" />
<span class="px-1 font-bold" v-text="timeFormat(chapter.start)" />
</div>
<span
:title="chapter.title"
v-text="timeFormat(chapter.start) + ' - ' + chapter.title"
class="text font-bold"
/>
</div>
</div>
</template>
Expand All @@ -45,10 +24,6 @@ const props = defineProps({
type: Object,
default: () => null,
},
mobileLayout: {
type: Boolean,
default: () => true,
},
playerPosition: {
type: Number,
default: () => 0,
Expand All @@ -66,49 +41,79 @@ defineEmits(["seek"]);
</script>

<style>
.chapter {
@apply cursor-pointer self-center p-2.5;
}
.pp-mobile .chapter img {
@apply w-full h-full;
}
.chapter img {
@apply w-3/10 h-3/10;
}
.text-truncate {
@apply truncate overflow-hidden inline-block w-10em;
}
.pp-chapters {
flex-direction: column;
margin: -15rem 0 0 0;
padding: var(--efy_gap);
min-width: 400rem;
max-width: 400rem;
gap: var(--efy_gap0);
gap: var(--efy_gap);
border-radius: var(--efy_radius);
overflow: auto;
.title {
background: var(--efy_bg1);
border: var(--efy_border);
padding: 10rem;
border-radius: var(--efy_radius);
line-height: 1;
}
.chapter {
display: flex;
position: relative;
width: 100%;
padding: 0;
margin: 0;
border-radius: var(--efy_radius);
border: var(--efy_border);
align-items: center;
place-content: start;
cursor: pointer;
& img {
border-radius: var(--efy_radius) 0 0 var(--efy_radius);
max-width: 132rem;
height: 100%;
}
.text {
padding: 15rem;
width: 100%;
height: 100%;
display: flex;
align-items: center;
place-content: start;
border-radius: 0 var(--efy_radius) var(--efy_radius) 0;
}
}
}
.pp-chapters .chapter {
padding: 10rem;
border-radius: var(--efy_radius);
border: var(--efy_border);
}
.pp-chapters [title="chapters"] {
padding: 5rem 10rem;
border-radius: var(--efy_radius);
border: var(--efy_border);
}
.pp-chapters .chapter .flex {
gap: 0 15rem;
}
.pp-chapters.pp-mobile {
margin: 15rem 0 0 0;
max-width: 100%;
}
.pp-chapter-active,
.pp-chapters .chapter:hover {
:is(.pp-chapter-active, .pp-chapters .chapter:hover) .text {
background: var(--efy_color);
background-clip: padding-box;
color: var(--efy_text2);
border: 0 !important;
margin: 0;
}
@media (max-width: 1023px) {
.pp-chapters {
flex-direction: row;
margin: var(--efy_gap) 0 0 0;
max-width: 100%;
padding: 0 0 var(--efy_gap) 0;
.title {
display: none;
}
.chapter {
flex-direction: column;
& img {
border-radius: var(--efy_radius) var(--efy_radius) 0 0;
max-width: 100%;
}
.text {
padding: 7rem 8rem 5rem 8rem;
display: inline-block;
width: 160rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
border-radius: 0 0 var(--efy_radius) var(--efy_radius);
}
}
}
}
</style>
2 changes: 1 addition & 1 deletion src/piped.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
--efy_text: oklch(.9 0 0);
} /*Your code starts bellow*/

/*BG 1*/ .comment, .pp-mobile-nav a, .pp-mobile-nav p, .suggestion-selected, .pp-chapters .chapter:not(.pp-chapter-active, .chapter:hover), .pp-chapters [title=chapters] {background: var(--efy_bg1)}
/*BG 1*/ .comment, .pp-mobile-nav a, .pp-mobile-nav p, .suggestion-selected, .pp-chapters .chapter:not(.pp-chapter-active, .chapter:hover) {background: var(--efy_bg1)}
/*Bold*/ .btn {font-weight: bold}
/*Margin: 0*/ .pp-watch-buttons .btn, .suggestions-container li, .suggestions-container ul, .pp-mobile-btn i, .pp-mobile-nav a, .pp-mobile-nav p, .modal-container button:first-of-type svg {margin: 0}
/*Text-Align: Center*/ .btn, .pp-import-channel, .pp-sortby-feed, .pp-playlist-add-modal-top, .pp-nav, .pp-nav > div.flex-1.flex.justify-start > a, .pp-watch-bellow-options .flex.items-center, .pp-channel-page-author {align-items: center; text-align: center}
Expand Down
Loading