Skip to content

Commit

Permalink
fix: fix minor icon misalignment (#1755)
Browse files Browse the repository at this point in the history
## Description
- Added enter and escape key handlers for text search input
- Removed unused edit mode state in datasets filter
- Reduced debounce time for text filter to improve responsiveness
- Adjusted cart icon position

<img width="309" alt="image"
src="https://github.com/user-attachments/assets/da2d6db8-d1c6-4430-9fe1-d9932d1cf710"
/>

## Motivation
Background on use case, changes needed


## Fixes:
Please provide a list of the fixes implemented in this PR

* Items added


## Changes:
Please provide a list of the changes implemented by this PR

* changes made


## Tests included
- [ ] Included for each change/fix?
- [ ] Passing? (Merge will not be approved unless this is checked) 

## Documentation
- [ ] swagger documentation updated \[required\]
- [ ] official documentation updated \[nice-to-have\]

### official documentation info
If you have updated the official documentation, please provide PR # and
URL of the pages where the updates are included

## Backend version
- [ ] Does it require a specific version of the backend
- which version of the backend is required:

## Summary by Sourcery

This pull request enhances the search functionality and improves filter
performance. It adds keyboard support to the search bar, improves the
responsiveness of the text filter, and removes an unused state variable.

New Features:
- The search bar now supports submitting the search query by pressing
the Enter key.
- The search bar now supports clearing the search query by pressing the
Escape key.

Bug Fixes:
- Removed unused `isInEditMode` state in the datasets filter component.

Enhancements:
- Improved the responsiveness of the text filter by reducing the
debounce time.
  • Loading branch information
Junjiequan authored Feb 24, 2025
1 parent 05ed3be commit 89ce55f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
16 changes: 7 additions & 9 deletions src/app/_layout/app-header/app-header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ <h6>
</span>
<ng-template #userButton>
<span *ngIf="config.shoppingCartOnHeader" [matMenuTriggerFor]="cartMenu">
<button
id="cartOnHeaderButton"
mat-icon-button
matBadge="{{ inBatchIndicator$ | async }}"
matBadgePosition="after"
matBadgeColor="accent"
matBadgeSize="medium"
>
<mat-icon> shopping_cart </mat-icon>
<button id="cartOnHeaderButton" mat-icon-button>
<mat-icon
matBadge="{{ inBatchIndicator$ | async }}"
matBadgeColor="accent"
matBadgeSize="medium"
>shopping_cart</mat-icon
>
</button>
</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
type="search"
[(ngModel)]="searchTerm"
(ngModelChange)="onSearchTermChange($event)"
(keydown.enter)="onSearch()"
(keydown.escape)="onClear()"
/>
</mat-form-field>
<div class="search-button-group">
Expand Down
3 changes: 0 additions & 3 deletions src/app/datasets/datasets-filter/datasets-filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy {

hasAppliedFilters$ = this.store.select(selectHasAppliedFilters);

isInEditMode = false;

labelMaps: { [key: string]: string } = {};

constructor(
Expand Down Expand Up @@ -176,7 +174,6 @@ export class DatasetsFilterComponent implements OnInit, OnDestroy {
}

applyFilters() {
this.isInEditMode = false;
this.store.dispatch(fetchDatasetsAction());
this.store.dispatch(fetchFacetCountsAction());
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/modules/filters/text-filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class TextFilterComponent
this.subscription = this.textSubject
.pipe(
skipWhile((terms) => terms === ""),
debounceTime(500),
debounceTime(200),
distinctUntilChanged(),
)
.subscribe((terms) => {
Expand Down

0 comments on commit 89ce55f

Please sign in to comment.