feat(ui:cleaning): tweaks for Prowler v5 (#5913)

This commit is contained in:
Pablo Lara
2024-11-26 16:26:06 +01:00
committed by GitHub
parent d57db6c39e
commit afd152c073
4 changed files with 29 additions and 62 deletions
+8 -1
View File
@@ -89,7 +89,14 @@ export const createNewUser = async (
return parsedResponse;
} catch (error) {
return { errors: [{ detail: "Network error or server is unreachable" }] };
return {
errors: [
{
source: { pointer: "" },
detail: "Network error or server is unreachable",
},
],
};
}
};
+4 -38
View File
@@ -1,8 +1,7 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
import { Icon } from "@iconify/react";
import { Button, Checkbox, Divider, Link } from "@nextui-org/react";
import { Checkbox, Link } from "@nextui-org/react";
import { useRouter } from "next/navigation";
import { useForm } from "react-hook-form";
import { z } from "zod";
@@ -12,12 +11,7 @@ import { NotificationIcon, ProwlerExtended } from "@/components/icons";
import { ThemeSwitch } from "@/components/ThemeSwitch";
import { useToast } from "@/components/ui";
import { CustomButton, CustomInput } from "@/components/ui/custom";
import {
Form,
FormControl,
FormField,
FormMessage,
} from "@/components/ui/form";
import { Form } from "@/components/ui/form";
import { ApiError, authFormSchema } from "@/types";
export const AuthForm = ({
@@ -38,7 +32,6 @@ export const AuthForm = ({
...(type === "sign-up" && {
name: "",
company: "",
termsAndConditions: false,
confirmPassword: "",
...(invitationToken && { invitationToken }),
}),
@@ -211,33 +204,6 @@ export const AuthForm = ({
isInvalid={!!form.formState.errors.invitationToken}
/>
)}
<FormField
control={form.control}
name="termsAndConditions"
render={({ field }) => (
<>
<FormControl>
<Checkbox
isRequired
className="py-4"
size="sm"
checked={field.value}
onChange={(e) => field.onChange(e.target.checked)}
>
I agree with the&nbsp;
<Link href="#" size="sm">
Terms
</Link>
&nbsp; and&nbsp;
<Link href="#" size="sm">
Privacy Policy
</Link>
</Checkbox>
</FormControl>
<FormMessage className="text-system-error dark:text-system-error" />
</>
)}
/>
</>
)}
@@ -269,7 +235,7 @@ export const AuthForm = ({
</form>
</Form>
{type === "sign-in" && (
{/* {type === "sign-in" && (
<>
<div className="flex items-center gap-4 py-2">
<Divider className="flex-1" />
@@ -299,7 +265,7 @@ export const AuthForm = ({
</Button>
</div>
</>
)}
)} */}
{type === "sign-in" ? (
<p className="text-center text-small">
Need to create an account?&nbsp;
+17 -17
View File
@@ -142,18 +142,18 @@ export const sectionItems: SidebarItem[] = [
href: "/compliance",
icon: "fluent-mdl2:compliance-audit",
title: "Compliance",
endContent: (
<Chip size="sm" variant="flat">
New
</Chip>
),
},
{
key: "services",
href: "/services",
icon: "material-symbols:linked-services-outline",
title: "Services",
// endContent: (
// <Chip size="sm" variant="flat">
// New
// </Chip>
// ),
},
// {
// key: "services",
// href: "/services",
// icon: "material-symbols:linked-services-outline",
// title: "Services",
// },
],
},
@@ -167,12 +167,12 @@ export const sectionItems: SidebarItem[] = [
icon: "fluent:cloud-sync-24-regular",
title: "Providers",
},
{
key: "integrations",
href: "/integrations",
icon: "tabler:puzzle",
title: "Integrations",
},
// {
// key: "integrations",
// href: "/integrations",
// icon: "tabler:puzzle",
// title: "Integrations",
// },
],
},
];
-6
View File
@@ -23,12 +23,6 @@ export const authFormSchema = (type: string) =>
}),
invitationToken:
type === "sign-in" ? z.string().optional() : z.string().optional(),
termsAndConditions:
type === "sign-in"
? z.boolean().optional()
: z.boolean().refine((value) => value === true, {
message: "You must accept the terms and conditions.",
}),
// Fields for Sign In and Sign Up
email: z.string().email(),