mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 09:56:24 +00:00
using findbyCodeLazy for setStatus
This commit is contained in:
parent
adc0d2f0d7
commit
4ccf12f5b4
1 changed files with 5 additions and 7 deletions
|
@ -21,7 +21,7 @@ import { getUserSettingLazy } from "@api/UserSettings";
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { Button, Clickable, Icons, Menu, Toasts, useState } from "@webpack/common";
|
||||
|
||||
// const { PMenu } = mapMangledModuleLazy("{id:t,label:n,icon:c,hint:_,renderSubmenu:E,...h}", {
|
||||
|
@ -39,7 +39,8 @@ const StatusStyles = findByPropsLazy("statusItem");
|
|||
|
||||
const statusSettings = getUserSettingLazy("status", "status");
|
||||
const customStatusSettings = getUserSettingLazy("status", "customStatus");
|
||||
|
||||
const setStatusFunc = findByCodeLazy(/default\.track\(\i.\i.CUSTOM_STATUS_UPDATED/);
|
||||
const setStatus = (status: DiscordStatus) => setStatusFunc(status.text, status.emojiInfo, status.clearAfter, { "location": { "section": "Account Panel", "object": "Avatar" } });
|
||||
|
||||
interface Emoji {
|
||||
animated: boolean;
|
||||
|
@ -64,9 +65,6 @@ const settings = definePluginSettings({
|
|||
});
|
||||
|
||||
|
||||
function SetStatus(status: DiscordStatus, sourceAnalyticsContext: any) {
|
||||
return Vencord.Webpack.wreq(720449).Z(status.text, status.emojiInfo, status.clearAfter, sourceAnalyticsContext);
|
||||
}
|
||||
|
||||
|
||||
const RenderStatusMenuItem = ({ status }) => {
|
||||
|
@ -111,7 +109,7 @@ const StatusSubMenuComponent = () => {
|
|||
{Object.values((settings.store.StatusPresets as { [k: string]: DiscordStatus; })).map(status => <Menu.MenuItem
|
||||
id={"status-presets-" + status.text}
|
||||
label={status.status}
|
||||
action={() => SetStatus(status, { "location": { "section": "Account Panel", "object": "Avatar" } })}
|
||||
action={() => setStatus(status)}
|
||||
render={() => <RenderStatusMenuItem status={status} />}
|
||||
/>)}
|
||||
</Menu.Menu>;
|
||||
|
@ -154,7 +152,7 @@ export default definePlugin({
|
|||
id="sp-edit/presets-status"
|
||||
action="PRESS_EDIT_CUSTOM_STATUS"
|
||||
onClick={openModal}
|
||||
hint={<Clickable tabIndex={-1} className={StatusStyles.clearCustomStatusHint} onClick={() => customStatusSettings.updateSetting(null)}><Icons.CircleXIcon size="sm" /></Clickable>}
|
||||
hint={<Clickable 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}
|
||||
label="Edit Custom Status" renderSubmenu={StatusSubMenuComponent} />}
|
||||
</ErrorBoundary>;
|
||||
|
|
Loading…
Reference in a new issue