Added date of birth filter.

This commit is contained in:
DebaucheryLibrarian 2021-03-03 23:54:54 +01:00
parent 96f9c8f01d
commit 721e6494cf
3 changed files with 63 additions and 0 deletions

View File

@ -81,6 +81,31 @@
<template v-slot:start><Icon icon="flower" /></template> <template v-slot:start><Icon icon="flower" /></template>
<template v-slot:end><Icon icon="pipe" /></template> <template v-slot:end><Icon icon="pipe" /></template>
</RangeFilter> </RangeFilter>
<div class="filter-section">
<label class="filter-label">
<span class="label">
<Checkbox
:checked="dobRequired"
class="checkbox"
@change="(checked) => updateValue('dobRequired', checked, true)"
/>Date of birth
</span>
</label>
<div
class="input-container"
@click="() => updateValue('dobRequired', true, true)"
>
<input
v-model="dob"
:disabled="!dobRequired"
type="date"
class="input"
@change="updateFilters"
>
</div>
</div>
</template> </template>
</Tooltip> </Tooltip>
</li> </li>
@ -202,8 +227,11 @@
</template> </template>
<script> <script>
import dayjs from 'dayjs';
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 RangeFilter from './filter-range.vue'; import RangeFilter from './filter-range.vue';
import Pagination from '../pagination/pagination.vue'; import Pagination from '../pagination/pagination.vue';
@ -220,6 +248,7 @@ function updateFilters() {
h: this.heightRequired ? this.height.join(',') : undefined, h: this.heightRequired ? this.height.join(',') : undefined,
w: this.weightRequired ? this.weight.join(',') : undefined, w: this.weightRequired ? this.weight.join(',') : undefined,
age: this.ageRequired ? this.age.join(',') : undefined, age: this.ageRequired ? this.age.join(',') : undefined,
dob: this.dobRequired ? this.dob : undefined,
}, },
}); });
} }
@ -241,6 +270,7 @@ async function fetchActors(scroll) {
letter: this.letter.replace('all', ''), letter: this.letter.replace('all', ''),
gender: curatedGender === 'other' ? null : curatedGender, gender: curatedGender === 'other' ? null : curatedGender,
age: this.ageRequired && this.age, age: this.ageRequired && this.age,
dob: this.dobRequired && this.dob,
boobSize: this.boobSizeRequired && this.boobSize, boobSize: this.boobSizeRequired && this.boobSize,
naturalBoobs: toggleValues[this.naturalBoobs] ?? null, naturalBoobs: toggleValues[this.naturalBoobs] ?? null,
height: this.heightRequired && this.height, height: this.heightRequired && this.height,
@ -280,6 +310,7 @@ async function mounted() {
export default { export default {
components: { components: {
Actor, Actor,
Checkbox,
Gender, Gender,
RangeFilter, RangeFilter,
Pagination, Pagination,
@ -293,6 +324,8 @@ export default {
letters: ['all'].concat(Array.from({ length: 26 }, (value, index) => String.fromCharCode(index + 97).toUpperCase())), letters: ['all'].concat(Array.from({ length: 26 }, (value, index) => String.fromCharCode(index + 97).toUpperCase())),
age: this.$route.query.age?.split(',') || [18, 100], age: this.$route.query.age?.split(',') || [18, 100],
ageRequired: !!this.$route.query.age, ageRequired: !!this.$route.query.age,
dob: this.$route.query.dob || dayjs().subtract(21, 'years').format('YYYY-MM-DD'),
dobRequired: !!this.$route.query.dob,
boobSizes, boobSizes,
boobSize: this.$route.query.bs?.split(',') || ['A', 'Z'], boobSize: this.$route.query.bs?.split(',') || ['A', 'Z'],
boobSizeRequired: !!this.$route.query.bs, boobSizeRequired: !!this.$route.query.bs,
@ -480,6 +513,10 @@ export default {
font-weight: bold; font-weight: bold;
font-size: .9rem; font-size: .9rem;
.checkbox {
margin: 0 .75rem 0 0;
}
.label { .label {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@ -487,6 +524,15 @@ export default {
} }
} }
.input-container {
box-sizing: border-box;
padding: 0 .5rem .5rem .5rem;
.input {
width: 100%;
}
}
.toggle-container, .toggle-container,
.range-container { .range-container {
display: flex; display: flex;

View File

@ -1,3 +1,16 @@
.input {
box-sizing: border-box;
padding: .5rem;
border: solid 1px var(--shadow-weak);
color: var(--shadow-strong);
background: var(--background);
font-size: 1rem;
&::-webkit-calendar-picker-indicator {
opacity: .5;
}
}
.select { .select {
color: var(--shadow-strong); color: var(--shadow-strong);
background: var(--background); background: var(--background);

View File

@ -269,6 +269,7 @@ function initActorActions(store, router) {
letter, letter,
gender, gender,
age, age,
dob,
naturalBoobs, naturalBoobs,
boobSize, boobSize,
height, height,
@ -300,6 +301,8 @@ function initActorActions(store, router) {
] ]
` : ''; ` : '';
const dobFilter = dob ? `dateOfBirth: { equalTo: "${dob}" }` : '';
const heightFilter = height ? `height: { greaterThanOrEqualTo: ${height[0]}, lessThanOrEqualTo: ${height[1]} }` : ''; const heightFilter = height ? `height: { greaterThanOrEqualTo: ${height[0]}, lessThanOrEqualTo: ${height[1]} }` : '';
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]}" }` : '';
@ -324,6 +327,7 @@ function initActorActions(store, router) {
} }
${genderFilter} ${genderFilter}
${ageFilter} ${ageFilter}
${dobFilter}
${heightFilter} ${heightFilter}
${weightFilter} ${weightFilter}
${cupFilter} ${cupFilter}