Fixed pagination. Added entity page channel tile expand.
This commit is contained in:
94
components/filters/actor.vue
Normal file
94
components/filters/actor.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<li
|
||||
:key="`filter-actor-${actor.id}`"
|
||||
class="filter-item"
|
||||
:class="{ selected: filters.actors.some((filterActor) => filterActor.id === actor.id), first: type === 'available' && index === 0 && filters.actors.length > 0 }"
|
||||
@click="emit('actor', actor)"
|
||||
>
|
||||
<div
|
||||
class="filter-include"
|
||||
@click.stop="toggleActor(actor)"
|
||||
>
|
||||
<Icon
|
||||
icon="checkmark"
|
||||
class="filter-add"
|
||||
/>
|
||||
|
||||
<Icon
|
||||
icon="cross2"
|
||||
class="filter-remove"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span class="filter-name actor-name">
|
||||
<span
|
||||
class="filter-text"
|
||||
:title="actor.name"
|
||||
>{{ actor.name }}</span>
|
||||
|
||||
<span class="filter-details">
|
||||
<div class="actor-gender">
|
||||
<Gender
|
||||
:gender="actor.gender"
|
||||
class="gender"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span
|
||||
v-if="actor.count"
|
||||
class="filter-count"
|
||||
>{{ actor.count }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import Gender from '#/components/actors/gender.vue';
|
||||
|
||||
defineProps({
|
||||
actor: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
filters: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'available',
|
||||
},
|
||||
toggleActor: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['actor']);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.filter-name {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.actor-name {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.actor-gender {
|
||||
width: 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.gender {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@
|
||||
<input
|
||||
v-model="search"
|
||||
type="search"
|
||||
placeholder="Filter actors"
|
||||
:placeholder="`Filter ${actors.length} actors`"
|
||||
class="input input-inline filters-search"
|
||||
>
|
||||
|
||||
@@ -46,60 +46,44 @@
|
||||
</div>
|
||||
|
||||
<ul
|
||||
v-for="(group, groupKey) in groupedActors"
|
||||
:key="groupKey"
|
||||
v-for="(actor, index) in selectedActors"
|
||||
:key="`actor-${actor.id}`"
|
||||
class="filter-items nolist"
|
||||
>
|
||||
<li
|
||||
v-for="(actor, index) in group"
|
||||
:key="`filter-actor-${actor.id}`"
|
||||
class="filter-item"
|
||||
:class="{ selected: filters.actors.some((filterActor) => filterActor.id === actor.id), first: groupKey === 'available' && index === 0 && filters.actors.length > 0 }"
|
||||
@click="emit('update', 'actors', [actor])"
|
||||
>
|
||||
<div
|
||||
class="filter-include"
|
||||
@click.stop="toggleActor(actor)"
|
||||
>
|
||||
<Icon
|
||||
icon="checkmark"
|
||||
class="filter-add"
|
||||
/>
|
||||
|
||||
<Icon
|
||||
icon="cross2"
|
||||
class="filter-remove"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span class="filter-name actor-name">
|
||||
<span
|
||||
class="filter-text"
|
||||
:title="actor.name"
|
||||
>{{ actor.name }}</span>
|
||||
|
||||
<span class="filter-details">
|
||||
<div class="actor-gender">
|
||||
<Gender
|
||||
:gender="actor.gender"
|
||||
class="gender"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span
|
||||
v-if="actor.count"
|
||||
class="filter-count"
|
||||
>{{ actor.count }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
<Actor
|
||||
:actor="actor"
|
||||
:index="index"
|
||||
:filters="filters"
|
||||
:toggle-actor="toggleActor"
|
||||
type="selected"
|
||||
@actor="(actor) => emit('update', 'actors', [actor])"
|
||||
/>
|
||||
</ul>
|
||||
|
||||
<UseVirtualList
|
||||
:list="availableActors"
|
||||
:options="{ itemHeight: 30 }"
|
||||
class="filter-items nolist"
|
||||
>
|
||||
<template #default="{ data: actor, index }">
|
||||
<Actor
|
||||
:actor="actor"
|
||||
:index="index"
|
||||
:filters="filters"
|
||||
:toggle-actor="toggleActor"
|
||||
type="available"
|
||||
@actor="(actor) => emit('update', 'actors', [actor])"
|
||||
/>
|
||||
</template>
|
||||
</UseVirtualList>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, inject } from 'vue';
|
||||
import { UseVirtualList } from '@vueuse/components';
|
||||
|
||||
import Actor from '#/components/filters/actor.vue';
|
||||
import Gender from '#/components/actors/gender.vue';
|
||||
|
||||
const props = defineProps({
|
||||
@@ -123,21 +107,19 @@ const order = ref('name');
|
||||
const { pageProps } = inject('pageContext');
|
||||
const { actor: pageActor } = pageProps;
|
||||
|
||||
const groupedActors = computed(() => ({
|
||||
selected: props.filters.actors.map((filterActor) => props.actors.find((actor) => actor.id === filterActor.id)).filter(Boolean),
|
||||
available: props.actors
|
||||
.filter((actor) => !props.filters.actors.some((filterActor) => filterActor.id === actor.id)
|
||||
&& actor.id !== pageActor?.id
|
||||
&& searchRegexp.value.test(actor.name)
|
||||
&& (!selectedGender.value || actor.gender === selectedGender.value))
|
||||
.sort((actorA, actorB) => {
|
||||
if (order.value === 'count') {
|
||||
return actorB.count - actorA.count;
|
||||
}
|
||||
const selectedActors = computed(() => props.filters.actors.map((filterActor) => props.actors.find((actor) => actor.id === filterActor.id)).filter(Boolean));
|
||||
const availableActors = computed(() => props.actors
|
||||
.filter((actor) => !props.filters.actors.some((filterActor) => filterActor.id === actor.id)
|
||||
&& actor.id !== pageActor?.id
|
||||
&& searchRegexp.value.test(actor.name)
|
||||
&& (!selectedGender.value || actor.gender === selectedGender.value))
|
||||
.sort((actorA, actorB) => {
|
||||
if (order.value === 'count') {
|
||||
return actorB.count - actorA.count;
|
||||
}
|
||||
|
||||
return actorA.name.localeCompare(actorB.name);
|
||||
}),
|
||||
}));
|
||||
return actorA.name.localeCompare(actorB.name);
|
||||
}));
|
||||
|
||||
const genders = computed(() => [null, ...['female', 'male', 'transsexual', 'other'].filter((gender) => props.actors.some((actor) => actor.gender === gender))]);
|
||||
|
||||
@@ -171,22 +153,8 @@ function selectGender() {
|
||||
border-top: solid 1px var(--shadow-weak-30);
|
||||
}
|
||||
|
||||
.filter-name {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.actor-name {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.actor-gender {
|
||||
width: 1rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.gender {
|
||||
display: flex;
|
||||
}
|
||||
.list {
|
||||
height: 15rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<input
|
||||
v-model="search"
|
||||
type="search"
|
||||
placeholder="Filter channels"
|
||||
:placeholder="`Filter ${channels.length} channels`"
|
||||
class="input input-inline filters-search"
|
||||
>
|
||||
|
||||
@@ -113,7 +113,10 @@ const entities = computed(() => {
|
||||
|
||||
return Object.values(filteredChannels.reduce((acc, channel) => {
|
||||
if (!channel.parent || channel.isIndependent) {
|
||||
acc[channel.id] = channel;
|
||||
acc[channel.id] = {
|
||||
...channel,
|
||||
children: [],
|
||||
};
|
||||
|
||||
return acc;
|
||||
}
|
||||
@@ -151,7 +154,7 @@ const entities = computed(() => {
|
||||
|
||||
.filter-item.channel {
|
||||
.filter-text .icon {
|
||||
width: 1.5rem;
|
||||
width: 2.25rem;
|
||||
height: 1rem;
|
||||
transform: rotate(-135deg);
|
||||
fill: var(--shadow-weak-30);
|
||||
@@ -160,7 +163,7 @@ const entities = computed(() => {
|
||||
}
|
||||
|
||||
.favicon {
|
||||
width: 1rem;
|
||||
width: 1.75rem;
|
||||
height: 1rem;
|
||||
margin-right: .5rem;
|
||||
object-fit: contain;
|
||||
|
||||
@@ -266,7 +266,7 @@ function toggleFilters(state) {
|
||||
}
|
||||
|
||||
.filter-count {
|
||||
width: 1.5rem;
|
||||
width: 1.75rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<input
|
||||
v-model="search"
|
||||
type="search"
|
||||
placeholder="Filter tags"
|
||||
:placeholder="`Filter ${tags.length} tags`"
|
||||
class="input input-inline filters-search"
|
||||
>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user