mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +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() {
|
||||
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 (
|
||||
<Forms.FormSection title="Reasons">
|
||||
|
@ -48,25 +42,14 @@ function ReasonsComponent() {
|
|||
</Button>
|
||||
</div>
|
||||
))}
|
||||
<div
|
||||
className="vc-bbr-reason-wrapper"
|
||||
<Button
|
||||
onClick={() => {
|
||||
reasons.push("");
|
||||
settings.store.reasons = [...reasons];
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
onClick={() => {
|
||||
reasons.push("");
|
||||
settings.store.reasons = [...reasons];
|
||||
}}
|
||||
>
|
||||
Add new
|
||||
</Button>
|
||||
<Button
|
||||
color={Button.Colors.TRANSPARENT}
|
||||
onClick={() => {
|
||||
settings.store.reasons = defaultReasons;
|
||||
}}
|
||||
>
|
||||
Reset
|
||||
</Button></div>
|
||||
Add new
|
||||
</Button>
|
||||
</Forms.FormSection>
|
||||
);
|
||||
}
|
||||
|
@ -101,7 +84,11 @@ export default definePlugin({
|
|||
}
|
||||
],
|
||||
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 }
|
||||
));
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue