Skip to content

Commit 42bef2b

Browse files
committed
[TOOL-3598] Dashboard: Add error message in create ecosystem form for image size
1 parent 67354dc commit 42bef2b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ const formSchema = z.object({
3131
.refine((name) => /^[a-zA-Z0-9 ]*$/.test(name), {
3232
message: "Name can only contain letters, numbers and spaces",
3333
}),
34-
logo: z.instanceof(File, {
35-
message: "Logo is required",
36-
}),
34+
logo: z
35+
.instanceof(File, {
36+
message: "Logo is required",
37+
})
38+
.refine((file) => file.size <= 500 * 1024, {
39+
message: "Logo size must be less than 500KB",
40+
}),
3741
permission: z.union([z.literal("PARTNER_WHITELIST"), z.literal("ANYONE")]),
3842
});
3943

@@ -119,7 +123,6 @@ export function CreateEcosystemForm(props: { teamSlug: string }) {
119123
onUpload={(files) => {
120124
if (files[0]) {
121125
form.setValue("logo", files[0]);
122-
form.clearErrors("logo");
123126
}
124127
}}
125128
/>

0 commit comments

Comments
 (0)