1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-13 22:00:28 +05:30

Merge pull request #2522 from kskarthik/master

refactor: vertical chapters layout for mobile screen
This commit is contained in:
Bnyro 2023-06-14 20:41:53 +02:00 committed by GitHub
commit c52eacb96a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 62 additions and 30 deletions

View File

@ -6,7 +6,7 @@
"serve": "vite", "serve": "vite",
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
"format": "prettier -w --ignore-path .gitignore **/**.{js,vue}", "format": "prettier -w --ignore-path .gitignore **/**.{js,vue,json}",
"lint": "eslint --fix --color --ignore-path .gitignore --ext .js,.vue ." "lint": "eslint --fix --color --ignore-path .gitignore --ext .js,.vue ."
}, },
"dependencies": { "dependencies": {

View File

@ -1,26 +1,17 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": ["config:base", "group:recommended"],
"config:base", "ignorePresets": [":prHourlyLimit2"],
"group:recommended" "packageRules": [
], {
"ignorePresets": [ "matchPackagePrefixes": ["@unocss/"],
":prHourlyLimit2" "matchPackageNames": ["unocss"],
], "groupName": "unocss"
"packageRules": [ }
{ ],
"matchPackagePrefixes": [ "lockFileMaintenance": {
"@unocss/" "enabled": true,
], "automerge": true
"matchPackageNames": [ },
"unocss" "platformAutomerge": true
],
"groupName": "unocss"
}
],
"lockFileMaintenance": {
"enabled": true,
"automerge": true
},
"platformAutomerge": true
} }

View File

@ -21,8 +21,34 @@
</div> </div>
</div> </div>
</div> </div>
<!-- mobile view -->
<div v-else class="flex overflow-x-auto"> <!-- mobile vertical view -->
<div
v-if="mobileLayout && getPreferenceString('mobileChapterLayout') == 'Vertical'"
class="flex flex-col overflow-y-scroll max-h-64"
>
<h2 class="mb-2 bg-gray-500/50 p-2" aria-label="chapters" title="chapters">
{{ $t("video.chapters") }} ({{ chapters.length }})
</h2>
<div
:key="chapter.start"
v-for="(chapter, index) in chapters"
@click="$emit('seek', chapter.start)"
class="chapter-vertical"
:class="{ 'bg-red-500/50': isCurrentChapter(index) }"
>
<div class="flex">
<span class="mt-5 mr-2 text-current" v-text="index + 1" />
<img class="shrink-0" :src="chapter.image" :alt="chapter.title" />
<div class="flex flex-col m-2">
<span class="text-sm" :title="chapter.title" v-text="chapter.title" />
<span class="text-sm font-bold text-blue-500" v-text="timeFormat(chapter.start)" />
</div>
</div>
</div>
</div>
<!-- mobile Horizontal view -->
<div v-if="getPreferenceString('mobileChapterLayout') == 'Horizontal' && mobileLayout" class="flex overflow-x-auto">
<div <div
:key="chapter.start" :key="chapter.start"
v-for="(chapter, index) in chapters" v-for="(chapter, index) in chapters"

View File

@ -126,6 +126,15 @@
@change="onChange($event)" @change="onChange($event)"
/> />
</label> </label>
<!-- chapters layout on mobile -->
<label class="lg:invisible pref" for="chkMinimizeChapters">
<strong v-t="'actions.chapters_layout_mobile'" />
<select id="ddlDefaultHomepage" v-model="mobileChapterLayout" class="select w-auto" @change="onChange($event)">
<option v-t="'video.chapters_horizontal'" value="Horizontal" />
<option v-t="'video.chapters_vertical'" value="Vertical" />
</select>
</label>
<label class="pref" for="chkShowWatchOnYouTube"> <label class="pref" for="chkShowWatchOnYouTube">
<strong v-t="'actions.show_watch_on_youtube'" /> <strong v-t="'actions.show_watch_on_youtube'" />
<input <input
@ -363,6 +372,7 @@ import ConfirmModal from "./ConfirmModal.vue";
export default { export default {
data() { data() {
return { return {
mobileChapterLayout: "Vertical",
selectedInstance: null, selectedInstance: null,
authInstance: false, authInstance: false,
selectedAuthInstance: null, selectedAuthInstance: null,
@ -523,6 +533,7 @@ export default {
this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false); this.disableLBRY = this.getPreferenceBoolean("disableLBRY", false);
this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false); this.proxyLBRY = this.getPreferenceBoolean("proxyLBRY", false);
this.hideWatched = this.getPreferenceBoolean("hideWatched", false); this.hideWatched = this.getPreferenceBoolean("hideWatched", false);
this.mobileChapterLayout = this.getPreferenceString("mobileChapterLayout", "Vertical");
if (this.selectedLanguage != "en") { if (this.selectedLanguage != "en") {
try { try {
this.CountryMap = await import(`../utils/CountryMaps/${this.selectedLanguage}.json`).then( this.CountryMap = await import(`../utils/CountryMaps/${this.selectedLanguage}.json`).then(
@ -581,6 +592,7 @@ export default {
localStorage.setItem("disableLBRY", this.disableLBRY); localStorage.setItem("disableLBRY", this.disableLBRY);
localStorage.setItem("proxyLBRY", this.proxyLBRY); localStorage.setItem("proxyLBRY", this.proxyLBRY);
localStorage.setItem("hideWatched", this.hideWatched); localStorage.setItem("hideWatched", this.hideWatched);
localStorage.setItem("mobileChapterLayout", this.mobileChapterLayout);
if (shouldReload) window.location.reload(); if (shouldReload) window.location.reload();
} }

View File

@ -148,7 +148,7 @@
v-t="`actions.${showDesc ? 'minimize_description' : 'show_description'}`" v-t="`actions.${showDesc ? 'minimize_description' : 'show_description'}`"
/> />
<span class="btn" v-show="video?.chapters?.length > 0"> <span class="btn ml-2" v-show="video?.chapters?.length > 0">
<input id="showChapters" type="checkbox" v-model="showChapters" /> <input id="showChapters" type="checkbox" v-model="showChapters" />
<label class="ml-2" for="showChapters" v-t="'actions.show_chapters'" /> <label class="ml-2" for="showChapters" v-t="'actions.show_chapters'" />
</span> </span>

View File

@ -99,6 +99,7 @@
"logout": "Logout from this device", "logout": "Logout from this device",
"minimize_recommendations_default": "Minimize Recommendations by default", "minimize_recommendations_default": "Minimize Recommendations by default",
"minimize_chapters_default": "Minimize Chapters by default", "minimize_chapters_default": "Minimize Chapters by default",
"chapters_layout_mobile": "Chapters Layout On Mobile",
"show_watch_on_youtube": "Show Watch on YouTube button", "show_watch_on_youtube": "Show Watch on YouTube button",
"invalidate_session": "Logout all devices", "invalidate_session": "Logout all devices",
"different_auth_instance": "Use a different instance for authentication", "different_auth_instance": "Use a different instance for authentication",
@ -169,7 +170,9 @@
"live": "{0} Live", "live": "{0} Live",
"shorts": "Shorts", "shorts": "Shorts",
"all": "All", "all": "All",
"category": "Category" "category": "Category",
"chapters_horizontal": "Horizontal",
"chapters_vertical": "Vertical"
}, },
"search": { "search": {
"did_you_mean": "Did you mean: {0}?", "did_you_mean": "Did you mean: {0}?",

View File

@ -172,7 +172,7 @@
{ "code": "CH", "name": "Suiza" }, { "code": "CH", "name": "Suiza" },
{ "code": "SR", "name": "Surinam" }, { "code": "SR", "name": "Surinam" },
{ "code": "TH", "name": "Tailandia" }, { "code": "TH", "name": "Tailandia" },
{ "code": "TW", "name": "Taiwán" }, { "code": "TW", "name": "Taiwán" },
{ "code": "TZ", "name": "Tanzania" }, { "code": "TZ", "name": "Tanzania" },
{ "code": "TJ", "name": "Tayikistán" }, { "code": "TJ", "name": "Tayikistán" },
{ "code": "TL", "name": "Timor Oriental" }, { "code": "TL", "name": "Timor Oriental" },