diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f3d7b1a9..dd2ec27a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Added support for bonds in the import dividends dialog +- Added a _Copy link to clipboard_ action to the access table to share the portfolio - Added the current market price column to the historical market data table of the admin control - Introduced filters (`dataSource` and `symbol`) in the accounts endpoint diff --git a/apps/client/src/app/components/access-table/access-table.component.html b/apps/client/src/app/components/access-table/access-table.component.html index b1befc8c9..e625cbf75 100644 --- a/apps/client/src/app/components/access-table/access-table.component.html +++ b/apps/client/src/app/components/access-table/access-table.component.html @@ -35,11 +35,9 @@ @if (element.type === 'PUBLIC') {
- {{ baseUrl }}/{{ defaultLanguageCode }}/p/{{ element.id }} + {{ + getPublicUrl(element.id) + }}
} @@ -58,6 +56,11 @@ + @if (element.type === 'PUBLIC') { + + } diff --git a/apps/client/src/app/components/access-table/access-table.component.ts b/apps/client/src/app/components/access-table/access-table.component.ts index 7772451d4..3d47c6087 100644 --- a/apps/client/src/app/components/access-table/access-table.component.ts +++ b/apps/client/src/app/components/access-table/access-table.component.ts @@ -3,6 +3,7 @@ import { NotificationService } from '@ghostfolio/client/core/notification/notifi import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; import { Access } from '@ghostfolio/common/interfaces'; +import { Clipboard } from '@angular/cdk/clipboard'; import { ChangeDetectionStrategy, Component, @@ -31,7 +32,10 @@ export class AccessTableComponent implements OnChanges, OnInit { public defaultLanguageCode = DEFAULT_LANGUAGE_CODE; public displayedColumns = []; - public constructor(private notificationService: NotificationService) {} + public constructor( + private clipboard: Clipboard, + private notificationService: NotificationService + ) {} public ngOnInit() {} @@ -47,6 +51,14 @@ export class AccessTableComponent implements OnChanges, OnInit { } } + public getPublicUrl(aId: string): string { + return `${this.baseUrl}/${this.defaultLanguageCode}/p/${aId}`; + } + + public onCopyToClipboard(aId: string): void { + this.clipboard.copy(this.getPublicUrl(aId)); + } + public onDeleteAccess(aId: string) { this.notificationService.confirm({ confirmFn: () => { diff --git a/apps/client/src/app/components/access-table/access-table.module.ts b/apps/client/src/app/components/access-table/access-table.module.ts index 2ace3cfc1..4cbc7b580 100644 --- a/apps/client/src/app/components/access-table/access-table.module.ts +++ b/apps/client/src/app/components/access-table/access-table.module.ts @@ -1,3 +1,4 @@ +import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; @@ -11,6 +12,7 @@ import { AccessTableComponent } from './access-table.component'; declarations: [AccessTableComponent], exports: [AccessTableComponent], imports: [ + ClipboardModule, CommonModule, MatButtonModule, MatMenuModule,