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:
parent
230630fb99
commit
3a535db872
2 changed files with 4 additions and 3 deletions
|
@ -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} />)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue