Fixed actor count filter showing 1 when none are available, fixed search input not submitting on enter on mobile.
This commit is contained in:
@@ -146,7 +146,8 @@ function updateFilter(prop, value, reload = true) {
|
|||||||
<!-- onsearch not compatible with FF and Safari -->
|
<!-- onsearch not compatible with FF and Safari -->
|
||||||
<input
|
<input
|
||||||
v-model="q"
|
v-model="q"
|
||||||
type="input"
|
type="text"
|
||||||
|
enterkeyhint="search"
|
||||||
placeholder="Search actors"
|
placeholder="Search actors"
|
||||||
class="input search"
|
class="input search"
|
||||||
@keydown.enter="search"
|
@keydown.enter="search"
|
||||||
|
|||||||
@@ -35,18 +35,22 @@ const dragging = ref({});
|
|||||||
const sliders = computed(() => rows.map((row) => {
|
const sliders = computed(() => rows.map((row) => {
|
||||||
const filter = props.filters[row.key];
|
const filter = props.filters[row.key];
|
||||||
const buckets = props.counts?.[row.key] || [];
|
const buckets = props.counts?.[row.key] || [];
|
||||||
const countMax = buckets.at(-1)?.value ?? sliderCap; // buckets are sorted by value
|
// buckets are sorted by value; without aggregations at all, fall back to the full slider
|
||||||
// at least 1 to keep the slider usable, and never below the active filter so its handles stay in view
|
const countMax = props.counts ? (buckets.at(-1)?.value ?? 0) : sliderCap;
|
||||||
const max = Math.max(1, Math.min(countMax, sliderCap), filter?.min ?? 0, filter?.max ?? 0);
|
// nothing above 0 to filter for, e.g. no trans performers in any matching scene; an active filter keeps it usable so it can be reset
|
||||||
const value = [filter?.min ?? 0, filter?.max ?? max];
|
const isEmpty = countMax < 1 && !filter;
|
||||||
|
// collapsed to 0 when empty, otherwise at least 1 so the slider has somewhere to go, and never below the active filter so its handles stay in view
|
||||||
|
const max = isEmpty ? 0 : Math.max(1, Math.min(countMax, sliderCap), filter?.min ?? 0, filter?.max ?? 0);
|
||||||
|
const value = isEmpty ? [0, 0] : [filter?.min ?? 0, filter?.max ?? max];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
max,
|
max,
|
||||||
|
isEmpty,
|
||||||
isCapped: countMax > max,
|
isCapped: countMax > max,
|
||||||
value,
|
value,
|
||||||
display: dragging.value[row.key] || value,
|
display: dragging.value[row.key] || value,
|
||||||
mountKey: `${row.key}-${max}-${value.join('-')}`, // remount when the range or filter changes, the slider only reads its value on mount
|
mountKey: `${row.key}-${max}-${value.join('-')}-${isEmpty}`, // remount when the range or filter changes, the slider only reads its value on mount
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -90,6 +94,7 @@ function updateRange(slider, [min, max], reload) {
|
|||||||
:min="0"
|
:min="0"
|
||||||
:max="slider.max"
|
:max="slider.max"
|
||||||
:value="slider.value"
|
:value="slider.value"
|
||||||
|
:disabled="slider.isEmpty"
|
||||||
:allow-enable="false"
|
:allow-enable="false"
|
||||||
@input="(range) => updateRange(slider, range, false)"
|
@input="(range) => updateRange(slider, range, false)"
|
||||||
@change="(range) => updateRange(slider, range, true)"
|
@change="(range) => updateRange(slider, range, true)"
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ const range = ref({
|
|||||||
|
|
||||||
const minValue = computed(() => Math.min(range.value.a, range.value.b));
|
const minValue = computed(() => Math.min(range.value.a, range.value.b));
|
||||||
const maxValue = computed(() => Math.max(range.value.a, range.value.b));
|
const maxValue = computed(() => Math.max(range.value.a, range.value.b));
|
||||||
const minPercentage = computed(() => ((minValue.value - props.min) / (props.max - props.min)) * 100);
|
const span = computed(() => props.max - props.min || 1); // a collapsed range (min equals max) would divide by zero
|
||||||
const maxPercentage = computed(() => ((maxValue.value - props.min) / (props.max - props.min)) * 100);
|
const minPercentage = computed(() => ((minValue.value - props.min) / span.value) * 100);
|
||||||
|
const maxPercentage = computed(() => ((maxValue.value - props.min) / span.value) * 100);
|
||||||
|
|
||||||
function set(type = 'change') {
|
function set(type = 'change') {
|
||||||
if (props.values) {
|
if (props.values) {
|
||||||
|
|||||||
@@ -188,7 +188,8 @@ function updateFilter(prop, value, reload = true) {
|
|||||||
<!-- onsearch not compatible with FF and Safari -->
|
<!-- onsearch not compatible with FF and Safari -->
|
||||||
<input
|
<input
|
||||||
v-model="filters.search"
|
v-model="filters.search"
|
||||||
type="input"
|
type="text"
|
||||||
|
enterkeyhint="search"
|
||||||
placeholder="Search movies"
|
placeholder="Search movies"
|
||||||
class="search input"
|
class="search input"
|
||||||
@keydown.enter="search"
|
@keydown.enter="search"
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ function setView(newView) {
|
|||||||
<!-- onsearch not compatible with FF and Safari -->
|
<!-- onsearch not compatible with FF and Safari -->
|
||||||
<input
|
<input
|
||||||
v-model="filters.search"
|
v-model="filters.search"
|
||||||
type="input"
|
type="text"
|
||||||
|
enterkeyhint="search"
|
||||||
placeholder="Search scenes"
|
placeholder="Search scenes"
|
||||||
class="search input"
|
class="search input"
|
||||||
@keydown.enter="search"
|
@keydown.enter="search"
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-model="actorQuery"
|
v-model="actorQuery"
|
||||||
type="input"
|
type="text"
|
||||||
placeholder="Search actors"
|
placeholder="Search actors"
|
||||||
class="input search-input"
|
class="input search-input"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ async function search() {
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
v-model="query"
|
v-model="query"
|
||||||
type="input"
|
type="text"
|
||||||
|
enterkeyhint="search"
|
||||||
placeholder="Search channels"
|
placeholder="Search channels"
|
||||||
class="search input"
|
class="search input"
|
||||||
@keydown.enter="search"
|
@keydown.enter="search"
|
||||||
|
|||||||
@@ -127,7 +127,8 @@ onMounted(() => {
|
|||||||
<input
|
<input
|
||||||
ref="searchInput"
|
ref="searchInput"
|
||||||
v-model="query"
|
v-model="query"
|
||||||
type="input"
|
type="text"
|
||||||
|
enterkeyhint="search"
|
||||||
placeholder="Search tags"
|
placeholder="Search tags"
|
||||||
class="search input"
|
class="search input"
|
||||||
@keydown.enter="search"
|
@keydown.enter="search"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const reportReasons = {
|
|||||||
broken: 'It\'s not tracking new releases',
|
broken: 'It\'s not tracking new releases',
|
||||||
archive: 'It\'s missing older releases',
|
archive: 'It\'s missing older releases',
|
||||||
misplaced: 'It\'s tracking the wrong releases',
|
misplaced: 'It\'s tracking the wrong releases',
|
||||||
incomplete: 'Releases are missing available details or media',
|
incomplete: 'Releases are missing available details or cover photos',
|
||||||
channel: 'Network is missing a channel',
|
channel: 'Network is missing a channel',
|
||||||
illegal: 'Content is illegal or deeply concerning',
|
illegal: 'Content is illegal or deeply concerning',
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user