Sort sections chronologically
This commit is contained in:
parent
88dde1a748
commit
0e33875b3f
@ -38,14 +38,12 @@ export function AllImagesView(vm, params, key, { appbar }) {
|
|||||||
const date = i.originalDate.substr(0, 10);
|
const date = i.originalDate.substr(0, 10);
|
||||||
return Object.assign(acc, { [date]: (acc[date] || []).concat(i) });
|
return Object.assign(acc, { [date]: (acc[date] || []).concat(i) });
|
||||||
}, {});
|
}, {});
|
||||||
const res = Object.entries(sectionMap).reduce(
|
return Object.entries(sectionMap)
|
||||||
(acc, [date, sectionImages]) =>
|
.sort((a, b) => a[0].localeCompare(b[0]))
|
||||||
Object.assign(acc, {
|
.map(([date, _images]) => ({
|
||||||
[format(date, 'MMMM D, YYYY')]: sectionImages
|
title: format(date, 'MMMM D, YYYY'),
|
||||||
}),
|
images: _images
|
||||||
{}
|
}));
|
||||||
);
|
|
||||||
return res;
|
|
||||||
},
|
},
|
||||||
[images]
|
[images]
|
||||||
);
|
);
|
||||||
@ -163,7 +161,7 @@ export function AllImagesView(vm, params, key, { appbar }) {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
function renderSection([title, _images]) {
|
function renderSection({ title, images: _images }) {
|
||||||
return AlbumTemplate({
|
return AlbumTemplate({
|
||||||
title,
|
title,
|
||||||
id: title,
|
id: title,
|
||||||
@ -185,7 +183,7 @@ export function AllImagesView(vm, params, key, { appbar }) {
|
|||||||
'.photoOverlay': photoClick
|
'.photoOverlay': photoClick
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Object.entries(sections()).map(renderSection)
|
sections().map(renderSection)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user