fix type errors hub
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
LockOpen1Icon,
|
||||
} from "@radix-ui/react-icons";
|
||||
import toast from "react-hot-toast";
|
||||
import { UserSchema } from "@repo/db/zod";
|
||||
import { UserOptionalDefaults, UserOptionalDefaultsSchema, UserSchema } from "@repo/db/zod";
|
||||
import { Bell, Plane } from "lucide-react";
|
||||
|
||||
export const ProfileForm = ({ user }: { user: User }) => {
|
||||
@@ -75,9 +75,7 @@ export const ProfileForm = ({ user }: { user: User }) => {
|
||||
/>
|
||||
</label>
|
||||
{form.formState.errors.firstname && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors.firstname.message}
|
||||
</p>
|
||||
<p className="text-error">{form.formState.errors.firstname.message}</p>
|
||||
)}
|
||||
<label className="floating-label w-full mb-5">
|
||||
<span className="text-lg flex items-center gap-2">
|
||||
@@ -92,9 +90,7 @@ export const ProfileForm = ({ user }: { user: User }) => {
|
||||
/>
|
||||
</label>
|
||||
{form.formState.errors.lastname && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors.lastname?.message}
|
||||
</p>
|
||||
<p className="text-error">{form.formState.errors.lastname?.message}</p>
|
||||
)}
|
||||
<label className="floating-label w-full">
|
||||
<span className="text-lg flex items-center gap-2">
|
||||
@@ -188,20 +184,14 @@ export const SocialForm = ({
|
||||
}}
|
||||
>
|
||||
<DiscordLogoIcon className="w-5 h-5" />
|
||||
<span className="group-hover:hidden">
|
||||
Verbunden mit {discordAccount.username}
|
||||
</span>
|
||||
<span className="group-hover:hidden">Verbunden mit {discordAccount.username}</span>
|
||||
<span className="hidden group-hover:inline">
|
||||
Verbindung trennen{isLoading && "..."}
|
||||
</span>
|
||||
</Button>
|
||||
) : (
|
||||
<a href={process.env.NEXT_PUBLIC_DISCORD_URL}>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-block"
|
||||
onSubmit={() => false}
|
||||
>
|
||||
<button type="button" className="btn btn-primary btn-block" onSubmit={() => false}>
|
||||
<DiscordLogoIcon className="w-5 h-5" /> Mit Discord verbinden
|
||||
</button>
|
||||
</a>
|
||||
@@ -224,9 +214,7 @@ export const SocialForm = ({
|
||||
/>
|
||||
</label>
|
||||
{form.formState.errors.vatsimCid && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors.vatsimCid.message}
|
||||
</p>
|
||||
<p className="text-error">{form.formState.errors.vatsimCid.message}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="card-actions justify-center pt-6 mt-auto">
|
||||
@@ -261,10 +249,7 @@ export const PasswordForm = () => {
|
||||
className="card-body"
|
||||
onSubmit={form.handleSubmit(async (values) => {
|
||||
setIsLoading(true);
|
||||
const result = await changePassword(
|
||||
values.password,
|
||||
values.newPassword,
|
||||
);
|
||||
const result = await changePassword(values.password, values.newPassword);
|
||||
form.reset(values);
|
||||
setIsLoading(false);
|
||||
if (result.error) {
|
||||
@@ -312,9 +297,7 @@ export const PasswordForm = () => {
|
||||
/>
|
||||
</label>
|
||||
{form.formState.errors.newPassword && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors.newPassword?.message}
|
||||
</p>
|
||||
<p className="text-error">{form.formState.errors.newPassword?.message}</p>
|
||||
)}
|
||||
<label className="floating-label w-full">
|
||||
<span className="text-lg flex items-center gap-2">
|
||||
@@ -328,9 +311,7 @@ export const PasswordForm = () => {
|
||||
/>
|
||||
</label>
|
||||
{form.formState.errors.newPasswordConfirm && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors.newPasswordConfirm?.message}
|
||||
</p>
|
||||
<p className="text-error">{form.formState.errors.newPasswordConfirm?.message}</p>
|
||||
)}
|
||||
<div className="card-actions justify-center pt-6">
|
||||
<Button
|
||||
@@ -350,9 +331,12 @@ export const PasswordForm = () => {
|
||||
export const PilotForm = ({ user }: { user: User }) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const form = useForm<User>({
|
||||
defaultValues: user,
|
||||
resolver: zodResolver(UserSchema),
|
||||
const form = useForm<UserOptionalDefaults>({
|
||||
defaultValues: {
|
||||
...user,
|
||||
emailVerified: user.emailVerified ?? undefined,
|
||||
},
|
||||
resolver: zodResolver(UserOptionalDefaultsSchema),
|
||||
});
|
||||
|
||||
if (!user) return null;
|
||||
@@ -389,9 +373,7 @@ export const PilotForm = ({ user }: { user: User }) => {
|
||||
/>
|
||||
</label>
|
||||
{form.formState.errors.settingsNtfyRoom && (
|
||||
<p className="text-error">
|
||||
{form.formState.errors.settingsNtfyRoom.message}
|
||||
</p>
|
||||
<p className="text-error">{form.formState.errors.settingsNtfyRoom.message}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="card-actions justify-center pt-6 mt-auto">
|
||||
|
||||
@@ -3,7 +3,7 @@ export const services = [
|
||||
id: "1",
|
||||
service: "dispatch",
|
||||
name: "Leitstellendisposition",
|
||||
approvedUrls: [process.env.NEXT_PUBLIC_DISPATCH_URL],
|
||||
approvedUrls: [process.env.NEXT_PUBLIC_DISPATCH_URL || ""],
|
||||
},
|
||||
{
|
||||
id: "2",
|
||||
|
||||
Reference in New Issue
Block a user