1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-11 02:16:23 +00:00

Fix notebook delete modal

This commit is contained in:
Wolfie 2024-03-15 12:06:03 -04:00
parent 230630fb99
commit 3a535db872
No known key found for this signature in database
GPG key ID: DE384EE9BF2D909A
2 changed files with 4 additions and 3 deletions

View file

@ -10,7 +10,7 @@ import { Button, React } from "@webpack/common";
import NotebookCreateModal from "./NotebookCreateModal"; import NotebookCreateModal from "./NotebookCreateModal";
import NotebookDeleteModal from "./NotebookDeleteModal"; import NotebookDeleteModal from "./NotebookDeleteModal";
export default ({ notebook }: { notebook: string, setNotebook: React.Dispatch<React.SetStateAction<string>>; }) => { export default ({ notebook, setNotebook }: { notebook: string, setNotebook: React.Dispatch<React.SetStateAction<string>>; }) => {
const isNotMain = notebook !== "Main"; const isNotMain = notebook !== "Main";
return ( return (
@ -18,7 +18,7 @@ export default ({ notebook }: { notebook: string, setNotebook: React.Dispatch<Re
color={isNotMain ? Button.Colors.RED : Button.Colors.GREEN} color={isNotMain ? Button.Colors.RED : Button.Colors.GREEN}
onClick={ onClick={
isNotMain isNotMain
? () => openModal(props => <NotebookDeleteModal {...props} notebook={notebook} />) ? () => openModal(props => <NotebookDeleteModal {...props} notebook={notebook} onChangeTab={setNotebook} />)
: () => openModal(props => <NotebookCreateModal {...props} />) : () => openModal(props => <NotebookCreateModal {...props} />)
} }
> >

View file

@ -12,11 +12,12 @@ import noteHandler from "plugins/holynotes/noteHandler";
import Error from "./Error"; import Error from "./Error";
import { RenderMessage } from "./RenderMessage"; import { RenderMessage } from "./RenderMessage";
export default ({ onClose, notebook, ...props }: ModalProps & { onClose: () => void; notebook: string; }) => { export default ({ onClose, notebook, onChangeTab, ...props }: ModalProps & { onClose: () => void; notebook: string; onChangeTab: React.Dispatch<React.SetStateAction<string>>; }) => {
const notes = noteHandler.getNotes(notebook); const notes = noteHandler.getNotes(notebook);
const handleDelete = () => { const handleDelete = () => {
onClose(); onClose();
onChangeTab("Main");
noteHandler.deleteNotebook(notebook); noteHandler.deleteNotebook(notebook);
}; };