Add drumsReviewed filter

This commit is contained in:
Geomitron
2025-03-11 22:57:04 -05:00
parent 3881a69176
commit a70f968806
6 changed files with 47 additions and 2 deletions

View File

@@ -55,7 +55,7 @@
@if (instrument === 'drums') {
<!-- Drum Type Dropdown -->
<div class="dropdown">
<label tabindex="0" class="btn btn-neutral rounded-btn rounded-l-none uppercase">{{ drumTypeDisplay(drumType) }}</label>
<label tabindex="0" class="btn btn-neutral rounded-btn rounded-l-none rounded-r-none uppercase">{{ drumTypeDisplay(drumType) }}</label>
<ul tabindex="0" class="menu dropdown-content z-[2] p-2 shadow bg-neutral text-neutral-content rounded-box w-40">
<li>
<a (click)="setDrumType(null, $event)">{{ drumTypeDisplay(null) }}</a>
@@ -67,6 +67,18 @@
}
</ul>
</div>
<!-- Drums Reviewed Dropdown -->
<div class="dropdown">
<label tabindex="0" class="btn btn-neutral rounded-btn rounded-l-none uppercase">{{ drumsReviewedDisplay(drumsReviewed) }}</label>
<ul tabindex="0" class="menu dropdown-content z-[2] w-40 rounded-box bg-neutral p-2 text-neutral-content shadow">
<li>
<a (click)="setDrumsReviewed(true, $event)">{{ drumsReviewedDisplay(true) }}</a>
</li>
<li>
<a (click)="setDrumsReviewed(false, $event)">{{ drumsReviewedDisplay(false) }}</a>
</li>
</ul>
</div>
}
</div>
<div class="flex-1 flex-grow-[3] h-0"></div>

View File

@@ -5,7 +5,7 @@ import dayjs from 'dayjs'
import { distinctUntilChanged, switchMap, throttleTime } from 'rxjs'
import { Difficulty, Instrument } from 'scan-chart'
import { SearchService } from 'src-angular/app/core/services/search.service'
import { difficulties, difficultyDisplay, drumTypeDisplay, DrumTypeName, drumTypeNames, instrumentDisplay, instruments } from 'src-shared/UtilFunctions'
import { difficulties, difficultyDisplay, drumsReviewedDisplay, drumTypeDisplay, DrumTypeName, drumTypeNames, instrumentDisplay, instruments } from 'src-shared/UtilFunctions'
@Component({
selector: 'app-search-bar',
@@ -30,6 +30,7 @@ export class SearchBarComponent implements OnInit, AfterViewInit {
public instrumentDisplay = instrumentDisplay
public difficultyDisplay = difficultyDisplay
public drumTypeDisplay = drumTypeDisplay
public drumsReviewedDisplay = drumsReviewedDisplay
public advancedSearchForm: ReturnType<this['getAdvancedSearchForm']>
public startValidation = false
@@ -103,6 +104,16 @@ export class SearchBarComponent implements OnInit, AfterViewInit {
}
}
get drumsReviewed() {
return this.searchService.drumsReviewed.value
}
setDrumsReviewed(drumsReviewed: boolean, event: MouseEvent) {
this.searchService.drumsReviewed.setValue(drumsReviewed)
if (event.target instanceof HTMLElement) {
event.target.parentElement?.parentElement?.blur()
}
}
get todayDate() {
return dayjs().format('YYYY-MM-DD')
}
@@ -225,6 +236,7 @@ export class SearchBarComponent implements OnInit, AfterViewInit {
instrument: this.instrument,
difficulty: this.difficulty,
drumType: this.drumType,
drumsReviewed: this.drumsReviewed,
sort: this.searchService.sortColumn !== null ? { type: this.searchService.sortColumn, direction: this.searchService.sortDirection } : null,
source: 'bridge' as const,
...this.advancedSearchForm.getRawValue(),