mirror of
https://github.com/revoltchat/revite.git
synced 2025-01-12 15:31:26 -05:00
update create bot form
This commit is contained in:
parent
28dbd49957
commit
e92877158c
2 changed files with 13 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
import { SubmitHandler, useForm } from "react-hook-form";
|
||||
import { Bot } from "revolt-api/types/Bots";
|
||||
|
||||
import { Text } from "preact-i18n";
|
||||
import { useContext, useState } from "preact/hooks";
|
||||
|
||||
import Modal from "../../../components/ui/Modal";
|
||||
|
@ -45,12 +46,12 @@ export function CreateBotModal({ onClose, onCreate }: Props) {
|
|||
contrast: true,
|
||||
accent: true,
|
||||
onClick: handleSubmit(onSubmit),
|
||||
children: "Create",
|
||||
children: <Text id="app.special.modals.actions.create" />,
|
||||
},
|
||||
{
|
||||
plain: true,
|
||||
onClick: onClose,
|
||||
children: "Cancel",
|
||||
children: <Text id="app.special.modals.actions.cancel" />,
|
||||
},
|
||||
]}>
|
||||
{/* Preact / React typing incompatabilities */}
|
||||
|
|
|
@ -67,7 +67,16 @@ export default function FormField({
|
|||
},
|
||||
}
|
||||
: type === "username"
|
||||
? { required: "RequiredField" }
|
||||
? {
|
||||
validate: (value: string) =>
|
||||
value.length === 0
|
||||
? "RequiredField"
|
||||
: value.length < 2
|
||||
? "TooShort"
|
||||
: value.length > 32
|
||||
? "TooLong"
|
||||
: undefined,
|
||||
}
|
||||
: { required: "RequiredField" },
|
||||
)}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue