mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
Made it display the defaults if custom options aren't defined
This commit is contained in:
parent
43f43ab2c5
commit
ebb4160198
1 changed files with 12 additions and 25 deletions
|
@ -13,12 +13,6 @@ import { Button, Forms, i18n, TextInput } from "@webpack/common";
|
||||||
|
|
||||||
function ReasonsComponent() {
|
function ReasonsComponent() {
|
||||||
const { reasons } = settings.use(["reasons"]);
|
const { reasons } = settings.use(["reasons"]);
|
||||||
const defaultReasons = [
|
|
||||||
i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT,
|
|
||||||
i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT,
|
|
||||||
i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES
|
|
||||||
];
|
|
||||||
if (!reasons) settings.store.reasons = defaultReasons;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Forms.FormSection title="Reasons">
|
<Forms.FormSection title="Reasons">
|
||||||
|
@ -48,9 +42,6 @@ function ReasonsComponent() {
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<div
|
|
||||||
className="vc-bbr-reason-wrapper"
|
|
||||||
>
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
reasons.push("");
|
reasons.push("");
|
||||||
|
@ -59,14 +50,6 @@ function ReasonsComponent() {
|
||||||
>
|
>
|
||||||
Add new
|
Add new
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
|
||||||
color={Button.Colors.TRANSPARENT}
|
|
||||||
onClick={() => {
|
|
||||||
settings.store.reasons = defaultReasons;
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Reset
|
|
||||||
</Button></div>
|
|
||||||
</Forms.FormSection>
|
</Forms.FormSection>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +84,11 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
getReasons() {
|
getReasons() {
|
||||||
return settings.store.reasons.map(reason => (
|
return (settings.store.reasons.length() ? settings.store.reasons : [
|
||||||
|
i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT,
|
||||||
|
i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT,
|
||||||
|
i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES
|
||||||
|
]).map((reason: string) => (
|
||||||
{ name: reason, value: reason }
|
{ name: reason, value: reason }
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue