From a91870acede7d36edd8e367fb3230ff0401e01db Mon Sep 17 00:00:00 2001
From: Shaunak Das <51281688+shaun-ak@users.noreply.github.com>
Date: Sat, 14 Sep 2024 18:10:18 +0530
Subject: [PATCH] add copy to clipboard action
---
.../access-table/access-table.component.html | 5 +++++
.../components/access-table/access-table.component.ts | 10 +++++++++-
.../app/components/access-table/access-table.module.ts | 2 ++
3 files changed, 16 insertions(+), 1 deletion(-)
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..eb39388ef 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
@@ -58,6 +58,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..079884309 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,10 @@ export class AccessTableComponent implements OnChanges, OnInit {
}
}
+ public copyToClipBoard(aId: string): void {
+ this.clipboard.copy(`${this.baseUrl}/${this.defaultLanguageCode}/p/${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,