Added scene view toggle.
This commit is contained in:
parent
6458264abf
commit
77c6136a05
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="scenes-page"
|
class="scenes-page"
|
||||||
|
:class="{ [view]: true }"
|
||||||
>
|
>
|
||||||
<transition name="sidebar">
|
<transition name="sidebar">
|
||||||
<Filters
|
<Filters
|
||||||
|
@ -66,53 +67,89 @@
|
||||||
:campaign="campaigns.meta"
|
:campaign="campaigns.meta"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<select
|
<div class="views">
|
||||||
v-model="scope"
|
<div class="view-toggles noselect">
|
||||||
class="input"
|
<Icon
|
||||||
@change="search({ autoScope: false })"
|
v-show="view === 'grid'"
|
||||||
>
|
icon="menu3"
|
||||||
<!-- not selected in SSR without prop -->
|
class="view-toggle"
|
||||||
<option
|
@click="setView('list')"
|
||||||
v-if="pageStash"
|
/>
|
||||||
:selected="scope === 'stashed'"
|
|
||||||
value="stashed"
|
|
||||||
>Added</option>
|
|
||||||
|
|
||||||
<option
|
<Icon
|
||||||
v-if="filters.search"
|
v-show="view === 'list'"
|
||||||
:selected="scope === 'results'"
|
icon="grid6"
|
||||||
value="results"
|
class="view-toggle"
|
||||||
>Relevance</option>
|
@click="setView('grid')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<option value="latest">Latest</option>
|
<select
|
||||||
<option value="upcoming">Upcoming</option>
|
v-model="scope"
|
||||||
<option value="new">New</option>
|
class="input"
|
||||||
<option value="likes">Popular</option>
|
@change="search({ autoScope: false })"
|
||||||
</select>
|
>
|
||||||
|
<!-- not selected in SSR without prop -->
|
||||||
|
<option
|
||||||
|
v-if="pageStash"
|
||||||
|
:selected="scope === 'stashed'"
|
||||||
|
value="stashed"
|
||||||
|
>Added</option>
|
||||||
|
|
||||||
|
<option
|
||||||
|
v-if="filters.search"
|
||||||
|
:selected="scope === 'results'"
|
||||||
|
value="results"
|
||||||
|
>Relevance</option>
|
||||||
|
|
||||||
|
<option value="latest">Latest</option>
|
||||||
|
<option value="upcoming">Upcoming</option>
|
||||||
|
<option value="new">New</option>
|
||||||
|
<option value="likes">Popular</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav
|
<nav
|
||||||
v-if="showScopeTabs"
|
v-if="showScopeTabs"
|
||||||
class="scopes"
|
class="scopes"
|
||||||
>
|
>
|
||||||
<div class="scopes-pills">
|
<div class="views">
|
||||||
<Link
|
<div class="scopes-pills">
|
||||||
:href="getPath('latest')"
|
<Link
|
||||||
class="scope nolink"
|
:href="getPath('latest')"
|
||||||
:active="scope === 'latest'"
|
class="scope nolink"
|
||||||
>Latest</Link>
|
:active="scope === 'latest'"
|
||||||
|
>Latest</Link>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
:href="getPath('upcoming')"
|
:href="getPath('upcoming')"
|
||||||
class="scope nolink"
|
class="scope nolink"
|
||||||
:active="scope === 'upcoming'"
|
:active="scope === 'upcoming'"
|
||||||
>Upcoming</Link>
|
>Upcoming</Link>
|
||||||
|
|
||||||
<Link
|
<Link
|
||||||
:href="getPath('new')"
|
:href="getPath('new')"
|
||||||
class="scope nolink"
|
class="scope nolink"
|
||||||
:active="scope === 'new'"
|
:active="scope === 'new'"
|
||||||
>New</Link>
|
>New</Link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="view-toggles noselect">
|
||||||
|
<Icon
|
||||||
|
v-show="view === 'grid'"
|
||||||
|
icon="menu3"
|
||||||
|
class="view-toggle"
|
||||||
|
@click="setView('list')"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Icon
|
||||||
|
v-show="view === 'list'"
|
||||||
|
icon="grid6"
|
||||||
|
class="view-toggle"
|
||||||
|
@click="setView('grid')"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Campaign
|
<Campaign
|
||||||
|
@ -135,7 +172,10 @@
|
||||||
v-else
|
v-else
|
||||||
:key="`scene-${item.id}`"
|
:key="`scene-${item.id}`"
|
||||||
>
|
>
|
||||||
<SceneTile :scene="item" />
|
<SceneTile
|
||||||
|
:scene="item"
|
||||||
|
:class="{ [view]: true }"
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -161,6 +201,7 @@ import {
|
||||||
inject,
|
inject,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
|
||||||
|
import Cookies from 'js-cookie';
|
||||||
import { parse } from 'path-to-regexp';
|
import { parse } from 'path-to-regexp';
|
||||||
|
|
||||||
import navigate from '#/src/navigate.js';
|
import navigate from '#/src/navigate.js';
|
||||||
|
@ -203,6 +244,7 @@ const {
|
||||||
routeParams,
|
routeParams,
|
||||||
urlParsed,
|
urlParsed,
|
||||||
campaigns,
|
campaigns,
|
||||||
|
env,
|
||||||
} = inject('pageContext');
|
} = inject('pageContext');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -224,6 +266,8 @@ const total = ref(Number(pageProps.sceneTotal || pageProps.total));
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const scenesContainer = ref(null);
|
const scenesContainer = ref(null);
|
||||||
|
|
||||||
|
const view = ref(env.scenesView || 'grid');
|
||||||
|
|
||||||
const actorIds = urlParsed.search.actors?.split(',').map((identifier) => parseActorIdentifier(identifier)?.id).filter(Boolean) || [];
|
const actorIds = urlParsed.search.actors?.split(',').map((identifier) => parseActorIdentifier(identifier)?.id).filter(Boolean) || [];
|
||||||
const queryActors = actorIds.map((urlActorId) => aggActors.value.find((aggActor) => aggActor.id === urlActorId)).filter(Boolean);
|
const queryActors = actorIds.map((urlActorId) => aggActors.value.find((aggActor) => aggActor.id === urlActorId)).filter(Boolean);
|
||||||
|
|
||||||
|
@ -330,6 +374,11 @@ function updateFilter(prop, value, reload = true) {
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setView(newView) {
|
||||||
|
view.value = newView;
|
||||||
|
Cookies.set('scenesView', newView);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
@ -402,6 +451,27 @@ function updateFilter(prop, value, reload = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.views {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-toggles {
|
||||||
|
display: none;
|
||||||
|
margin-left: .5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-toggle {
|
||||||
|
padding: .5rem 1rem;
|
||||||
|
fill: var(--glass);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
fill: var(--primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.scopes-pills {
|
.scopes-pills {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -460,18 +530,29 @@ function updateFilter(prop, value, reload = true) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scopes .views {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(--small-20) {
|
@media(--small-20) {
|
||||||
/*
|
.list {
|
||||||
.scenes {
|
.scenes {
|
||||||
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
.scenes {
|
.scenes {
|
||||||
grid-template-columns: 1fr;
|
|
||||||
padding: .5rem .5rem 1rem .5rem;
|
padding: .5rem .5rem 1rem .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.view-toggles {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scopes-pills {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -273,45 +273,47 @@ const favorited = ref(props.scene.stashes.some((sceneStash) => sceneStash.id ===
|
||||||
}
|
}
|
||||||
|
|
||||||
@media(--small-20) {
|
@media(--small-20) {
|
||||||
.tile-full {
|
.tile.list {
|
||||||
flex-direction: row;
|
.tile-full {
|
||||||
}
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
.poster-container {
|
.poster-container {
|
||||||
width: 10rem;
|
width: 10rem;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poster {
|
.poster {
|
||||||
border-radius: .25rem 0 0 0;
|
border-radius: .25rem 0 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bookmarks.tiled {
|
.bookmarks.tiled {
|
||||||
right: auto;
|
right: auto;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-full {
|
.meta-full {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.meta-compact {
|
.meta-compact {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
.info {
|
||||||
width: 0;
|
width: 0;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
margin: 0 .5rem .5rem .5rem;
|
margin: 0 .5rem .5rem .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin-top: .6rem;
|
margin-top: .6rem;
|
||||||
margin-bottom: .6rem;
|
margin-bottom: .6rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -32,6 +32,7 @@ export default async function mainHandler(req, res, next) {
|
||||||
} : null,
|
} : null,
|
||||||
env: {
|
env: {
|
||||||
theme: req.cookies.theme || req.headers['sec-ch-prefers-color-scheme'] || 'light',
|
theme: req.cookies.theme || req.headers['sec-ch-prefers-color-scheme'] || 'light',
|
||||||
|
scenesView: req.cookies.scenesView || 'list',
|
||||||
selectedTemplate: Number(req.cookies.selectedTemplate) || 0,
|
selectedTemplate: Number(req.cookies.selectedTemplate) || 0,
|
||||||
allowLogin: config.auth.login,
|
allowLogin: config.auth.login,
|
||||||
allowSignup: config.auth.signup,
|
allowSignup: config.auth.signup,
|
||||||
|
|
Loading…
Reference in New Issue