fix: filter style tweaks, loading icon patch

This commit is contained in:
2025-07-26 17:39:28 -05:00
parent 18a165fc40
commit 9db0bfd4c6
10 changed files with 82 additions and 42 deletions

View File

@@ -14,7 +14,22 @@ export default class extends Controller {
static targets = ['icon']
connect() {
this.element.hideIcon = this.hideIcon.bind(this);
this.element.showIcon = this.showIcon.bind(this);
this.element.toggleIcon = this.toggleIcon.bind(this);
this.element.isVisibile = this.isVisible.bind(this);
}
isVisible() {
return !this.iconTarget.classList.contains('hidden');
}
showIcon() {
this.iconTarget.classList.remove('hidden');
}
hideIcon() {
this.iconTarget.classList.add('hidden');
}
toggleIcon() {

View File

@@ -22,7 +22,7 @@ export default class extends Controller {
defaultOptions = '<option value="">n/a</option><option value="-">-</option>';
static outlets = ['tv-episode-list']
static targets = ['resolution', 'codec', 'language', 'provider', 'season', 'quality', 'selectAll', 'downloadSelected']
static targets = ['resolution', 'codec', 'language', 'provider', 'season', 'quality', 'loadingIcon', 'selectAll', 'downloadSelected']
static values = {
'imdbId': String,
'media-type': String,
@@ -34,19 +34,24 @@ export default class extends Controller {
if (this.mediaTypeValue === "tvshows") {
this.activeFilter['season'] = 1;
}
await this.filter();
this.filter();
this.setTimerToStopLoadingIcon();
document.addEventListener('optionsLoaded', this.loadOptions.bind(this));
}
setTimerToStopLoadingIcon() {
setTimeout(() => this.loadingIconTarget.hideIcon(), 10000);
}
// Event is fired from movies/tvshows controllers to populate this data
async loadOptions({detail: { options }}) {
await options.forEach((option) => {
loadOptions({detail: { options }}) {
options.forEach((option) => {
this.addLanguages(option);
this.addProviders(option);
this.addQualities(option);
})
await this.filter();
this.filter();
}
selectAllEpisodes() {
@@ -96,7 +101,7 @@ export default class extends Controller {
this.qualityTarget.tomselect.items = preferred;
}
async filter() {
filter() {
const downloadSeasonSpan = document.querySelector("#downloadSeasonModal");
this.activeFilter = {