mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-25 16:56:23 +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
|
||||
*/
|
||||
|
||||
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,52 +26,54 @@ export const NoteModal = async (props) => {
|
|||
if (!notes) return <></>;
|
||||
|
||||
return (
|
||||
<ModalRoot {...props} className="notebook" size="large" style={{ borderRadius: "8px" }}>
|
||||
<Flex className="notebook-flex" style={{ width: "100%" }}>
|
||||
<div className="notebook-topSection">
|
||||
<ModalHeader className="notebook-header-main">
|
||||
<Text
|
||||
variant="heading-lg/semibold"
|
||||
style={{ flexGrow: 1 }}
|
||||
className="notebook-heading">
|
||||
NOTEBOOK
|
||||
</Text>
|
||||
<div className="notebook-flex help-icon" onClick={() => openModal()}>
|
||||
<HelpIcon />
|
||||
<ErrorBoundary>
|
||||
<ModalRoot {...props} className="notebook" size="large" style={{ borderRadius: "8px" }}>
|
||||
<Flex className="notebook-flex" style={{ width: "100%" }}>
|
||||
<div className="notebook-topSection">
|
||||
<ModalHeader className="notebook-header-main">
|
||||
<Text
|
||||
variant="heading-lg/semibold"
|
||||
style={{ flexGrow: 1 }}
|
||||
className="notebook-heading">
|
||||
NOTEBOOK
|
||||
</Text>
|
||||
<div className="notebook-flex help-icon" onClick={() => openModal()}>
|
||||
<HelpIcon />
|
||||
</div>
|
||||
<div style={{ marginBottom: "10px" }} className="notebook-search">
|
||||
<TextInput
|
||||
autoFocus={false}
|
||||
placeholder="Search for a message..."
|
||||
onChange={(e) => setSearch(e)}
|
||||
/>
|
||||
</div>
|
||||
<ModalCloseButton onClick={props.onClose} />
|
||||
</ModalHeader>
|
||||
<div className="notebook-tabbar-Container">
|
||||
<TabBar
|
||||
type="top"
|
||||
look="brand"
|
||||
className="notebook-tabbar-Bar notebook-tabbar"
|
||||
selectedItem={currentNotebook}
|
||||
onItemSelect={setCurrentNotebook}>
|
||||
{Object.keys(noteHandler.getAllNotes()).map(notebook => (
|
||||
<TabBar.Item key={notebook} id={notebook} className="notebook-tabbar-barItem notebook-tabbar-item">
|
||||
{notebook}
|
||||
</TabBar.Item>
|
||||
))}
|
||||
</TabBar>
|
||||
</div>
|
||||
<div style={{ marginBottom: "10px" }} className="notebook-search">
|
||||
<TextInput
|
||||
autoFocus={false}
|
||||
placeholder="Search for a message..."
|
||||
onChange={(e) => setSearch(e)}
|
||||
/>
|
||||
</div>
|
||||
<ModalCloseButton onClick={props.onClose} />
|
||||
</ModalHeader>
|
||||
<div className="notebook-tabbar-Container">
|
||||
<TabBar
|
||||
type="top"
|
||||
look="brand"
|
||||
className="notebook-tabbar-Bar notebook-tabbar"
|
||||
selectedItem={currentNotebook}
|
||||
onItemSelect={setCurrentNotebook}>
|
||||
{Object.keys(await noteHandler.getAllNotes()).map(notebook => (
|
||||
<TabBar.Item key={notebook} id={notebook} className="notebook-tabbar-barItem notebook-tabbar-item">
|
||||
{notebook}
|
||||
</TabBar.Item>
|
||||
))}
|
||||
</TabBar>
|
||||
</div>
|
||||
</div>
|
||||
<ModalContent style={{ marginTop:"20px" }}>
|
||||
<ErrorBoundary>
|
||||
{}
|
||||
</ErrorBoundary>
|
||||
</ModalContent>
|
||||
</Flex>
|
||||
<ModalFooter>
|
||||
<ModalContent style={{ marginTop: "20px" }}>
|
||||
<ErrorBoundary>
|
||||
{ }
|
||||
</ErrorBoundary>
|
||||
</ModalContent>
|
||||
</Flex>
|
||||
<ModalFooter>
|
||||
|
||||
</ModalFooter>
|
||||
</ModalRoot>
|
||||
</ModalFooter>
|
||||
</ModalRoot>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue