mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
mobile: fix sidemenu shortcuts
This commit is contained in:
@@ -56,6 +56,7 @@ const ColorPicker = ({
|
||||
<BaseDialog
|
||||
visible={visible}
|
||||
onRequestClose={() => {
|
||||
title.current = undefined;
|
||||
setVisible(false);
|
||||
useSettingStore.getState().setSheetKeyboardHandler(true);
|
||||
}}
|
||||
|
||||
@@ -84,8 +84,7 @@ export const PinnedSection = React.memo(
|
||||
data={menuPins}
|
||||
style={{
|
||||
flexGrow: 1,
|
||||
width: "100%",
|
||||
paddingHorizontal: 12
|
||||
width: "100%"
|
||||
}}
|
||||
contentContainerStyle={{
|
||||
flexGrow: 1
|
||||
|
||||
@@ -42,12 +42,17 @@ export const useMenuStore = create<MenuStore>((set) => ({
|
||||
});
|
||||
},
|
||||
setColorNotes: () => {
|
||||
db.colors?.all.items().then((colors) => {
|
||||
set({
|
||||
colorNotes: colors,
|
||||
loadingColors: false
|
||||
db.colors?.all
|
||||
.items(undefined, {
|
||||
sortBy: "dateCreated",
|
||||
sortDirection: "asc"
|
||||
})
|
||||
.then((colors) => {
|
||||
set({
|
||||
colorNotes: colors,
|
||||
loadingColors: false
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
clearAll: () => set({ menuPins: [], colorNotes: [] })
|
||||
}));
|
||||
|
||||
@@ -101,6 +101,7 @@ export class Shortcuts implements ICollection {
|
||||
): Promise<ResolveTypeToItem<T>> {
|
||||
const tagIds: string[] = [];
|
||||
const notebookIds: string[] = [];
|
||||
|
||||
for (const shortcut of this.all) {
|
||||
if (
|
||||
(type === "all" || type === "notebooks") &&
|
||||
@@ -113,12 +114,29 @@ export class Shortcuts implements ICollection {
|
||||
)
|
||||
tagIds.push(shortcut.itemId);
|
||||
}
|
||||
return [
|
||||
...(notebookIds.length > 0
|
||||
|
||||
const notebooks =
|
||||
notebookIds.length > 0
|
||||
? await this.db.notebooks.all.items(notebookIds)
|
||||
: []),
|
||||
...(tagIds.length > 0 ? await this.db.tags.all.items(tagIds) : [])
|
||||
] as ResolveTypeToItem<T>;
|
||||
: [];
|
||||
const tags = tagIds.length > 0 ? await this.db.tags.all.items(tagIds) : [];
|
||||
|
||||
const sortedItems: (Notebook | Tag)[] = [];
|
||||
|
||||
this.all
|
||||
.sort((a, b) => a.dateCreated - b.dateCreated)
|
||||
.forEach((shortcut) => {
|
||||
if (type === "all" || type === "notebooks") {
|
||||
const notebook = notebooks.find((n) => n.id === shortcut.itemId);
|
||||
if (notebook) sortedItems.push(notebook);
|
||||
}
|
||||
if (type === "all" || type === "tags") {
|
||||
const tag = tags.find((t) => t.id === shortcut.itemId);
|
||||
if (tag) sortedItems.push(tag);
|
||||
}
|
||||
});
|
||||
|
||||
return sortedItems as ResolveTypeToItem<T>;
|
||||
}
|
||||
|
||||
exists(id: string) {
|
||||
|
||||
Reference in New Issue
Block a user