Using range component for all actor range filters.

This commit is contained in:
DebaucheryLibrarian 2021-03-03 22:23:46 +01:00
parent 5c6b5a0668
commit 4a963885bc
4 changed files with 68 additions and 140 deletions

View File

@ -65,7 +65,7 @@
<span <span
class="filter-trigger" class="filter-trigger"
:class="{ enabled: ageRequired }" :class="{ enabled: ageRequired }"
><Icon icon="cake" />Age</span> ><Icon icon="vcard" />Age</span>
<template v-slot:tooltip> <template v-slot:tooltip>
<RangeFilter <RangeFilter
@ -74,7 +74,6 @@
:max="100" :max="100"
:value="age" :value="age"
:disabled="!ageRequired" :disabled="!ageRequired"
:allow-enable="true"
@enable="(checked) => updateValue('ageRequired', checked, true)" @enable="(checked) => updateValue('ageRequired', checked, true)"
@input="(range) => updateValue('age', range, false)" @input="(range) => updateValue('age', range, false)"
@change="(range) => updateValue('age', range, true)" @change="(range) => updateValue('age', range, true)"
@ -87,51 +86,27 @@
</li> </li>
<li> <li>
<Tooltip class="filter boobs"> <Tooltip class="filter">
<span <span
class="filter-trigger" class="filter-trigger boobs"
:class="{ enabled: boobSizeRequired || naturalBoobs !== 1 }" :class="{ enabled: boobSizeRequired || naturalBoobs !== 1 }"
><Icon icon="boobs" />Boobs</span> ><Icon icon="boobs" />Boobs</span>
<template v-slot:tooltip> <template v-slot:tooltip>
<div class="filter-section boobsize"> <RangeFilter
<label class="filter-label off noselect"> label="size"
<span class="label">
<Checkbox
:checked="boobSizeRequired"
class="checkbox"
@change="(checked) => updateValue('boobSizeRequired', checked)"
/>Size
</span>
<span
v-if="boobSizeRequired"
class="label-values"
>({{ boobSize[0] }} - {{ boobSize[1] }})</span>
</label>
<span class="filter-split">
<Range
:min="0" :min="0"
:max="boobSizes.length - 1" :max="boobSizes.length - 1"
:value="boobSize" :value="boobSize"
:values="boobSizes" :values="boobSizes"
:disabled="!boobSizeRequired" :disabled="!boobSizeRequired"
:allow-enable="true" @enable="(checked) => updateValue('boobSizeRequired', checked, true)"
@enable="boobSizeRequired = true" @input="(range) => updateValue('boobSize', range, false)"
@input="(sizeRange) => updateValue('boobSize', sizeRange, false)" @change="(range) => updateValue('boobSize', range, true)"
@change="(sizeRange) => updateValue('boobSize', sizeRange, true)"
> >
<template v-slot:start> <template v-slot:start><Icon icon="boobs-small" /></template>
<span class="range-label"><Icon icon="boobs-small" /></span> <template v-slot:end><Icon icon="boobs-big" /></template>
</template> </RangeFilter>
<template v-slot:end>
<span class="range-label on"><Icon icon="boobs-big" /></span>
</template>
</Range>
</span>
</div>
<div class="filter-section"> <div class="filter-section">
<span class="filter-label">Enhanced</span> <span class="filter-label">Enhanced</span>
@ -172,71 +147,35 @@
><Icon icon="rulers" />Physique</span> ><Icon icon="rulers" />Physique</span>
<template v-slot:tooltip> <template v-slot:tooltip>
<div class="filter-section"> <RangeFilter
<label class="filter-label noselect"> label="height"
<span class="label">
<Checkbox
:checked="heightRequired"
class="checkbox"
@change="(checked) => updateValue('heightRequired', checked)"
/>Height
</span>
<span
v-if="heightRequired"
class="label-values"
>({{ height[0] }} - {{ height[1] }} cm)</span>
</label>
<span class="filter-split">
<Range
:min="50" :min="50"
:max="220" :max="220"
:value="height" :value="height"
:disabled="!heightRequired" :disabled="!heightRequired"
:allow-enable="true" unit="cm"
@enable="heightRequired = true" @enable="(checked) => updateValue('heightRequired', checked, true)"
@input="(heightRange) => updateValue('height', heightRange, false)" @input="(range) => updateValue('height', range, false)"
@change="(heightRange) => updateValue('height', heightRange, true)" @change="(range) => updateValue('height', range, true)"
> >
<template v-slot:start><Icon icon="height-short" /></template> <template v-slot:start><Icon icon="height-short" /></template>
<template v-slot:end><Icon icon="height" /></template> <template v-slot:end><Icon icon="height" /></template>
</Range> </RangeFilter>
</span>
</div>
<div class="filter-section"> <RangeFilter
<label class="filter-label noselect"> label="weight"
<span class="label">
<Checkbox
:checked="weightRequired"
class="checkbox"
@change="(checked) => updateValue('weightRequired', checked)"
/>Weight
</span>
<span
v-if="weightRequired"
class="label-values"
>({{ weight[0] }} - {{ weight[1] }} kg)</span>
</label>
<span class="filter-split">
<Range
:min="30" :min="30"
:max="200" :max="200"
:value="weight" :value="weight"
:disabled="!weightRequired" :disabled="!weightRequired"
:allow-enable="true" unit="kg"
@enable="weightRequired = true" @enable="(checked) => updateValue('weightRequired', checked, true)"
@input="(weightRange) => updateValue('weight', weightRange, false)" @input="(range) => updateValue('weight', range, false)"
@change="(weightRange) => updateValue('weight', weightRange, true)" @change="(range) => updateValue('weight', range, true)"
> >
<template v-slot:start><Icon icon="meter-slow" /></template> <template v-slot:start><Icon icon="meter-slow" /></template>
<template v-slot:end><Icon icon="meter-fast" /></template> <template v-slot:end><Icon icon="meter-fast" /></template>
</Range> </RangeFilter>
</span>
</div>
</template> </template>
</Tooltip> </Tooltip>
</li> </li>
@ -265,8 +204,6 @@
<script> <script>
import Actor from './tile.vue'; import Actor from './tile.vue';
import Gender from './gender.vue'; import Gender from './gender.vue';
import Checkbox from '../form/checkbox.vue';
import Range from '../form/range.vue';
import RangeFilter from './filter-range.vue'; import RangeFilter from './filter-range.vue';
import Pagination from '../pagination/pagination.vue'; import Pagination from '../pagination/pagination.vue';
@ -343,9 +280,7 @@ async function mounted() {
export default { export default {
components: { components: {
Actor, Actor,
Checkbox,
Gender, Gender,
Range,
RangeFilter, RangeFilter,
Pagination, Pagination,
}, },
@ -447,6 +382,7 @@ export default {
border-right: solid 1px var(--shadow-hint); border-right: solid 1px var(--shadow-hint);
margin: 0 1rem 0 0; margin: 0 1rem 0 0;
} }
.letter, .letter,
.gender { .gender {
display: inline-block; display: inline-block;
@ -504,9 +440,9 @@ export default {
.icon { .icon {
fill: var(--shadow); fill: var(--shadow);
width: 1.5rem; width: 1rem;
height: 1.5rem; height: 1rem;
margin: 0 .5rem 0 0; margin: -.1rem .75rem 0 0;
} }
&:hover { &:hover {
@ -527,10 +463,13 @@ export default {
} }
} }
.filter-section { .label-values {
width: 15rem; font-weight: normal;
max-width: 100%; }
border-bottom: solid 1px var(--darken-hint);
.filter-split {
display: flex;
align-items: center;
} }
.filter-label { .filter-label {
@ -544,24 +483,8 @@ export default {
.label { .label {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
text-transform: capitalize;
} }
.checkbox {
margin: 0 .75rem 0 0;
}
.icon {
margin: 0 .5rem 0 0;
}
}
.label-values {
font-weight: normal;
}
.filter-split {
display: flex;
align-items: center;
} }
.toggle-container, .toggle-container,

View File

@ -10,8 +10,9 @@
</span> </span>
<span <span
v-if="!disabled"
class="label-values" class="label-values"
>({{ value[0] }} - {{ value[1] }} {{ unit }})</span> >({{ value[0] }} - {{ value[1] }}<template v-if="unit">&nbsp;{{ unit }}</template>)</span>
</label> </label>
<span class="filter-split"> <span class="filter-split">
@ -19,8 +20,9 @@
:min="min" :min="min"
:max="max" :max="max"
:value="value" :value="value"
:values="values"
:disabled="disabled" :disabled="disabled"
:allow-enable="true" :allow-enable="allowEnable"
@enable="$emit('enable', true)" @enable="$emit('enable', true)"
@input="(range) => $emit('input', range)" @input="(range) => $emit('input', range)"
@change="(range) => $emit('change', range)" @change="(range) => $emit('change', range)"
@ -50,6 +52,10 @@ export default {
type: Array, type: Array,
default: () => [0, 10], default: () => [0, 10],
}, },
values: {
type: Array,
default: null,
},
min: { min: {
type: Number, type: Number,
default: 0, default: 0,

View File

@ -132,7 +132,7 @@ export default {
}, },
allowEnable: { allowEnable: {
type: Boolean, type: Boolean,
default: false, default: true,
}, },
}, },
emits: ['change', 'input', 'enable'], emits: ['change', 'input', 'enable'],

View File

@ -1,8 +1,9 @@
import config from 'config'; import config from 'config';
import dayjs from 'dayjs';
import { graphql, get } from '../api'; import { graphql, get } from '../api';
import { releaseFields, getIncludedEntities, getIncludedActors } from '../fragments'; import { releaseFields, getIncludedEntities, getIncludedActors } from '../fragments';
import { curateActor, curateRelease } from '../curate'; import { curateActor, curateRelease } from '../curate';
import dayjs from 'dayjs';
import getDateRange from '../get-date-range'; import getDateRange from '../get-date-range';
function initActorActions(store, router) { function initActorActions(store, router) {
@ -300,8 +301,6 @@ function initActorActions(store, router) {
const weightFilter = weight ? `weight: { greaterThanOrEqualTo: ${weight[0]}, lessThanOrEqualTo: ${weight[1]} }` : ''; const weightFilter = weight ? `weight: { greaterThanOrEqualTo: ${weight[0]}, lessThanOrEqualTo: ${weight[1]} }` : '';
const cupFilter = boobSize ? `cup: { greaterThanOrEqualTo: "${boobSize[0]}", lessThanOrEqualTo: "${boobSize[1]}" }` : ''; const cupFilter = boobSize ? `cup: { greaterThanOrEqualTo: "${boobSize[0]}", lessThanOrEqualTo: "${boobSize[1]}" }` : '';
console.log(ageFilter);
const { connection: { actors, totalCount } } = await graphql(` const { connection: { actors, totalCount } } = await graphql(`
query Actors( query Actors(
$limit: Int, $limit: Int,