Skip to content

Commit

Permalink
fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
devsharmagit committed Nov 3, 2024
1 parent 26c548b commit af8187c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/actions/hr.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export const createHR = withSession<
data: {
email: email,
password: hashedPassword,
isVerified: true,
name: name,
role: 'HR',
companyId: company.id,
emailVerified: new Date(),
},
});

Expand Down
33 changes: 21 additions & 12 deletions src/components/AddHRForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
FormField,
FormItem,
FormLabel,
FormMessage,
} from '@/components/ui/form';
import { useToast } from './ui/use-toast';
import { uploadFileAction } from '@/actions/upload-to-cdn';
Expand Down Expand Up @@ -155,14 +156,17 @@ const AddHRForm = () => {
name="name"
render={({ field }) => (
<FormItem>
<FormLabel className="font-medium"> Name *</FormLabel>
<FormLabel className="block text-sm mb-1 dark:text-gray-400 font-normal xl:text-base ">
Name *
</FormLabel>
<FormControl>
<Input
{...field}
className="w-full dark:bg-gray-800 border-none text-white"
className="w-full dark:bg-gray-800 border-none dark:text-white"
placeholder="Name"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
Expand All @@ -171,29 +175,32 @@ const AddHRForm = () => {
name="email"
render={({ field }) => (
<FormItem>
<FormLabel className="font-medium"> Email *</FormLabel>
<FormLabel className="block text-sm mb-1 dark:text-gray-400 font-normal xl:text-base">
Email *
</FormLabel>
<FormControl>
<Input
{...field}
className="w-full dark:bg-gray-800 border-none text-white"
className="w-full dark:bg-gray-800 border-none dark:text-white"
placeholder="[email protected]"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>

<div className="dark:bg-gray-900 bg-gray-100 w-full p-6 rounded-lg mx-auto dark:text-gray-300">
<h2 className="text-lg font-semibold mb-4 dark:text-gray-300">
Company
<h2 className="text-2xl font-semibold mb-4 dark:text-gray-300 ">
Company Details
</h2>

{/* Logo Upload Section */}
<div className="flex flex-col items-center mb-6">
<div className="relative">
<div
className="w-20 h-20 dark:bg-gray-700 bg-gray-300 border border-dashed border-gray-500 rounded-md flex items-center justify-center cursor-pointer mb-2"
className="w-20 h-20 dark:bg-gray-700 bg-gray-300 border border-dashed border-gray-500 rounded-md flex items-center justify-center cursor-pointer mb-2"
onClick={handleClick}
>
{previewImg ? (
Expand Down Expand Up @@ -226,7 +233,7 @@ const AddHRForm = () => {
accept="image/*"
onChange={handleFileChange}
/>
<p className="text-sm text-gray-500 text-center">
<p className="text-sm dark:text-gray-400 text-gray-500 text-center font-normal xl:text-base">
Click the avatar to change or upload your company logo
</p>
</div>
Expand All @@ -239,22 +246,23 @@ const AddHRForm = () => {
name="companyName"
render={({ field }) => (
<FormItem>
<FormLabel className="block text-sm mb-1 dark:text-gray-400 font-normal">
<FormLabel className="block text-sm mb-1 dark:text-gray-400 font-normal xl:text-base">
Company Name *
</FormLabel>
<FormControl>
<Input
{...field}
className="w-full dark:bg-gray-800 border-none text-white"
className="w-full dark:bg-gray-800 border-none dark:text-white"
placeholder="Company Name"
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div className="mt-5">
<label className="block text-sm mb-1 dark:text-gray-400">
Company bio *
<label className="block text-sm mb-1 dark:text-gray-400 font-normal xl:text-base">
Company bio
</label>
</div>
<div className="dark:bg-gray-800 rounded-xl mt-2 overflow-hidden">
Expand All @@ -264,6 +272,7 @@ const AddHRForm = () => {
onDescriptionChange={handleDescriptionChange}
placeholder={'Tell us about your company'}
/>
<FormMessage />
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/components/HRPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ const HRPassword = ({
}
return (
<>
<div className="dark:bg-gray-900 bg-gray-100 w-full dark:text-gray-300 p-6 rounded-lg space-y-7">
<div className="dark:bg-gray-900 bg-gray-100 w-full dark:text-gray-300 p-6 rounded-lg space-y-7 xl:text-lg">
<p> HR Created Successfully! Below are the details</p>
<div className="w-full dark:bg-gray-800 border-none text-white rounded-lg p-4 flex flex-col gap-2">
<div className="w-full dark:bg-gray-800 border-none dark:text-white bg-gray-200 rounded-lg p-4 flex flex-col gap-2 xl:text-lg">
<p>Password</p>
<div className="flex items-center gap-3">
<Input
value={password}
type={isPasswordVisible ? 'text' : 'password'}
className="xl:text-base"
/>
<div className="flex">
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/lib/validators/hr.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from 'zod';

export const HRPostSchema = z.object({
name: z.string().min(1, 'Name is required'),
email: z.string().email('Invalid email').min(1, 'Email is required'),
email: z.string().min(1, 'Email is required').email('Invalid email'),
companyBio: z.string().min(1, 'Company Bio is required'),
companyLogo: z.string().min(1, 'Company Logo is Required'),
companyName: z.string().min(1, 'Company Name is Required'),
Expand Down

0 comments on commit af8187c

Please sign in to comment.