Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: allow sorting by title everywhere

Abdullah Atta6b14b291032a
diff --git a/apps/web/src/components/group-header/index.tsx b/apps/web/src/components/group-header/index.tsx
index 87c77265f..2ba667ec4 100644
--- a/apps/web/src/components/group-header/index.tsx
+++ b/apps/web/src/components/group-header/index.tsx
@@ -59,7 +59,6 @@ type GroupingMenuOptions = {
parentKey: keyof GroupOptions;
groupingKey: GroupingKey;
refresh: () => void;
- isUngrouped: boolean;
};
const groupByMenu: (options: GroupingMenuOptions) => MenuItem | null = (
@@ -130,8 +129,7 @@ const sortByMenu: (options: GroupingMenuOptions) => MenuItem = (options) => ({
{
key: "dateCreated",
title: "Date created",
- isHidden:
- options.groupingKey === "trash" || options.groupingKey === "tags"
+ isHidden: options.groupingKey === "trash"
},
{
key: "dateEdited",
@@ -156,12 +154,7 @@ const sortByMenu: (options: GroupingMenuOptions) => MenuItem = (options) => ({
},
{
key: "title",
- title: "Title",
- isHidden:
- !options.isUngrouped &&
- options.parentKey === "sortBy" &&
- options.groupOptions.groupBy !== "abc" &&
- options.groupOptions.groupBy !== "none"
+ title: "Title"
}
])
}
@@ -174,7 +167,6 @@ export function showSortMenu(groupingKey: GroupingKey, refresh: () => void) {
const menuOptions: Omit<GroupingMenuOptions, "parentKey"> = {
groupingKey,
groupOptions,
- isUngrouped: true,
refresh
};
@@ -199,11 +191,10 @@ async function changeGroupOptions(
(groupOptions as any)[options.parentKey] = item.key;
if (options.parentKey === "groupBy") {
- if (item.key === "abc") groupOptions.sortBy = "title";
- else
+ groupOptions.sortBy =
options.groupingKey === "tags" || options.groupingKey === "trash"
? "dateModified"
- : "dateEdited";
+ : groupOptions.sortBy;
}
await db.settings.setGroupOptions(options.groupingKey, groupOptions);
options.refresh();
@@ -366,7 +357,6 @@ function GroupHeader(props: GroupHeaderProps) {
const menuOptions: Omit<GroupingMenuOptions, "parentKey"> = {
groupingKey,
groupOptions,
- isUngrouped: false,
refresh
};
const groupBy = groupByMenu({