import { SubmitHandler, useForm } from "react-hook-form"; import styles from "./Onboarding.module.scss"; import { Text } from "preact-i18n"; import { useState } from "preact/hooks"; import { Button, Preloader } from "@revoltchat/ui"; // import wideSVG from "/assets/wide.svg"; import background from "./assets/onboarding_background.svg"; import FormField from "../../../../pages/login/FormField"; import { takeError } from "../../../client/jsx/error"; import { ModalProps } from "../../types"; interface FormInputs { username: string; } export function OnboardingModal({ callback, ...props }: ModalProps<"onboarding">) { const { handleSubmit, register } = useForm(); const [loading, setLoading] = useState(false); const [error, setError] = useState(undefined); const onSubmit: SubmitHandler = ({ username }) => { setLoading(true); callback(username, true) .then(() => props.onClose()) .catch((err: unknown) => { setError(takeError(err)); setLoading(false); }); }; return (

{"Welcome to Revolt."}

{loading ? ( ) : ( <>

{"It's time to choose a username."}
{ "Others will be able to find, recognise and mention you with this name, so choose wisely." }
{ "You can change it at any time in your User Settings." }

}>

You will be automatically assigned a discriminator which you can find from settings.

)}
); }