Update all Packages, add emailVerification on change, fix errors

This commit is contained in:
nocnico
2025-06-02 00:39:14 +02:00
parent 6972216aaf
commit a00d0f449a
11 changed files with 690 additions and 638 deletions

View File

@@ -24,14 +24,15 @@ import { UserOptionalDefaults, UserOptionalDefaultsSchema } from "@repo/db/zod";
import { Bell, Plane } from "lucide-react";
import Link from "next/link";
export const ProfileForm = ({ user }: { user: User }) => {
export const ProfileForm = ({ user }: { user: User }): React.JSX.Element => {
const schema = z.object({
firstname: z.string().min(2).max(30),
lastname: z.string().min(2).max(30),
email: z.string().email({
message: "Bitte gebe eine gültige E-Mail Adresse ein",
}),
settingsHideLastname: z.boolean().default(false),
settingsHideLastname: z.boolean(),
emailVerified: z.boolean(),
});
const [isLoading, setIsLoading] = useState(false);
type IFormInput = z.infer<typeof schema>;
@@ -108,6 +109,10 @@ export const ProfileForm = ({ user }: { user: User }) => {
type="text"
className="input input-bordered w-full"
defaultValue={user.email}
onChange={(e) => {
form.setValue("email", e.target.value.trim());
form.setValue("emailVerified", false);
}}
placeholder="E-Mail"
/>
</label>
@@ -135,7 +140,7 @@ export const SocialForm = ({
}: {
discordAccount?: DiscordAccount;
user: User;
}) => {
}): React.JSX.Element | null => {
const [isLoading, setIsLoading] = useState(false);
const [vatsimLoading, setVatsimLoading] = useState(false);
const router = useRouter();
@@ -238,7 +243,7 @@ export const SocialForm = ({
);
};
export const PasswordForm = () => {
export const PasswordForm = (): React.JSX.Element => {
const schema = z.object({
password: z.string().min(2).max(30),
newPassword: z.string().min(2).max(30),
@@ -335,7 +340,7 @@ export const PasswordForm = () => {
);
};
export const PilotForm = ({ user }: { user: User }) => {
export const PilotForm = ({ user }: { user: User }): React.JSX.Element | null => {
const [isLoading, setIsLoading] = useState(false);
const form = useForm<UserOptionalDefaults>({