Browse Source

Feature/add link to Duck.ai to copy AI prompt action (#4272)

* Add link to Duck.ai

* Update changelog
pull/4271/head^2
Thomas Kaul 2 months ago
committed by GitHub
parent
commit
f638b102da
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 33
      apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts

1
CHANGELOG.md

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### 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 - Extracted the tags selector to a reusable component used in the create or update activity dialog and holding detail dialog
### Changed ### Changed

33
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 { MatSnackBar } from '@angular/material/snack-bar';
import { SymbolProfile } from '@prisma/client'; import { SymbolProfile } from '@prisma/client';
import { isNumber, sortBy } from 'lodash'; import { isNumber, sortBy } from 'lodash';
import ms from 'ms';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@ -142,17 +143,27 @@ export class AnalysisPageComponent implements OnDestroy, OnInit {
} }
public onCopyPromptToClipboard() { public onCopyPromptToClipboard() {
this.dataService.fetchPrompt().subscribe(({ prompt }) => { this.dataService
this.clipboard.copy(prompt); .fetchPrompt()
.pipe(takeUntil(this.unsubscribeSubject))
this.snackBar.open( .subscribe(({ prompt }) => {
'✅ ' + $localize`AI prompt has been copied to the clipboard`, this.clipboard.copy(prompt);
undefined,
{ const snackBarRef = this.snackBar.open(
duration: 3000 '✅ ' + $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() { public ngOnDestroy() {

Loading…
Cancel
Save