1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-26 17:26:22 +00:00

Not sure why NoteModal needs await

This commit is contained in:
Wolfie 2024-03-08 18:44:25 -04:00
parent fba84bd081
commit 72a8178501
No known key found for this signature in database
GPG key ID: DE384EE9BF2D909A
2 changed files with 52 additions and 48 deletions

View file

@ -4,16 +4,17 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, openModal } from "@utils/modal";
import { React, TabBar, Text, TextInput } from "@webpack/common";
import noteHandler from "plugins/holynotes/noteHandler";
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 [searchInput, setSearch] = React.useState("");
const [sortDirection, setSortDirection] = React.useState(true);
@ -25,6 +26,7 @@ export const NoteModal = async (props) => {
if (!notes) return <></>;
return (
<ErrorBoundary>
<ModalRoot {...props} className="notebook" size="large" style={{ borderRadius: "8px" }}>
<Flex className="notebook-flex" style={{ width: "100%" }}>
<div className="notebook-topSection">
@ -54,7 +56,7 @@ export const NoteModal = async (props) => {
className="notebook-tabbar-Bar notebook-tabbar"
selectedItem={currentNotebook}
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">
{notebook}
</TabBar.Item>
@ -72,5 +74,6 @@ export const NoteModal = async (props) => {
</ModalFooter>
</ModalRoot>
</ErrorBoundary>
);
};

View file

@ -46,8 +46,9 @@ export default new (class NoteHandler {
}
public async getAllNotes(): Promise<HolyNotes.Note[]> {
// Needs fucking fixing for fuck sakes VEN GIVE ME IMAGE PERMS
return { ...await DataStore.values(HolyNoteStore) } ;
const data = await DataStore.values(HolyNoteStore);
const mainData = data[0];
return mainData;
}
public addNote = async (message: Message, notebook: string) => {