Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/randomize placeholder in assistant (#6889)

Thomas Kaul875a39df4ae3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d696039ba..b20c3e40eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Improved the pagination in the activities table of the holding detail dialog
+- Randomized the placeholder in the assistant
- Enabled the _Bull Dashboard_ in the admin control panel without requiring an environment variable (experimental)
- Extracted the page tabs to a reusable component
- Upgraded `bull-board` from version `7.0.0` to `7.1.5`
diff --git a/libs/ui/src/lib/assistant/assistant.component.ts b/libs/ui/src/lib/assistant/assistant.component.ts
index 5decd9d666..a0985a9794 100644
--- a/libs/ui/src/lib/assistant/assistant.component.ts
+++ b/libs/ui/src/lib/assistant/assistant.component.ts
@@ -40,7 +40,7 @@ import {
closeOutline,
searchOutline
} from 'ionicons/icons';
-import { isFunction } from 'lodash';
+import { isFunction, sample } from 'lodash';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { EMPTY, Observable, merge, of } from 'rxjs';
import {
@@ -106,14 +106,17 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
public dateRangeFormControl = new FormControl<string | null>(null);
public dateRangeOptions: DateRangeOption[] = [];
public holdings: PortfolioPosition[] = [];
+
public isLoading = {
accounts: false,
assetProfiles: false,
holdings: false,
quickLinks: false
};
+
public isOpen = false;
- public placeholder = $localize`Find account, holding or page...`;
+ public placeholder: string;
+
public portfolioFilterFormControl = new FormControl<PortfolioFilterFormValue>(
{
account: null,
@@ -122,13 +125,16 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
tag: null
}
);
+
public searchFormControl = new FormControl('');
+
public searchResults: SearchResults = {
accounts: [],
assetProfiles: [],
holdings: [],
quickLinks: []
};
+
public tags: Filter[] = [];
protected readonly closed = output<void>();
@@ -458,7 +464,15 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
holdings: true,
quickLinks: true
};
+
this.keyManager = new FocusKeyManager(this.assistantListItems).withWrap();
+
+ this.placeholder = sample([
+ $localize`Find an account...`,
+ $localize`Find a holding...`,
+ $localize`Jump to a page...`
+ ]);
+
this.searchResults = {
accounts: [],
assetProfiles: [],
@@ -471,6 +485,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
}
this.searchFormControl.setValue('');
+
setTimeout(() => {
this.searchElement?.nativeElement?.focus();
});
@@ -481,6 +496,7 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
holdings: false,
quickLinks: false
};
+
this.setIsOpen(true);
this.dataService