}
private changeType(): void {
+ let hasVisibleFilters = false;
document.querySelectorAll(".objectTypeSearchFilters").forEach((filter: HTMLElement) => {
- filter.hidden = filter.dataset.objectType !== this.typeInput.value;
+ if (filter.dataset.objectType === this.typeInput.value) {
+ hasVisibleFilters = true;
+ filter.hidden = false;
+ } else {
+ filter.hidden = true;
+ }
});
+
+ const title = document.querySelector(".searchFiltersTitle") as HTMLElement;
+ if (hasVisibleFilters) {
+ const selectedOption = this.typeInput.selectedOptions.item(0)!;
+ title.textContent = selectedOption.textContent!.trim();
+
+ title.hidden = false;
+ } else {
+ title.hidden = true;
+ }
}
- private async search(): Promise<void> {
+ private async search(searchAction: SearchAction): Promise<void> {
if (!this.queryInput.value.trim() && !this.usernameInput.value.trim()) {
return;
}
});
}
changeType() {
+ let hasVisibleFilters = false;
document.querySelectorAll(".objectTypeSearchFilters").forEach((filter) => {
- filter.hidden = filter.dataset.objectType !== this.typeInput.value;
+ if (filter.dataset.objectType === this.typeInput.value) {
+ hasVisibleFilters = true;
+ filter.hidden = false;
+ }
+ else {
+ filter.hidden = true;
+ }
});
+ const title = document.querySelector(".searchFiltersTitle");
+ if (hasVisibleFilters) {
+ const selectedOption = this.typeInput.selectedOptions.item(0);
+ title.textContent = selectedOption.textContent.trim();
+ title.hidden = false;
+ }
+ else {
+ title.hidden = true;
+ }
}
- async search() {
+ async search(searchAction) {
var _a;
if (!this.queryInput.value.trim() && !this.usernameInput.value.trim()) {
return;