mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-27 09:46:28 +00:00
Not sure why NoteModal needs await
This commit is contained in:
parent
fba84bd081
commit
72a8178501
2 changed files with 52 additions and 48 deletions
|
@ -4,16 +4,17 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Flex } from "@components/Flex";
|
import { Flex } from "@components/Flex";
|
||||||
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, openModal } from "@utils/modal";
|
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, openModal } from "@utils/modal";
|
||||||
import { React, TabBar, Text, TextInput } from "@webpack/common";
|
import { React, TabBar, Text, TextInput } from "@webpack/common";
|
||||||
import noteHandler from "plugins/holynotes/noteHandler";
|
import noteHandler from "plugins/holynotes/noteHandler";
|
||||||
|
|
||||||
import HelpIcon from "../icons/HelpIcon";
|
import HelpIcon from "../icons/HelpIcon";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const NoteModal = async (props) => {
|
export const NoteModal = (props) => {
|
||||||
const [sortType, setSortType] = React.useState(true);
|
const [sortType, setSortType] = React.useState(true);
|
||||||
const [searchInput, setSearch] = React.useState("");
|
const [searchInput, setSearch] = React.useState("");
|
||||||
const [sortDirection, setSortDirection] = React.useState(true);
|
const [sortDirection, setSortDirection] = React.useState(true);
|
||||||
|
@ -25,6 +26,7 @@ export const NoteModal = async (props) => {
|
||||||
if (!notes) return <></>;
|
if (!notes) return <></>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<ErrorBoundary>
|
||||||
<ModalRoot {...props} className="notebook" size="large" style={{ borderRadius: "8px" }}>
|
<ModalRoot {...props} className="notebook" size="large" style={{ borderRadius: "8px" }}>
|
||||||
<Flex className="notebook-flex" style={{ width: "100%" }}>
|
<Flex className="notebook-flex" style={{ width: "100%" }}>
|
||||||
<div className="notebook-topSection">
|
<div className="notebook-topSection">
|
||||||
|
@ -54,7 +56,7 @@ export const NoteModal = async (props) => {
|
||||||
className="notebook-tabbar-Bar notebook-tabbar"
|
className="notebook-tabbar-Bar notebook-tabbar"
|
||||||
selectedItem={currentNotebook}
|
selectedItem={currentNotebook}
|
||||||
onItemSelect={setCurrentNotebook}>
|
onItemSelect={setCurrentNotebook}>
|
||||||
{Object.keys(await noteHandler.getAllNotes()).map(notebook => (
|
{Object.keys(noteHandler.getAllNotes()).map(notebook => (
|
||||||
<TabBar.Item key={notebook} id={notebook} className="notebook-tabbar-barItem notebook-tabbar-item">
|
<TabBar.Item key={notebook} id={notebook} className="notebook-tabbar-barItem notebook-tabbar-item">
|
||||||
{notebook}
|
{notebook}
|
||||||
</TabBar.Item>
|
</TabBar.Item>
|
||||||
|
@ -62,9 +64,9 @@ export const NoteModal = async (props) => {
|
||||||
</TabBar>
|
</TabBar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ModalContent style={{ marginTop:"20px" }}>
|
<ModalContent style={{ marginTop: "20px" }}>
|
||||||
<ErrorBoundary>
|
<ErrorBoundary>
|
||||||
{}
|
{ }
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -72,5 +74,6 @@ export const NoteModal = async (props) => {
|
||||||
|
|
||||||
</ModalFooter>
|
</ModalFooter>
|
||||||
</ModalRoot>
|
</ModalRoot>
|
||||||
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,8 +46,9 @@ export default new (class NoteHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getAllNotes(): Promise<HolyNotes.Note[]> {
|
public async getAllNotes(): Promise<HolyNotes.Note[]> {
|
||||||
// Needs fucking fixing for fuck sakes VEN GIVE ME IMAGE PERMS
|
const data = await DataStore.values(HolyNoteStore);
|
||||||
return { ...await DataStore.values(HolyNoteStore) } ;
|
const mainData = data[0];
|
||||||
|
return mainData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public addNote = async (message: Message, notebook: string) => {
|
public addNote = async (message: Message, notebook: string) => {
|
||||||
|
|
Loading…
Reference in a new issue