diff --git a/src-ui/src/app/app.component.html b/src-ui/src/app/app.component.html index 7fbb8dc4a..f1cc630fb 100644 --- a/src-ui/src/app/app.component.html +++ b/src-ui/src/app/app.component.html @@ -3,10 +3,10 @@ -
+

Drop files to begin upload

-
+
diff --git a/src-ui/src/app/app.component.spec.ts b/src-ui/src/app/app.component.spec.ts index e7e41e135..458f9b582 100644 --- a/src-ui/src/app/app.component.spec.ts +++ b/src-ui/src/app/app.component.spec.ts @@ -149,19 +149,17 @@ describe('AppComponent', () => { }) it('should support drag drop', fakeAsync(() => { - expect(component.fileIsOver).toBeFalsy() + expect(settingsService.globalDropzoneActive).toBeFalsy() component.fileOver() tick(1) fixture.detectChanges() - expect(component.fileIsOver).toBeTruthy() + expect(settingsService.globalDropzoneActive).toBeTruthy() const dropzone = fixture.debugElement.query( By.css('.global-dropzone-overlay') ) expect(dropzone).not.toBeNull() - component.fileLeave() tick(700) fixture.detectChanges() - expect(dropzone.classes['hide']).toBeTruthy() // drop const toastSpy = jest.spyOn(toastService, 'show') const uploadSpy = jest.spyOn(uploadDocumentsService, 'onNgxFileDrop') @@ -173,6 +171,7 @@ describe('AppComponent', () => { }, } as unknown as NgxFileDropEntry, ]) + expect(settingsService.globalDropzoneActive).toBeFalsy() tick(3000) expect(toastSpy).toHaveBeenCalled() expect(uploadSpy).toHaveBeenCalled() diff --git a/src-ui/src/app/app.component.ts b/src-ui/src/app/app.component.ts index 015ad1115..3baaa63d2 100644 --- a/src-ui/src/app/app.component.ts +++ b/src-ui/src/app/app.component.ts @@ -25,10 +25,6 @@ export class AppComponent implements OnInit, OnDestroy { successSubscription: Subscription failedSubscription: Subscription - private fileLeaveTimeoutID: any - fileIsOver: boolean = false - hidden: boolean = true - constructor( private settings: SettingsService, private consumerStatusService: ConsumerStatusService, @@ -263,31 +259,14 @@ export class AppComponent implements OnInit, OnDestroy { public fileOver() { this.settings.globalDropzoneActive = true - // allows transition - setTimeout(() => { - this.fileIsOver = true - }, 1) - this.hidden = false - // stop fileLeave timeout - clearTimeout(this.fileLeaveTimeoutID) } - public fileLeave(immediate: boolean = false) { + public fileLeave() { this.settings.globalDropzoneActive = false - const ms = immediate ? 0 : 500 - - this.fileLeaveTimeoutID = setTimeout(() => { - this.fileIsOver = false - // await transition completed - setTimeout(() => { - this.hidden = true - }, 150) - }, ms) } public dropped(files: NgxFileDropEntry[]) { - this.settings.globalDropzoneActive = false - this.fileLeave(true) + this.fileLeave() this.uploadDocumentsService.onNgxFileDrop(files) if (files.length > 0) this.toastService.showInfo($localize`Initiating upload...`, 3000) diff --git a/src-ui/src/styles.scss b/src-ui/src/styles.scss index 4ded31ae4..f258b7858 100644 --- a/src-ui/src/styles.scss +++ b/src-ui/src/styles.scss @@ -505,27 +505,24 @@ table.table { user-select: none !important; text-align: center; padding-top: 25%; + opacity: 0; + transition: opacity 0.05s linear; h2 { color: var(--pngx-primary-text-contrast) } - - &.show { - opacity: 1 !important; - } - - &.hide { - display: none; - } } -.ngx-file-drop__drop-zone--over .global-dropzone-overlay { - opacity: 0; -} +.ngx-file-drop__drop-zone--over { + .global-dropzone-overlay { + opacity: 1; + pointer-events: all !important; + } -.inert { - pointer-events: none !important; - user-select: none !important; + .main-wrapper { + pointer-events: none !important; + user-select: none !important; + } } .alert-primary {