refactor: pass sub controllers to controllers instead of passing global controller manager (#1061)

This commit is contained in:
Mo
2022-06-01 12:56:30 -05:00
committed by GitHub
parent 721cf8df35
commit a87e3b98e2
40 changed files with 672 additions and 591 deletions

View File

@@ -23,10 +23,10 @@ const ContentList: FunctionComponent<Props> = ({
selectedItems,
paginate,
}) => {
const { selectPreviousItem, selectNextItem } = viewControllerManager.contentListController
const { selectPreviousItem, selectNextItem } = viewControllerManager.itemListController
const { hideTags, hideDate, hideNotePreview, hideEditorIcon } =
viewControllerManager.contentListController.webDisplayOptions
const { sortBy } = viewControllerManager.contentListController.displayOptions
viewControllerManager.itemListController.webDisplayOptions
const { sortBy } = viewControllerManager.itemListController.displayOptions
const onScroll: UIEventHandler = useCallback(
(e) => {

View File

@@ -15,7 +15,7 @@ const ContentListItem: FunctionComponent<AbstractListItemProps> = (props) => {
return []
}
const tags = props.viewControllerManager.getItemTags(props.item)
const tags = props.application.getItemTags(props.item)
const isNavigatingOnlyTag = selectedTag instanceof SNTag && tags.length === 1
if (isNavigatingOnlyTag) {

View File

@@ -46,7 +46,7 @@ const ContentListView: FunctionComponent<Props> = ({ application, viewController
paginate,
panelWidth,
createNewNote,
} = viewControllerManager.contentListController
} = viewControllerManager.itemListController
const { selectedItems } = viewControllerManager.selectionController
@@ -143,7 +143,7 @@ const ContentListView: FunctionComponent<Props> = ({ application, viewController
(width, _lastLeft, _isMaxWidth, isCollapsed) => {
application.setPreference(PrefKey.NotesPanelWidth, width).catch(console.error)
viewControllerManager.noteTagsController.reloadTagsContainerMaxWidth()
viewControllerManager.panelDidResize(PANEL_NAME_NOTES, isCollapsed)
application.publishPanelDidResizeEvent(PANEL_NAME_NOTES, isCollapsed)
},
[viewControllerManager, application],
)