Skip to content

Commit

Permalink
feat: show number of filtered tabs, not total tabs all the time
Browse files Browse the repository at this point in the history
  • Loading branch information
shonya3 committed Jun 27, 2024
1 parent 1f3e7e3 commit fd9a98e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/wc/src/wc/stashes/tab-badge-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class TabBadgeGroupElement extends BaseElement {

@state() hideRemoveOnly = false;

@query('sl-checkbox') checkbox!: HTMLInputElement;
@query('sl-checkbox#hide-remove-only') checkbox!: HTMLInputElement;
@query('sl-input#per-page') perPageInput!: HTMLInputElement;
@query('sl-input#page') pageInput!: HTMLInputElement;
@query('sl-input#filter-stashes-by-name') nameQueryInput!: HTMLInputElement;
Expand All @@ -82,7 +82,7 @@ export class TabBadgeGroupElement extends BaseElement {
return paginate(this.filtered, this.page, this.perPage);
}
get tabsTotal() {
return this.stashes.length;
return this.filtered.length;
}

willUpdate(changed: Map<string, unknown>) {
Expand Down Expand Up @@ -120,7 +120,7 @@ export class TabBadgeGroupElement extends BaseElement {
? html` <div class="hide-remove-only">
<sl-checkbox
id="hide-remove-only"
@sl-change=${() => (this.hideRemoveOnly = this.checkbox.checked)}
@sl-change=${this.#onHideRemoveOnlyChange}
.checked=${this.hideRemoveOnly}
>Hide remove-only</sl-checkbox
>
Expand Down Expand Up @@ -152,6 +152,9 @@ export class TabBadgeGroupElement extends BaseElement {
</div>`;
}

#onHideRemoveOnlyChange() {
this.hideRemoveOnly = this.checkbox.checked;
}
#onPageChange(e: Event) {
if (e.target instanceof PaginationElement) {
this.page = e.target.page;
Expand Down

0 comments on commit fd9a98e

Please sign in to comment.