feat(UploadSummary): sort by status and date

This commit is contained in:
Aminejv 2021-09-22 14:01:07 +01:00
parent 35e9887257
commit efdf7938b0

View File

@ -285,7 +285,16 @@ function Summary({ onAction }) {
const uploadSummary = React.useMemo(() => {
const uploadSummary = Object.entries(fileLoading).map(([, file]) => file);
return uploadSummary.sort((a, b) => b.createdAt - a.createdAt);
const statusOrder = {
failed: 1,
saving: 2,
duplicate: 3,
success: 4,
};
return uploadSummary.sort(
(a, b) => statusOrder[a.status] - statusOrder[b.status] || a.createdAt - b.createdAt
);
}, [fileLoading]);
return (