Integrated channel filter, partially restored actor bio.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<Filters v-if="showFilters">
|
||||
<div
|
||||
class="page"
|
||||
>
|
||||
<Filters
|
||||
v-if="showFilters"
|
||||
:class="{ loading }"
|
||||
>
|
||||
<TagsFilter
|
||||
:filters="filters"
|
||||
:tags="aggTags"
|
||||
@@ -20,7 +25,10 @@
|
||||
/>
|
||||
</Filters>
|
||||
|
||||
<div class="scenes-container">
|
||||
<div
|
||||
class="scenes-container"
|
||||
:class="{ loading }"
|
||||
>
|
||||
<div
|
||||
v-if="showMeta"
|
||||
class="scenes-header"
|
||||
@@ -48,7 +56,9 @@
|
||||
>New</Link>
|
||||
</nav>
|
||||
|
||||
<ul class="scenes nolist">
|
||||
<ul
|
||||
class="scenes nolist"
|
||||
>
|
||||
<li
|
||||
v-for="scene in scenes"
|
||||
:key="scene.id"
|
||||
@@ -59,6 +69,11 @@
|
||||
|
||||
<Pagination />
|
||||
</div>
|
||||
|
||||
<Ellipsis
|
||||
class="ellipsis"
|
||||
:class="{ loading }"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -75,8 +90,9 @@ import Filters from '#/components/filters/filters.vue';
|
||||
import ActorsFilter from '#/components/filters/actors.vue';
|
||||
import TagsFilter from '#/components/filters/tags.vue';
|
||||
import ChannelsFilter from '#/components/filters/channels.vue';
|
||||
import Scene from './tile.vue';
|
||||
import Pagination from '../pagination/pagination.vue';
|
||||
import Scene from '#/components/scenes/tile.vue';
|
||||
import Pagination from '#/components/pagination/pagination.vue';
|
||||
import Ellipsis from '#/components/loading/ellipsis.vue';
|
||||
|
||||
defineProps({
|
||||
showFilters: {
|
||||
@@ -99,12 +115,13 @@ const {
|
||||
} = pageProps;
|
||||
|
||||
const scenes = ref(pageProps.scenes);
|
||||
const aggActors = ref(pageProps.aggActors);
|
||||
const aggTags = ref(pageProps.aggTags);
|
||||
const aggChannels = ref(pageProps.aggChannels);
|
||||
const aggActors = ref(pageProps.aggActors || []);
|
||||
const aggTags = ref(pageProps.aggTags || []);
|
||||
const aggChannels = ref(pageProps.aggChannels || []);
|
||||
|
||||
const currentPage = ref(Number(routeParams.page));
|
||||
const total = ref(Number(pageProps.total));
|
||||
const loading = ref(false);
|
||||
|
||||
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);
|
||||
@@ -112,11 +129,11 @@ const queryActors = actorIds.map((urlActorId) => aggActors.value.find((aggActor)
|
||||
const networks = Object.fromEntries(aggChannels.value.map((channel) => (channel.type === 'network' ? channel : channel.parent)).filter(Boolean).map((parent) => [`_${parent.slug}`, parent]));
|
||||
const channels = Object.fromEntries(aggChannels.value.filter((channel) => channel.type === 'channel').map((channel) => [channel.slug, channel]));
|
||||
|
||||
const queryChannel = networks[urlParsed.search.e] || channels[urlParsed.search.e];
|
||||
const queryEntity = networks[urlParsed.search.e] || channels[urlParsed.search.e];
|
||||
|
||||
const filters = ref({
|
||||
tags: urlParsed.search.tags?.split(',').filter(Boolean) || [],
|
||||
channel: queryChannel,
|
||||
entity: queryEntity,
|
||||
actors: queryActors,
|
||||
});
|
||||
|
||||
@@ -149,14 +166,16 @@ async function search(resetPage = true) {
|
||||
|
||||
const query = {};
|
||||
|
||||
const entity = filters.value.channel || pageChannel;
|
||||
const entity = filters.value.entity || pageChannel;
|
||||
const entitySlug = entity?.type === 'network' ? `_${entity.slug}` : entity?.slug;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
const res = await get('/scenes', {
|
||||
...query,
|
||||
actors: [pageActor, ...filters.value.actors].filter(Boolean).map((filterActor) => getActorIdentifier(filterActor)).join(','), // if we're on an actor page, that actor ID needs to be included
|
||||
tags: [pageTag?.slug, ...filters.value.tags].filter(Boolean).join(','),
|
||||
entity: entitySlug,
|
||||
e: entitySlug,
|
||||
scope,
|
||||
page: currentPage.value, // client uses param rather than query pagination
|
||||
});
|
||||
@@ -164,15 +183,17 @@ async function search(resetPage = true) {
|
||||
scenes.value = res.scenes;
|
||||
aggActors.value = res.aggActors;
|
||||
aggTags.value = res.aggTags;
|
||||
aggChannels.value = res.aggChannels;
|
||||
total.value = res.total;
|
||||
|
||||
loading.value = false;
|
||||
events.emit('scrollUp');
|
||||
|
||||
navigate(getPath(scope, false), {
|
||||
...query,
|
||||
actors: filters.value.actors.map((filterActor) => getActorIdentifier(filterActor)).join(',') || undefined, // don't include page actor ID in query, already a parameter
|
||||
tags: filters.value.tags.join(',') || undefined,
|
||||
e: filters.value.channel?.type === 'network' ? `_${filters.value.channel.slug}` : (filters.value.channel?.slug || undefined),
|
||||
e: filters.value.entity?.type === 'network' ? `_${filters.value.entity.slug}` : (filters.value.entity?.slug || undefined),
|
||||
}, { redirect: false });
|
||||
}
|
||||
|
||||
@@ -189,12 +210,13 @@ function updateFilter(prop, value, reload = true) {
|
||||
.page {
|
||||
display: flex;
|
||||
background: var(--background-base-10);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.scenes-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: .5rem 0 .25rem 2rem;
|
||||
padding: 1rem 0 .25rem 3rem;
|
||||
}
|
||||
|
||||
.scenes-container {
|
||||
@@ -233,4 +255,20 @@ function updateFilter(prop, value, reload = true) {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.loading:not(.ellipsis) {
|
||||
opacity: .3;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
left: 50%;
|
||||
|
||||
&.loading {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user