Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript π€
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/add link to Duck.ai to copy AI prompt action (#4272)
Thomas Kaulf638b102dacf
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ea3614b22e..4de4ab2ccb 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Added+- Added a link to _Duck.ai_ to the _Copy AI prompt to clipboard_ action on the analysis page (experimental)- Extracted the tags selector to a reusable component used in the create or update activity dialog and holding detail dialog### Changeddiff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.tsindex 7e27a05f9d..a9a189d1fe 100644--- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts+++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts@@ -20,6 +20,7 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';import { MatSnackBar } from '@angular/material/snack-bar';import { SymbolProfile } from '@prisma/client';import { isNumber, sortBy } from 'lodash';+import ms from 'ms';import { DeviceDetectorService } from 'ngx-device-detector';import { Subject } from 'rxjs';import { takeUntil } from 'rxjs/operators';@@ -142,17 +143,27 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {}public onCopyPromptToClipboard() {- this.dataService.fetchPrompt().subscribe(({ prompt }) => {- this.clipboard.copy(prompt);-- this.snackBar.open(- 'β ' + $localize`AI prompt has been copied to the clipboard`,- undefined,- {- duration: 3000- }- );- });+ this.dataService+ .fetchPrompt()+ .pipe(takeUntil(this.unsubscribeSubject))+ .subscribe(({ prompt }) => {+ this.clipboard.copy(prompt);++ const snackBarRef = this.snackBar.open(+ 'β ' + $localize`AI prompt has been copied to the clipboard`,+ $localize`Open Duck.ai` + ' β',+ {+ duration: ms('7 seconds')+ }+ );++ snackBarRef+ .onAction()+ .pipe(takeUntil(this.unsubscribeSubject))+ .subscribe(() => {+ window.open('https://duck.ai', '_blank');+ });+ });}public ngOnDestroy() {