Make JSX work

This commit is contained in:
Vendicated
2023-04-20 00:40:21 +02:00
parent ea7e06191c
commit aee53eccb5
4 changed files with 37 additions and 13 deletions

View File

@@ -1,6 +1,8 @@
import { GlobalContextMenuPatchCallback, addGlobalContextMenuPatch, removeGlobalContextMenuPatch } from "@vencord/types/api/ContextMenu";
import { definePluginSettings } from "@vencord/types/api/settings";
import definePlugin, { OptionType } from "@vencord/types/utils/types";
import { findStoreLazy } from "@vencord/types/webpack";
import { Menu } from "@vencord/types/webpack/common";
// This is already a webpack common so maybe don't search it again.
// just an example heh :3
@@ -14,7 +16,19 @@ const settings = definePluginSettings({
}
});
definePlugin({
const patchContextMenu: GlobalContextMenuPatchCallback = (navId, children) => () => {
children.unshift((
<Menu.MenuItem
id="example-context-menu-item"
label="read if cute"
action={() => {
alert(":3");
}}
/>
));
};
export default definePlugin({
name: "MyExamplePlugin",
description: "Very cute plugin",
authors: [
@@ -30,10 +44,15 @@ definePlugin({
start() {
console.log(this.name, "just started");
addGlobalContextMenuPatch(patchContextMenu);
console.log(UserStore.getCurrentUser().username, "is", settings.store.cuteSetting);
},
stop() {
console.log(this.name, "just stopped");
removeGlobalContextMenuPatch(patchContextMenu);
}
});