fix: do not allow sort by title when groupBy === default

This commit is contained in:
thecodrr
2021-07-13 20:00:10 +05:00
parent 6300542c5f
commit 36353a4b0c

View File

@@ -28,12 +28,14 @@ const KEY_SELECTORS = {
month: (item, groupBy) => months[new Date(item[groupBy]).getMonth()], month: (item, groupBy) => months[new Date(item[groupBy]).getMonth()],
week: (item, groupBy) => getWeekGroupFromTimestamp(item[groupBy]), week: (item, groupBy) => getWeekGroupFromTimestamp(item[groupBy]),
year: (item, groupBy) => new Date(item[groupBy]).getFullYear().toString(), year: (item, groupBy) => new Date(item[groupBy]).getFullYear().toString(),
default: (item, groupBy) => default: (item, groupBy) => {
item[groupBy] >= TIMESTAMPS.recent() if (groupBy === "title") groupBy = "dateEdited";
return item[groupBy] >= TIMESTAMPS.recent()
? "Recent" ? "Recent"
: item[groupBy] >= TIMESTAMPS.lastWeek() : item[groupBy] >= TIMESTAMPS.lastWeek()
? "Last week" ? "Last week"
: "Older", : "Older";
},
}; };
/** /**