Finished upload logic
This commit is contained in:
@ -98,9 +98,12 @@
|
||||
<p class="text-sm text-gray-500 mt-1">Your file is now securely stored on our servers.</p>
|
||||
|
||||
<div class="mt-4 flex flex-col w-full items-center">
|
||||
<button class="btn btn-success w-full max-w-xs text-white">Copy URL</button>
|
||||
<button class="btn btn-primary mt-2 w-full max-w-xs">Upload Another File</button>
|
||||
<button class="btn btn-outline btn-secondary mt-2 w-full max-w-xs">Delete this file</button>
|
||||
<button class="btn btn-success w-full max-w-xs text-white" (click)="copyUrlToClipboard(this.fileUrls?.downloadUrl)">
|
||||
<div *ngIf="!urlCopied">Copy Download URL</div>
|
||||
<div *ngIf="urlCopied"><img width="20" src="./assets/check-solid.svg" alt="kk"></div>
|
||||
</button>
|
||||
<button class="btn btn-primary mt-2 w-full max-w-xs" routerLink="/home">Home</button>
|
||||
<button class="btn btn-outline btn-secondary mt-2 w-full max-w-xs" disabled>Delete this file</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -109,5 +112,6 @@
|
||||
<!-- Invisible SVGs to prevent lazy loading -->
|
||||
<div class="invisible h-0 w-0">
|
||||
<img src="./assets/file-solid.svg">
|
||||
<img src="./assets/check-solid.svg">
|
||||
<img src="./assets/circle-check-solid.svg">
|
||||
</div>
|
||||
|
@ -4,6 +4,7 @@ import {FormatFileSizePipePipe} from "../format-file-size-pipe.pipe";
|
||||
import {FormsModule} from "@angular/forms";
|
||||
import axios, {AxiosProgressEvent} from "axios";
|
||||
import { DevelopmentStore } from '../../store/DevelopmentStore';
|
||||
import {RouterLink} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'app-upload',
|
||||
@ -13,7 +14,8 @@ import { DevelopmentStore } from '../../store/DevelopmentStore';
|
||||
FormatFileSizePipePipe,
|
||||
FormsModule,
|
||||
DecimalPipe,
|
||||
NgClass
|
||||
NgClass,
|
||||
RouterLink
|
||||
],
|
||||
templateUrl: './upload.component.html',
|
||||
styleUrl: './upload.component.scss'
|
||||
@ -36,6 +38,7 @@ export class UploadComponent {
|
||||
|
||||
uploadData: FileDetails | null = null;
|
||||
fileUrls: { downloadUrl: string, statusUrl: string, deleteUrl: string } | null = null;
|
||||
urlCopied: boolean = false;
|
||||
|
||||
|
||||
constructor(private developmentStore: DevelopmentStore) {
|
||||
@ -184,6 +187,17 @@ export class UploadComponent {
|
||||
this.uploadProgress = this.targetUploadProgress;
|
||||
}
|
||||
}
|
||||
|
||||
copyUrlToClipboard(url: string | undefined) {
|
||||
if(url) {
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
this.urlCopied = true;
|
||||
console.log('Text successfully copied to clipboard');
|
||||
}).catch(err => {
|
||||
console.error('Failed to copy text to clipboard', err);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
interface FileDetails {
|
||||
fileId: string;
|
||||
|
Reference in New Issue
Block a user