feat: persist selected tag & note locally (#1851)

This commit is contained in:
Aman Harwara
2022-10-20 18:56:59 +05:30
committed by GitHub
parent 6c47f95748
commit 4432f1cb4c
20 changed files with 421 additions and 116 deletions

View File

@@ -1,6 +1,5 @@
import { WebApplication } from '@/Application/Application'
import { KeyboardKey } from '@standardnotes/ui-services'
import { UuidString } from '@standardnotes/snjs'
import { observer } from 'mobx-react-lite'
import { FunctionComponent, KeyboardEventHandler, UIEventHandler, useCallback } from 'react'
import { FOCUSABLE_BUT_NOT_TABBABLE, NOTES_LIST_SCROLL_THRESHOLD } from '@/Constants/Constants'
@@ -22,7 +21,7 @@ type Props = {
navigationController: NavigationController
notesController: NotesController
selectionController: SelectedItemsController
selectedItems: Record<UuidString, ListableContentItem>
selectedUuids: SelectedItemsController['selectedUuids']
paginate: () => void
}
@@ -34,7 +33,7 @@ const ContentList: FunctionComponent<Props> = ({
navigationController,
notesController,
selectionController,
selectedItems,
selectedUuids,
paginate,
}) => {
const { selectPreviousItem, selectNextItem } = selectionController
@@ -82,7 +81,7 @@ const ContentList: FunctionComponent<Props> = ({
key={item.uuid}
application={application}
item={item}
selected={!!selectedItems[item.uuid]}
selected={selectedUuids.has(item.uuid)}
hideDate={hideDate}
hidePreview={hideNotePreview}
hideTags={hideTags}

View File

@@ -109,7 +109,7 @@ const ContentListView: FunctionComponent<Props> = ({
searchBarElement,
} = itemListController
const { selectedItems, selectNextItem, selectPreviousItem } = selectionController
const { selectedUuids, selectNextItem, selectPreviousItem } = selectionController
const isFilesSmartView = useMemo(
() => navigationController.selected?.uuid === SystemViewId.Files,
@@ -276,7 +276,7 @@ const ContentListView: FunctionComponent<Props> = ({
{renderedItems.length ? (
<ContentList
items={renderedItems}
selectedItems={selectedItems}
selectedUuids={selectedUuids}
application={application}
paginate={paginate}
filesController={filesController}