mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-26 09:16:24 +00:00
ui clean up
This commit is contained in:
parent
1571cd17dd
commit
f7d790a391
1 changed files with 10 additions and 27 deletions
|
@ -24,15 +24,8 @@ import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||||
import { Button, Clickable, Icons, Menu, 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 = findComponentByCodeLazy(/{id:\i,label:\i,icon:\i,hint:\i,renderSubmenu:\i,...\i}/); // findComponentByCodeLazy("{id:t,label:n,icon:c,hint:_,renderSubmenu:h,...E}");
|
||||||
// PMenu: filters.byCode("{id:t,label:n,icon:c,hint:_,renderSubmenu:E,...h}")
|
const EmojiComponent = findComponentByCodeLazy(/\i.translateSurrogatesToInlineEmoji\(\i.name\)/);
|
||||||
// });
|
|
||||||
|
|
||||||
const PMenu = findComponentByCodeLazy("{id:t,label:n,icon:c,hint:_,renderSubmenu:h,...E}");
|
|
||||||
const EmojiComponent = findComponentByCodeLazy("let{emoji:t,className:n,animate:r=!0,hideTooltip:a,tooltipDelay:o}");
|
|
||||||
const PSubMenu = findComponentByCodeLazy("submenuPaddingContainer,children:(0,i.jsx)(o.Menu,{contextMenuApiArguments:");
|
|
||||||
//
|
|
||||||
// submenuPaddingContainer,children:(
|
|
||||||
|
|
||||||
const Components = findByPropsLazy("Status");
|
const Components = findByPropsLazy("Status");
|
||||||
const StatusStyles = findByPropsLazy("statusItem");
|
const StatusStyles = findByPropsLazy("statusItem");
|
||||||
|
@ -65,9 +58,9 @@ const settings = definePluginSettings({
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const ClearStatusButton = () => <Clickable className={StatusStyles.clearCustomStatusHint} onClick={() => customStatusSettings?.updateSetting(null)}><Icons.CircleXIcon size="sm" /></Clickable>;
|
||||||
|
|
||||||
|
const RenderStatusMenuItem = ({ status }: { status: DiscordStatus; }) => {
|
||||||
const RenderStatusMenuItem = ({ status }) => {
|
|
||||||
|
|
||||||
const [isHovering, setIsHovering] = useState(false);
|
const [isHovering, setIsHovering] = useState(false);
|
||||||
const handleMouseOver = () => {
|
const handleMouseOver = () => {
|
||||||
|
@ -81,7 +74,7 @@ const RenderStatusMenuItem = ({ status }) => {
|
||||||
return <div className={StatusStyles.statusItem}
|
return <div className={StatusStyles.statusItem}
|
||||||
onMouseOver={handleMouseOver}
|
onMouseOver={handleMouseOver}
|
||||||
onMouseOut={handleMouseOut}>
|
onMouseOut={handleMouseOut}>
|
||||||
{isHovering ? <Clickable
|
<Clickable
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
delete settings.store.StatusPresets[status.text];
|
delete settings.store.StatusPresets[status.text];
|
||||||
Toasts.show({
|
Toasts.show({
|
||||||
|
@ -89,21 +82,12 @@ const RenderStatusMenuItem = ({ status }) => {
|
||||||
type: Toasts.Type.SUCCESS,
|
type: Toasts.Type.SUCCESS,
|
||||||
id: Toasts.genId()
|
id: Toasts.genId()
|
||||||
});
|
});
|
||||||
}}><Components.Status
|
}}>{status.emojiInfo != null ? <EmojiComponent emoji={status.emojiInfo} animate={false} hideTooltip={false} /> : <div className={StatusStyles.customEmojiPlaceholder} />}</Clickable>
|
||||||
status={"dnd"} className={StatusStyles.icon}
|
<div className={StatusStyles.status} style={{ marginLeft: "5px" }}>{status.text}</div>
|
||||||
size={12}
|
</div >;
|
||||||
style={{
|
|
||||||
rotate: "60deg",
|
|
||||||
}}
|
|
||||||
/></Clickable> : <Components.Status
|
|
||||||
status={status.status} className={StatusStyles.icon}
|
|
||||||
size={10}
|
|
||||||
/>}
|
|
||||||
<div className={StatusStyles.status}>{status.status}</div>
|
|
||||||
<div className={StatusStyles.description}>{status.text}</div>
|
|
||||||
</div>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const StatusSubMenuComponent = () => {
|
const StatusSubMenuComponent = () => {
|
||||||
return <Menu.Menu navId="sp-custom-status-submenu" onClose={() => { }}>
|
return <Menu.Menu navId="sp-custom-status-submenu" onClose={() => { }}>
|
||||||
{Object.values((settings.store.StatusPresets as { [k: string]: DiscordStatus; })).map(status => <Menu.MenuItem
|
{Object.values((settings.store.StatusPresets as { [k: string]: DiscordStatus; })).map(status => <Menu.MenuItem
|
||||||
|
@ -139,7 +123,6 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
render(status: null | { emoji: Emoji | null; }, openCustomStatusModal: () => void) {
|
render(status: null | { emoji: Emoji | null; }, openCustomStatusModal: () => void) {
|
||||||
if (!customStatusSettings) return;
|
|
||||||
return <ErrorBoundary>
|
return <ErrorBoundary>
|
||||||
<div className={StatusStyles.menuDivider} />
|
<div className={StatusStyles.menuDivider} />
|
||||||
{status == null ?
|
{status == null ?
|
||||||
|
@ -155,7 +138,7 @@ export default definePlugin({
|
||||||
id="sp-edit/presets-status"
|
id="sp-edit/presets-status"
|
||||||
action="PRESS_EDIT_CUSTOM_STATUS"
|
action="PRESS_EDIT_CUSTOM_STATUS"
|
||||||
onClick={openCustomStatusModal}
|
onClick={openCustomStatusModal}
|
||||||
hint={<Clickable className={StatusStyles.clearCustomStatusHint} onClick={() => customStatusSettings.updateSetting(null)}><Icons.CircleXIcon size="sm" /></Clickable>}
|
hint={<ClearStatusButton />}
|
||||||
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}
|
||||||
/>}
|
/>}
|
||||||
|
|
Loading…
Reference in a new issue