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