1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 09:56:24 +00:00

minor tweaks

This commit is contained in:
programminglaboratorys 2024-09-28 01:03:40 +03:00
parent 5be2fb5b9b
commit adc0d2f0d7

View file

@ -22,7 +22,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType, StartAt } from "@utils/types"; import definePlugin, { OptionType, StartAt } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
import { Button, Clickable, Icons, Menu, Text, Toasts, useState } from "@webpack/common"; import { Button, Clickable, Icons, Menu, Toasts, useState } from "@webpack/common";
// const { PMenu } = mapMangledModuleLazy("{id:t,label:n,icon:c,hint:_,renderSubmenu:E,...h}", { // const { PMenu } = mapMangledModuleLazy("{id:t,label:n,icon:c,hint:_,renderSubmenu:E,...h}", {
// PMenu: filters.byCode("{id:t,label:n,icon:c,hint:_,renderSubmenu:E,...h}") // PMenu: filters.byCode("{id:t,label:n,icon:c,hint:_,renderSubmenu:E,...h}")
@ -36,8 +36,9 @@ const PSubMenu = findComponentByCodeLazy("submenuPaddingContainer,children:(0,i.
const Components = findByPropsLazy("Status"); const Components = findByPropsLazy("Status");
const StatusStyles = findByPropsLazy("statusItem"); const StatusStyles = findByPropsLazy("statusItem");
const statusSettings = getUserSettingLazy("status", "status"); const statusSettings = getUserSettingLazy("status", "status");
const customStatusSettings = getUserSettingLazy("status", "status"); const customStatusSettings = getUserSettingLazy("status", "customStatus");
interface Emoji { interface Emoji {
@ -56,10 +57,8 @@ interface DiscordStatus {
const settings = definePluginSettings({ const settings = definePluginSettings({
StatusPresets: { StatusPresets: {
type: OptionType.COMPONENT, type: OptionType.COMPONENT,
description: "yaps", description: "Status Presets",
component: () => { component: () => <></>,
return (<Text>yo</Text>);
},
default: {} default: {}
} }
}); });
@ -124,7 +123,7 @@ export default definePlugin({
description: "do now and think later", description: "do now and think later",
authors: [Devs.Dolfies], authors: [Devs.Dolfies],
settings: settings, settings: settings,
dependencies: ["ContextMenuAPI", "UserSettingsAPI"], dependencies: ["UserSettingsAPI"],
patches: [ patches: [
{ {
find: ".Messages.CUSTOM_STATUS_CLEAR_AFTER", find: ".Messages.CUSTOM_STATUS_CLEAR_AFTER",
@ -141,20 +140,21 @@ export default definePlugin({
} }
} }
], ],
render(status, openStatusModal_: () => void, OnClose: () => void) { render(status, openStatusModal: () => void, OnClose: () => void) {
const openStatusModal = () => { OnClose(), openStatusModal_(); }; if (!customStatusSettings) return;
const openModal = () => { OnClose(); openStatusModal(); };
return <ErrorBoundary> return <ErrorBoundary>
<div className={StatusStyles.menuDivider} /> <div className={StatusStyles.menuDivider} />
{status == null ? <PMenu {status == null ? <PMenu
id="sp-custom/presets-status" id="sp-custom/presets-status"
action="PRESS_SET_STATUS" action="PRESS_SET_STATUS"
onClick={openStatusModal} onClick={openModal}
icon={() => <div className={StatusStyles.customEmojiPlaceholder} />} icon={() => <div className={StatusStyles.customEmojiPlaceholder} />}
label="Set Custom Status" renderSubmenu={StatusSubMenuComponent} /> : <PMenu label="Set Custom Status" renderSubmenu={StatusSubMenuComponent} /> : <PMenu
id="sp-edit/presets-status" id="sp-edit/presets-status"
action="PRESS_EDIT_CUSTOM_STATUS" action="PRESS_EDIT_CUSTOM_STATUS"
onClick={openStatusModal} onClick={openModal}
hint={<Clickable className={StatusStyles.clearCustomStatusHint} onClick={() => customStatusSettings.updateSetting(null)}><Icons.CircleXIcon size="sm" /></Clickable>} hint={<Clickable tabIndex={-1} className={StatusStyles.clearCustomStatusHint} onClick={() => customStatusSettings.updateSetting(null)}><Icons.CircleXIcon size="sm" /></Clickable>}
icon={() => status.emoji != null ? <EmojiComponent emoji={status.emoji} animate={false} hideTooltip={false} /> : null} icon={() => status.emoji != null ? <EmojiComponent emoji={status.emoji} animate={false} hideTooltip={false} /> : null}
label="Edit Custom Status" renderSubmenu={StatusSubMenuComponent} />} label="Edit Custom Status" renderSubmenu={StatusSubMenuComponent} />}
</ErrorBoundary>; </ErrorBoundary>;