mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 21:53:04 -04:00
Patch Fixes
This commit is contained in:
parent
02d34de59b
commit
db3186d607
4 changed files with 59 additions and 45 deletions
|
@ -45,13 +45,6 @@ export default definePlugin({
|
||||||
replace: "return $1;"
|
replace: "return $1;"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
find: '"Slate: Unable to find syntax characters"',
|
|
||||||
replacement: {
|
|
||||||
match: /((let )(\i)=\i\.indexOf\(\i,(\i)\)),/,
|
|
||||||
replace: "$1;if ($3 === -1) {return $4;}$2"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,53 +4,55 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import "./style.css";
|
import "./styles.css";
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
import { classNameFactory } from "@api/Styles";
|
||||||
|
import { DeleteIcon, PlusIcon } from "@components/Icons";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { getIntlMessage } from "@utils/discord";
|
import { getIntlMessage } from "@utils/discord";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { Button, Forms, TextInput } from "@webpack/common";
|
import { Button, Forms, TextInput } from "@webpack/common";
|
||||||
|
|
||||||
|
const cl = classNameFactory("vc-bbr-");
|
||||||
|
|
||||||
function ReasonsComponent() {
|
function ReasonsComponent() {
|
||||||
const { reasons } = settings.use(["reasons"]);
|
const { reasons } = settings.store;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection title="Reasons">
|
<Forms.FormSection title="Reasons">
|
||||||
{reasons.map((reason: string, index: number) => (
|
{reasons.map((r, i) => (
|
||||||
<div
|
<div
|
||||||
className="vc-bbr-reason-wrapper"
|
key={i}
|
||||||
key={index}
|
className={cl("reason-wrapper")}
|
||||||
>
|
>
|
||||||
<TextInput
|
<TextInput
|
||||||
type="text"
|
value={r}
|
||||||
key={index}
|
|
||||||
value={reason}
|
|
||||||
onChange={v => {
|
onChange={v => {
|
||||||
reasons[index] = v;
|
reasons[i] = v;
|
||||||
settings.store.reasons = [...reasons];
|
settings.store.reasons = reasons;
|
||||||
}}
|
}}
|
||||||
placeholder="Reason"
|
placeholder="Reason"
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
color={Button.Colors.RED}
|
className={cl("remove-button")}
|
||||||
className="vc-bbr-remove-button"
|
color={Button.Colors.TRANSPARENT}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
reasons.splice(index, 1);
|
reasons.splice(i, 1);
|
||||||
settings.store.reasons = [...reasons];
|
settings.store.reasons = reasons;
|
||||||
}}
|
}}
|
||||||
|
look={Button.Looks.BLANK}
|
||||||
|
size={Button.Sizes.MIN}
|
||||||
>
|
>
|
||||||
Remove
|
<DeleteIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<Button
|
<div className={cl("reason-wrapper")}>
|
||||||
onClick={() => {
|
<Button onClick={() => settings.store.reasons.push("")} className={cl("add-button")} size={Button.Sizes.LARGE} color={Button.Colors.TRANSPARENT}>
|
||||||
settings.store.reasons = [...reasons, ""];
|
<PlusIcon /> Add another reason
|
||||||
}}
|
</Button>
|
||||||
>
|
</div>
|
||||||
Add new
|
|
||||||
</Button>
|
|
||||||
</Forms.FormSection>
|
</Forms.FormSection>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -59,10 +61,10 @@ const settings = definePluginSettings({
|
||||||
reasons: {
|
reasons: {
|
||||||
description: "Your custom reasons",
|
description: "Your custom reasons",
|
||||||
type: OptionType.COMPONENT,
|
type: OptionType.COMPONENT,
|
||||||
default: [""],
|
default: [] as string[],
|
||||||
component: ReasonsComponent,
|
component: ReasonsComponent,
|
||||||
},
|
},
|
||||||
textInputDefault: {
|
isTextInputDefault: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
description: 'Shows a text input instead of a select menu by default. (Equivalent to clicking the "Other" option)'
|
description: 'Shows a text input instead of a select menu by default. (Equivalent to clicking the "Other" option)'
|
||||||
}
|
}
|
||||||
|
@ -74,9 +76,9 @@ export default definePlugin({
|
||||||
authors: [Devs.Inbestigator],
|
authors: [Devs.Inbestigator],
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "#{intl::BAN_MULTIPLE_CONFIRM_TITLE}",
|
find: "#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}",
|
||||||
replacement: [{
|
replacement: [{
|
||||||
match: /\[\{name:\i\.\i\.string\(\i\.\i#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}\).+?\}\]/,
|
match: /\[(\{((name|value):\i\.\i\.string\(\i\.\i\.\i\),?){2}\},?){3}\]/,
|
||||||
replace: "$self.getReasons()"
|
replace: "$self.getReasons()"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -86,17 +88,16 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
getReasons() {
|
getReasons() {
|
||||||
const reasons = settings.store.reasons.length
|
const storedReasons = settings.store.reasons.filter((r: string) => r.trim());
|
||||||
? settings.store.reasons
|
const reasons: string[] = storedReasons.length
|
||||||
|
? storedReasons
|
||||||
: [
|
: [
|
||||||
getIntlMessage("BAN_REASON_OPTION_SPAM_ACCOUNT"),
|
getIntlMessage("BAN_REASON_OPTION_SPAM_ACCOUNT"),
|
||||||
getIntlMessage("BAN_REASON_OPTION_HACKED_ACCOUNT"),
|
getIntlMessage("BAN_REASON_OPTION_HACKED_ACCOUNT"),
|
||||||
getIntlMessage("BAN_REASON_OPTION_BREAKING_RULES")
|
getIntlMessage("BAN_REASON_OPTION_BREAKING_RULES"),
|
||||||
];
|
];
|
||||||
return reasons.map(s => ({ name: s, value: s }));
|
return reasons.map(s => ({ name: s, value: s }));
|
||||||
},
|
},
|
||||||
getDefaultState() {
|
getDefaultState: () => settings.store.isTextInputDefault ? 1 : 0,
|
||||||
return settings.store.textInputDefault ? 1 : 0;
|
|
||||||
},
|
|
||||||
settings,
|
settings,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,31 @@
|
||||||
.vc-bbr-reason-wrapper {
|
.vc-bbr-reason-wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
padding: 0;
|
padding-bottom: 12px;
|
||||||
padding-bottom: 0.5rem;
|
gap: 4px 12px;
|
||||||
gap: 0.5rem;
|
align-items: center;
|
||||||
grid-template-columns: 6fr 1fr;
|
grid-template-columns: 1fr 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-bbr-remove-button {
|
.vc-bbr-remove-button {
|
||||||
height: 100%;
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-bbr-remove-button:hover {
|
||||||
|
color: var(--button-danger-background-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-bbr-add-button {
|
||||||
|
justify-content: start !important;
|
||||||
|
border: 0;
|
||||||
|
padding: 2px 12px;
|
||||||
|
color: var(--text-muted) !important;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vc-bbr-add-button div {
|
||||||
|
display: flex;
|
||||||
|
justify-content: start;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default definePlugin({
|
||||||
settings,
|
settings,
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "#{intl::BAN_CONFIRM_TITLE}",
|
find: "#{intl::BAN_REASON_OPTION_SPAM_ACCOUNT}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /src:\i\("?\d+"?\)/g,
|
match: /src:\i\("?\d+"?\)/g,
|
||||||
replace: "src:$self.source"
|
replace: "src:$self.source"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue