feat: add copy URL functionality to downloads with user feedback

Entire-Checkpoint: 55bde394786b
This commit is contained in:
4gray committed 2026-04-04 20:19:14 +02:00
1 parent 91cd650c1a
commit c62e8859ea
2 files changed
+29

No files matched your search

@@ -167,6 +167,18 @@
</div>
<div class="downloads__item-actions">
<button
mat-icon-button
(click)="
$event.stopPropagation();
copyUrl(item)
"
[matTooltip]="
'DOWNLOADS.COPY_URL' | translate
"
>
<mat-icon>content_copy</mat-icon>
</button>
@switch (item.status) {
@case ('queued') {
<button
@@ -201,6 +201,23 @@ export class DownloadsComponent {
}
}
async copyUrl(item: DownloadItem): Promise<void> {
try {
await navigator.clipboard.writeText(item.url);
this.snackBar.open(
this.translate.instant('DOWNLOADS.URL_COPIED'),
undefined,
{ duration: 2000, horizontalPosition: 'start' }
);
} catch {
this.snackBar.open(
this.translate.instant('DOWNLOADS.URL_COPY_FAILED'),
undefined,
{ duration: 3000, horizontalPosition: 'start' }
);
}
}
async cancel(item: DownloadItem) {
await this.downloadsService.cancelDownload(item.id);
}