Skip to content

Commit

Permalink
feat(ui:cleaning): tweaks for Prowler v5 (#5913)
Browse files Browse the repository at this point in the history
  • Loading branch information
paabloLC authored Nov 26, 2024
1 parent d57db6c commit afd152c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 62 deletions.
9 changes: 8 additions & 1 deletion ui/actions/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
};
}
};

Expand Down
42 changes: 4 additions & 38 deletions ui/components/auth/oss/auth-form.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 = ({
Expand All @@ -38,7 +32,6 @@ export const AuthForm = ({
...(type === "sign-up" && {
name: "",
company: "",
termsAndConditions: false,
confirmPassword: "",
...(invitationToken && { invitationToken }),
}),
Expand Down Expand Up @@ -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" />
</>
)}
/>
</>
)}

Expand Down Expand Up @@ -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" />
Expand Down Expand Up @@ -299,7 +265,7 @@ export const AuthForm = ({
</Button>
</div>
</>
)}
)} */}
{type === "sign-in" ? (
<p className="text-center text-small">
Need to create an account?&nbsp;
Expand Down
34 changes: 17 additions & 17 deletions ui/components/ui/sidebar/sidebar-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
// },
],
},

Expand All @@ -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",
// },
],
},
];
Expand Down
6 changes: 0 additions & 6 deletions ui/types/authFormSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit afd152c

Please sign in to comment.