Merge branch 'dev' into immediate-finds-modules-proxy
This commit is contained in:
commit
0379beb0ba
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "vencord",
|
"name": "vencord",
|
||||||
"private": "true",
|
"private": "true",
|
||||||
"version": "1.9.7",
|
"version": "1.9.8",
|
||||||
"description": "The cutest Discord client mod",
|
"description": "The cutest Discord client mod",
|
||||||
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
"homepage": "https://github.com/Vendicated/Vencord#readme",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
|
|
|
@ -231,6 +231,10 @@ export function definePluginSettings<
|
||||||
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
||||||
return Settings.plugins[definedSettings.pluginName] as any;
|
return Settings.plugins[definedSettings.pluginName] as any;
|
||||||
},
|
},
|
||||||
|
get plain() {
|
||||||
|
if (!definedSettings.pluginName) throw new Error("Cannot access settings before plugin is initialized");
|
||||||
|
return PlainSettings.plugins[definedSettings.pluginName] as any;
|
||||||
|
},
|
||||||
use: settings => useSettings(
|
use: settings => useSettings(
|
||||||
settings?.map(name => `plugins.${definedSettings.pluginName}.${name}`) as UseSettings<Settings>[]
|
settings?.map(name => `plugins.${definedSettings.pluginName}.${name}`) as UseSettings<Settings>[]
|
||||||
).plugins[definedSettings.pluginName] as any,
|
).plugins[definedSettings.pluginName] as any,
|
||||||
|
|
|
@ -23,7 +23,7 @@ import { LazyComponentType } from "@utils/lazyReact";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByCode, findComponentByCode } from "@webpack";
|
import { findByCode, findComponentByCode } from "@webpack";
|
||||||
import { Card, ChannelStore, Forms, GuildStore, PermissionsBits, Switch, TextInput, Tooltip, useState } from "@webpack/common";
|
import { Card, ChannelStore, Forms, GuildStore, PermissionsBits, Switch, TextInput, Tooltip } from "@webpack/common";
|
||||||
import type { Permissions } from "@webpack/types";
|
import type { Permissions } from "@webpack/types";
|
||||||
import type { Channel, Guild, Message, User } from "discord-types/general";
|
import type { Channel, Guild, Message, User } from "discord-types/general";
|
||||||
|
|
||||||
|
@ -108,14 +108,8 @@ const defaultSettings = Object.fromEntries(
|
||||||
tags.map(({ name, displayName }) => [name, { text: displayName, showInChat: true, showInNotChat: true }])
|
tags.map(({ name, displayName }) => [name, { text: displayName, showInChat: true, showInNotChat: true }])
|
||||||
) as TagSettings;
|
) as TagSettings;
|
||||||
|
|
||||||
function SettingsComponent(props: { setValue(v: any): void; }) {
|
function SettingsComponent() {
|
||||||
settings.store.tagSettings ??= defaultSettings;
|
const tagSettings = settings.store.tagSettings ??= defaultSettings;
|
||||||
|
|
||||||
const [tagSettings, setTagSettings] = useState(settings.store.tagSettings as TagSettings);
|
|
||||||
const setValue = (v: TagSettings) => {
|
|
||||||
setTagSettings(v);
|
|
||||||
props.setValue(v);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex flexDirection="column">
|
<Flex flexDirection="column">
|
||||||
|
@ -138,19 +132,13 @@ function SettingsComponent(props: { setValue(v: any): void; }) {
|
||||||
type="text"
|
type="text"
|
||||||
value={tagSettings[t.name]?.text ?? t.displayName}
|
value={tagSettings[t.name]?.text ?? t.displayName}
|
||||||
placeholder={`Text on tag (default: ${t.displayName})`}
|
placeholder={`Text on tag (default: ${t.displayName})`}
|
||||||
onChange={v => {
|
onChange={v => tagSettings[t.name].text = v}
|
||||||
tagSettings[t.name].text = v;
|
|
||||||
setValue(tagSettings);
|
|
||||||
}}
|
|
||||||
className={Margins.bottom16}
|
className={Margins.bottom16}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
value={tagSettings[t.name]?.showInChat ?? true}
|
value={tagSettings[t.name]?.showInChat ?? true}
|
||||||
onChange={v => {
|
onChange={v => tagSettings[t.name].showInChat = v}
|
||||||
tagSettings[t.name].showInChat = v;
|
|
||||||
setValue(tagSettings);
|
|
||||||
}}
|
|
||||||
hideBorder
|
hideBorder
|
||||||
>
|
>
|
||||||
Show in messages
|
Show in messages
|
||||||
|
@ -158,10 +146,7 @@ function SettingsComponent(props: { setValue(v: any): void; }) {
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
value={tagSettings[t.name]?.showInNotChat ?? true}
|
value={tagSettings[t.name]?.showInNotChat ?? true}
|
||||||
onChange={v => {
|
onChange={v => tagSettings[t.name].showInNotChat = v}
|
||||||
tagSettings[t.name].showInNotChat = v;
|
|
||||||
setValue(tagSettings);
|
|
||||||
}}
|
|
||||||
hideBorder
|
hideBorder
|
||||||
>
|
>
|
||||||
Show in member list and profiles
|
Show in member list and profiles
|
||||||
|
@ -184,7 +169,7 @@ const settings = definePluginSettings({
|
||||||
tagSettings: {
|
tagSettings: {
|
||||||
type: OptionType.COMPONENT,
|
type: OptionType.COMPONENT,
|
||||||
component: SettingsComponent,
|
component: SettingsComponent,
|
||||||
description: "fill me",
|
description: "fill me"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,8 @@ export interface DefinedSettings<
|
||||||
> {
|
> {
|
||||||
/** Shorthand for `Vencord.Settings.plugins.PluginName`, but with typings */
|
/** Shorthand for `Vencord.Settings.plugins.PluginName`, but with typings */
|
||||||
store: SettingsStore<Def> & PrivateSettings;
|
store: SettingsStore<Def> & PrivateSettings;
|
||||||
|
/** Shorthand for `Vencord.PlainSettings.plugins.PluginName`, but with typings */
|
||||||
|
plain: SettingsStore<Def> & PrivateSettings;
|
||||||
/**
|
/**
|
||||||
* React hook for getting the settings for this plugin
|
* React hook for getting the settings for this plugin
|
||||||
* @param filter optional filter to avoid rerenders for irrelevent settings
|
* @param filter optional filter to avoid rerenders for irrelevent settings
|
||||||
|
|
Loading…
Reference in a new issue