From 5dc77a0159029fe25677312f1703cddbd94ae3e9 Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Thu, 18 Jan 2018 13:35:10 -0600 Subject: [PATCH] Fix deleting all images can leave the appbar shadow around --- packages/gallery/src/interface/allImages.js | 40 ++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/gallery/src/interface/allImages.js b/packages/gallery/src/interface/allImages.js index b9c5220..d52efac 100644 --- a/packages/gallery/src/interface/allImages.js +++ b/packages/gallery/src/interface/allImages.js @@ -39,14 +39,31 @@ export function AllImagesView(vm, params) { const selectedIds = container(new Set(), hashSet); const selectMode = computed(sIds => sIds.size > 0, [selectedIds]); + const sections = computed( + imageArr => { + const sectionMap = imageArr.reduce((acc, i) => { + const date = i.originalDate.substr(0, 10); + return Object.assign(acc, { [date]: (acc[date] || []).concat(i) }); + }, {}); + return Object.entries(sectionMap) + .sort((a, b) => a[0].localeCompare(b[0])) + .map(([date, _images]) => ({ + title: format(date, 'MMMM D, YYYY'), + sectionId: date, + images: _images + })); + }, + [images] + ); + const appBarTitle = computed(s => (s.size > 0 ? `${s.size} selected` : 'Photos'), [selectedIds]); const appBarStyle = computed( - t => ({ + (t, s) => ({ width: 'inherit', marginRight: '40px', - boxShadow: t === 0 ? 'none' : `0px 3px 3px rgba(0, 0, 0, .2)` + boxShadow: t === 0 || s.length === 0 ? 'none' : `0px 3px 3px rgba(0, 0, 0, .2)` }), - [containerScrollTop] + [containerScrollTop, sections] ); const appBarUp = computed(s => (s ? { name: 'x', action: deSelect } : undefined), [selectMode]); const appBarActions = computed( @@ -95,23 +112,6 @@ export function AllImagesView(vm, params) { [selectMode] ); - const sections = computed( - imageArr => { - const sectionMap = imageArr.reduce((acc, i) => { - const date = i.originalDate.substr(0, 10); - return Object.assign(acc, { [date]: (acc[date] || []).concat(i) }); - }, {}); - return Object.entries(sectionMap) - .sort((a, b) => a[0].localeCompare(b[0])) - .map(([date, _images]) => ({ - title: format(date, 'MMMM D, YYYY'), - sectionId: date, - images: _images - })); - }, - [images] - ); - function deSelect() { selectedIds.clear(); }