diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html index 990035274..6a50e9448 100644 --- a/src/app/components/favorites/favorites.component.html +++ b/src/app/components/favorites/favorites.component.html @@ -8,9 +8,9 @@ @@ -25,10 +25,10 @@ @@ -81,8 +81,8 @@ diff --git a/src/app/components/files/files.component.html b/src/app/components/files/files.component.html index ba77cd66d..e4a41e09b 100644 --- a/src/app/components/files/files.component.html +++ b/src/app/components/files/files.component.html @@ -10,9 +10,9 @@ @@ -27,10 +27,10 @@ @@ -85,8 +85,8 @@ diff --git a/src/app/components/page.component.spec.ts b/src/app/components/page.component.spec.ts index fc38e6fce..f46fe3966 100644 --- a/src/app/components/page.component.spec.ts +++ b/src/app/components/page.component.spec.ts @@ -74,31 +74,31 @@ describe('PageComponent', () => { }); }); - describe('firstSelectedDocument', () => { + describe('selectedFile', () => { it('returns true if selected node is file', () => { const selection = [ { entry: { isFile: true } } ]; component.setSelection(selection); - expect(component.firstSelectedDocument).toBe(selection[0]); + expect(component.selectedFile).toBe(selection[0]); }); it('returns false if selected node is folder', () => { const selection = [ { entry: { isFile: false, isFolder: true } } ]; component.setSelection(selection); - expect(component.firstSelectedDocument).toBeFalsy(); + expect(component.selectedFile).toBeFalsy(); }); }); - describe('firstSelectedFolder', () => { + describe('selectedFolder', () => { it('returns true if selected node is folder', () => { const selection = [ { entry: { isFile: false, isFolder: true } } ]; component.setSelection(selection); - expect(component.firstSelectedFolder).toBe(selection[0]); + expect(component.selectedFolder).toBe(selection[0]); }); it('returns false if selected node is file', () => { const selection = [ { entry: { isFile: true, isFolder: false } } ]; component.setSelection(selection); - expect(component.firstSelectedFolder).toBeFalsy(); + expect(component.selectedFolder).toBeFalsy(); }); }); }); diff --git a/src/app/components/page.component.ts b/src/app/components/page.component.ts index b2dfce3d2..296c4a478 100644 --- a/src/app/components/page.component.ts +++ b/src/app/components/page.component.ts @@ -46,10 +46,10 @@ export abstract class PageComponent implements OnInit, OnDestroy { infoDrawerOpened = false; node: MinimalNodeEntryEntity; + selectedFolder: MinimalNodeEntity; + selectedFile: MinimalNodeEntity; + hasSelection = false; - firstSelectedDocument: MinimalNodeEntity; - firstSelectedFolder: MinimalNodeEntity; - firstSelectedNode: MinimalNodeEntity; lastSelectedNode: MinimalNodeEntity; selectedNodes: MinimalNodeEntity[]; @@ -86,16 +86,15 @@ export abstract class PageComponent implements OnInit, OnDestroy { protected onSelectionChanged(selection: MinimalNodeEntity[] = []) { this.selectedNodes = selection; this.hasSelection = selection.length > 0; + this.selectedFolder = null; + this.selectedFile = null; if (selection.length > 0) { - const firstNode = selection[0]; - this.firstSelectedNode = firstNode; - this.firstSelectedDocument = selection.find(entity => entity.entry.isFile); - this.firstSelectedFolder = selection.find(entity => entity.entry.isFolder); + if (selection.length === 1) { + this.selectedFile = selection.find(entity => entity.entry.isFile); + this.selectedFolder = selection.find(entity => entity.entry.isFolder); + } } else { - this.firstSelectedNode = null; - this.firstSelectedDocument = null; - this.firstSelectedFolder = null; this.lastSelectedNode = null; this.infoDrawerOpened = false; } diff --git a/src/app/components/recent-files/recent-files.component.html b/src/app/components/recent-files/recent-files.component.html index c964cc175..a868fd498 100644 --- a/src/app/components/recent-files/recent-files.component.html +++ b/src/app/components/recent-files/recent-files.component.html @@ -8,9 +8,9 @@ @@ -73,8 +73,8 @@