refactor: history modal (#1122)

This commit is contained in:
Aman Harwara
2022-06-20 17:50:00 +05:30
committed by GitHub
parent 71463a9821
commit affe7247ba
28 changed files with 771 additions and 637 deletions

View File

@@ -174,6 +174,7 @@ const NotesOptions = ({
navigationController,
notesController,
noteTagsController,
historyModalController,
closeOnBlur,
}: NotesOptionsProps) => {
const [altKeyDown, setAltKeyDown] = useState(false)
@@ -259,8 +260,8 @@ const NotesOptions = ({
}, [application, notes])
const openRevisionHistoryModal = useCallback(() => {
notesController.setShowRevisionHistoryModal(true)
}, [notesController])
historyModalController.openModal(notesController.firstSelectedNote)
}, [historyModalController, notesController.firstSelectedNote])
return (
<>

View File

@@ -10,12 +10,14 @@ import { FOCUSABLE_BUT_NOT_TABBABLE } from '@/Constants/Constants'
import { NotesController } from '@/Controllers/NotesController'
import { NavigationController } from '@/Controllers/Navigation/NavigationController'
import { NoteTagsController } from '@/Controllers/NoteTagsController'
import { HistoryModalController } from '@/Controllers/NoteHistory/HistoryModalController'
type Props = {
application: WebApplication
navigationController: NavigationController
notesController: NotesController
noteTagsController: NoteTagsController
historyModalController: HistoryModalController
onClickPreprocessing?: () => Promise<void>
}
@@ -24,6 +26,7 @@ const NotesOptionsPanel = ({
navigationController,
notesController,
noteTagsController,
historyModalController,
onClickPreprocessing,
}: Props) => {
const [open, setOpen] = useState(false)
@@ -95,6 +98,7 @@ const NotesOptionsPanel = ({
navigationController={navigationController}
notesController={notesController}
noteTagsController={noteTagsController}
historyModalController={historyModalController}
closeOnBlur={closeOnBlur}
/>
)}

View File

@@ -1,4 +1,5 @@
import { WebApplication } from '@/Application/Application'
import { HistoryModalController } from '@/Controllers/NoteHistory/HistoryModalController'
import { NavigationController } from '@/Controllers/Navigation/NavigationController'
import { NotesController } from '@/Controllers/NotesController'
import { NoteTagsController } from '@/Controllers/NoteTagsController'
@@ -8,5 +9,6 @@ export type NotesOptionsProps = {
navigationController: NavigationController
notesController: NotesController
noteTagsController: NoteTagsController
historyModalController: HistoryModalController
closeOnBlur: (event: { relatedTarget: EventTarget | null }) => void
}