-
-
Notifications
You must be signed in to change notification settings - Fork 173
feat: add company logo upload functionality to job creation form #1283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ export const saveJobsSchema = z.object({ | |
| .url("Provide a valid url") | ||
| .optional() | ||
| .or(z.literal("")), | ||
| companyLogo: z.string().optional(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add URL validation to the companyLogo field. The Apply this diff: - companyLogo: z.string().optional(),
+ companyLogo: z.string().url("Provide a valid logo URL").optional().or(z.literal("")),
🤖 Prompt for AI Agents |
||
| remote: z.boolean().optional().default(false), | ||
| relocation: z.boolean().optional().default(false), | ||
| visa_sponsorship: z.boolean().optional().default(false), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File input should be reset after upload to allow re-uploading the same file.
After a successful (or failed) upload, the file input retains its value. If a user attempts to upload the same file again, the
onChangeevent won't fire because the input value hasn't changed.Add input reset after setting upload status:
try { const res = await getUploadUrl({ size, type, uploadType: "uploads", }); const signedUrl = res?.data; if (!signedUrl) { setUploadStatus("error"); + if (fileInputRef.current) fileInputRef.current.value = ""; return toast.error( "Something went wrong uploading the logo, please retry.", ); } const { fileLocation } = await uploadFile(signedUrl, file); if (!fileLocation) { setUploadStatus("error"); + if (fileInputRef.current) fileInputRef.current.value = ""; return toast.error( "Something went wrong uploading the logo, please retry.", ); } setUploadStatus("success"); setImgUrl(fileLocation); + if (fileInputRef.current) fileInputRef.current.value = ""; toast.success("Company logo uploaded successfully!"); } catch (error) { setUploadStatus("error"); + if (fileInputRef.current) fileInputRef.current.value = ""; toast.error(