reduce spacing in forms

This commit is contained in:
Milo Schwartz 2024-12-22 17:09:22 -05:00
parent f224bfa4ee
commit 11cbafb92a
No known key found for this signature in database
16 changed files with 94 additions and 80 deletions

View file

@ -126,7 +126,7 @@ export default function CreateRoleForm({
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
id="create-role-form" id="create-role-form"
> >
<FormField <FormField

View file

@ -173,7 +173,7 @@ export default function DeleteRoleForm({
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
id="remove-role-form" id="remove-role-form"
> >
<FormField <FormField

View file

@ -123,7 +123,7 @@ export default function AccessControlsPage() {
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={form.control} control={form.control}

View file

@ -54,18 +54,16 @@ export default function GeneralPage() {
}); });
async function deleteOrg() { async function deleteOrg() {
await api await api.delete(`/org/${org?.org.orgId}`).catch((e) => {
.delete(`/org/${org?.org.orgId}`) toast({
.catch((e) => { variant: "destructive",
toast({ title: "Failed to delete org",
variant: "destructive", description: formatAxiosError(
title: "Failed to delete org", e,
description: formatAxiosError( "An error occurred while deleting the org."
e, )
"An error occurred while deleting the org."
),
});
}); });
});
} }
async function onSubmit(data: GeneralFormValues) { async function onSubmit(data: GeneralFormValues) {
@ -109,61 +107,63 @@ export default function GeneralPage() {
</p> </p>
</div> </div>
} }
buttonText="Confirm delete organization" buttonText="Confirm Delete Organization"
onConfirm={deleteOrg} onConfirm={deleteOrg}
string={org?.org.name || ""} string={org?.org.name || ""}
title="Delete organization" title="Delete Organization"
/> />
<Form {...form}> <section className="space-y-8 max-w-lg">
<form <Form {...form}>
onSubmit={form.handleSubmit(onSubmit)} <form
className="space-y-8 max-w-lg" onSubmit={form.handleSubmit(onSubmit)}
> className="space-y-4"
<FormField
control={form.control}
name="name"
render={({ field }) => (
<FormItem>
<FormLabel>Name</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormDescription>
This is the display name of the org
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Save Changes</Button>
</form>
</Form>
<Card className="max-w-lg border-red-900 mt-5">
<CardHeader>
<CardTitle className="flex items-center gap-2 text-red-600">
<AlertTriangle className="h-5 w-5" />
Danger Zone
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-sm mb-4">
Once you delete this org, there is no going back. Please
be certain.
</p>
</CardContent>
<CardFooter className="flex justify-end gap-2">
<Button
variant="destructive"
onClick={() => setIsDeleteModalOpen(true)}
className="flex items-center gap-2"
> >
<Trash2 className="h-4 w-4" /> <FormField
Delete control={form.control}
</Button> name="name"
</CardFooter> render={({ field }) => (
</Card> <FormItem>
<FormLabel>Name</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormDescription>
This is the display name of the org
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
<Button type="submit">Save Changes</Button>
</form>
</Form>
<Card className="border-red-900">
<CardHeader>
<CardTitle className="flex items-center gap-2 text-red-600">
<AlertTriangle className="h-5 w-5" />
Danger Zone
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-sm">
Once you delete this org, there is no going back.
Please be certain.
</p>
</CardContent>
<CardFooter className="flex justify-end gap-2">
<Button
variant="destructive"
onClick={() => setIsDeleteModalOpen(true)}
className="flex items-center gap-2"
>
<Trash2 className="h-4 w-4" />
Delete Organization Data
</Button>
</CardFooter>
</Card>
</section>
</> </>
); );
} }

View file

@ -412,7 +412,7 @@ export default function ResourceAuthenticationPage() {
onSubmit={usersRolesForm.handleSubmit( onSubmit={usersRolesForm.handleSubmit(
onSubmitUsersRoles onSubmitUsersRoles
)} )}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={usersRolesForm.control} control={usersRolesForm.control}
@ -639,7 +639,7 @@ export default function ResourceAuthenticationPage() {
{whitelistEnabled && ( {whitelistEnabled && (
<Form {...whitelistForm}> <Form {...whitelistForm}>
<form className="space-y-8"> <form className="space-y-4">
<FormField <FormField
control={whitelistForm.control} control={whitelistForm.control}
name="emails" name="emails"

View file

@ -132,8 +132,8 @@ export default function ReverseProxyTargets(props: {
async function addTarget(data: AddTargetFormValues) { async function addTarget(data: AddTargetFormValues) {
// Check if target with same IP, port and method already exists // Check if target with same IP, port and method already exists
const isDuplicate = targets.some( const isDuplicate = targets.some(
target => target.ip === data.ip && target => target.ip === data.ip &&
target.port === data.port && target.port === data.port &&
target.method === data.method target.method === data.method
); );
@ -157,7 +157,7 @@ export default function ReverseProxyTargets(props: {
setTargets([...targets, newTarget]); setTargets([...targets, newTarget]);
addTargetForm.reset(); addTargetForm.reset();
} }
const removeTarget = (targetId: number) => { const removeTarget = (targetId: number) => {
setTargets([ setTargets([
...targets.filter((target) => target.targetId !== targetId), ...targets.filter((target) => target.targetId !== targetId),
@ -400,7 +400,7 @@ export default function ReverseProxyTargets(props: {
onSubmit={addTargetForm.handleSubmit( onSubmit={addTargetForm.handleSubmit(
addTarget as any, addTarget as any,
)} )}
className="space-y-8" className="space-y-4"
> >
<div className="grid grid-cols-2 md:grid-cols-3 gap-4"> <div className="grid grid-cols-2 md:grid-cols-3 gap-4">
<FormField <FormField

View file

@ -135,7 +135,7 @@ export default function GeneralForm() {
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={form.control} control={form.control}

View file

@ -232,7 +232,7 @@ export default function CreateShareLinkForm({
</CredenzaDescription> </CredenzaDescription>
</CredenzaHeader> </CredenzaHeader>
<CredenzaBody> <CredenzaBody>
<div className="space-y-8"> <div className="space-y-4">
{!link && ( {!link && (
<Form {...form}> <Form {...form}>
<form <form

View file

@ -77,7 +77,7 @@ export default function GeneralPage() {
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={form.control} control={form.control}

View file

@ -203,7 +203,7 @@ PersistentKeepalive = 5`
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
id="create-site-form" id="create-site-form"
> >
<FormField <FormField

View file

@ -211,7 +211,7 @@ export default function ResetPasswordForm({
</CardDescription> </CardDescription>
</CardHeader> </CardHeader>
<CardContent> <CardContent>
<div className="space-y-8"> <div className="space-y-4">
{state === "request" && ( {state === "request" && (
<Form {...requestForm}> <Form {...requestForm}>
<form <form

View file

@ -2,6 +2,7 @@ import { verifySession } from "@app/lib/auth/verifySession";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { cache } from "react"; import { cache } from "react";
import ResetPasswordForm from "./ResetPasswordForm"; import ResetPasswordForm from "./ResetPasswordForm";
import Link from "next/link";
export const dynamic = "force-dynamic"; export const dynamic = "force-dynamic";
@ -27,6 +28,19 @@ export default async function Page(props: {
tokenParam={searchParams.token} tokenParam={searchParams.token}
emailParam={searchParams.email} emailParam={searchParams.email}
/> />
<p className="text-center text-muted-foreground mt-4">
<Link
href={
!searchParams.redirect
? `/auth/signup`
: `/auth/signup?redirect=${searchParams.redirect}`
}
className="underline"
>
Go to login
</Link>
</p>
</> </>
); );
} }

View file

@ -114,7 +114,7 @@ export default function SignupForm({ redirect }: SignupFormProps) {
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={form.control} control={form.control}

View file

@ -138,7 +138,7 @@ export default function VerifyEmailForm({
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={form.control} control={form.control}

View file

@ -188,7 +188,7 @@ export default function StepperForm() {
<Form {...orgForm}> <Form {...orgForm}>
<form <form
onSubmit={orgForm.handleSubmit(orgSubmit)} onSubmit={orgForm.handleSubmit(orgSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={orgForm.control} control={orgForm.control}

View file

@ -134,7 +134,7 @@ export default function LoginForm({ redirect, onLogin }: LoginFormProps) {
<Form {...form}> <Form {...form}>
<form <form
onSubmit={form.handleSubmit(onSubmit)} onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={form.control} control={form.control}
@ -203,7 +203,7 @@ export default function LoginForm({ redirect, onLogin }: LoginFormProps) {
<Form {...mfaForm}> <Form {...mfaForm}>
<form <form
onSubmit={mfaForm.handleSubmit(onSubmit)} onSubmit={mfaForm.handleSubmit(onSubmit)}
className="space-y-8" className="space-y-4"
> >
<FormField <FormField
control={mfaForm.control} control={mfaForm.control}