Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

add job form - controllers

Khuram Niaze22ad781f11a
diff --git a/package-lock.json b/package-lock.json
index 8edc4d0..eb65057 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -17,18 +17,22 @@
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
+ "@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
+ "@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-tooltip": "^1.0.7",
"bcryptjs": "^2.4.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
+ "date-fns": "^3.6.0",
"lucide-react": "^0.379.0",
"next": "14.2.3",
"next-auth": "^5.0.0-beta.18",
"next-themes": "^0.3.0",
"react": "^18",
+ "react-day-picker": "^8.10.1",
"react-dom": "^18",
"react-hook-form": "^7.51.5",
"tailwind-merge": "^2.3.0",
@@ -1102,6 +1106,43 @@
}
}
},
+ "node_modules/@radix-ui/react-popover": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.0.7.tgz",
+ "integrity": "sha512-shtvVnlsxT6faMnK/a7n0wptwBD23xc1Z5mdrtKLwVEfsEMXodS0r5s0/g5P0hX//EKYZS2sxUjqfzlg52ZSnQ==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/primitive": "1.0.1",
+ "@radix-ui/react-compose-refs": "1.0.1",
+ "@radix-ui/react-context": "1.0.1",
+ "@radix-ui/react-dismissable-layer": "1.0.5",
+ "@radix-ui/react-focus-guards": "1.0.1",
+ "@radix-ui/react-focus-scope": "1.0.4",
+ "@radix-ui/react-id": "1.0.1",
+ "@radix-ui/react-popper": "1.1.3",
+ "@radix-ui/react-portal": "1.0.4",
+ "@radix-ui/react-presence": "1.0.1",
+ "@radix-ui/react-primitive": "1.0.3",
+ "@radix-ui/react-slot": "1.0.2",
+ "@radix-ui/react-use-controllable-state": "1.0.1",
+ "aria-hidden": "^1.1.1",
+ "react-remove-scroll": "2.5.5"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0",
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-popper": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.3.tgz",
@@ -1320,6 +1361,40 @@
}
}
},
+ "node_modules/@radix-ui/react-toast": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@radix-ui/react-toast/-/react-toast-1.1.5.tgz",
+ "integrity": "sha512-fRLn227WHIBRSzuRzGJ8W+5YALxofH23y0MlPLddaIpLpCDqdE0NZlS2NRQDRiptfxDeeCjgFIpexB1/zkxDlw==",
+ "dependencies": {
+ "@babel/runtime": "^7.13.10",
+ "@radix-ui/primitive": "1.0.1",
+ "@radix-ui/react-collection": "1.0.3",
+ "@radix-ui/react-compose-refs": "1.0.1",
+ "@radix-ui/react-context": "1.0.1",
+ "@radix-ui/react-dismissable-layer": "1.0.5",
+ "@radix-ui/react-portal": "1.0.4",
+ "@radix-ui/react-presence": "1.0.1",
+ "@radix-ui/react-primitive": "1.0.3",
+ "@radix-ui/react-use-callback-ref": "1.0.1",
+ "@radix-ui/react-use-controllable-state": "1.0.1",
+ "@radix-ui/react-use-layout-effect": "1.0.1",
+ "@radix-ui/react-visually-hidden": "1.0.3"
+ },
+ "peerDependencies": {
+ "@types/react": "*",
+ "@types/react-dom": "*",
+ "react": "^16.8 || ^17.0 || ^18.0",
+ "react-dom": "^16.8 || ^17.0 || ^18.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@radix-ui/react-tooltip": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.7.tgz",
@@ -2565,6 +2640,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/date-fns": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz",
+ "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/kossnocorp"
+ }
+ },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
@@ -5145,6 +5229,19 @@
"node": ">=0.10.0"
}
},
+ "node_modules/react-day-picker": {
+ "version": "8.10.1",
+ "resolved": "https://registry.npmjs.org/react-day-picker/-/react-day-picker-8.10.1.tgz",
+ "integrity": "sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==",
+ "funding": {
+ "type": "individual",
+ "url": "https://github.com/sponsors/gpbl"
+ },
+ "peerDependencies": {
+ "date-fns": "^2.28.0 || ^3.0.0",
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/react-dom": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
diff --git a/package.json b/package.json
index e8c7b83..76edfcf 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "dev": "next dev",
+ "dev": "next dev -p 3002",
"build": "next build",
"start": "next start",
"lint": "next lint",
@@ -19,18 +19,22 @@
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-label": "^2.0.2",
+ "@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
+ "@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-tooltip": "^1.0.7",
"bcryptjs": "^2.4.3",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
+ "date-fns": "^3.6.0",
"lucide-react": "^0.379.0",
"next": "14.2.3",
"next-auth": "^5.0.0-beta.18",
"next-themes": "^0.3.0",
"react": "^18",
+ "react-day-picker": "^8.10.1",
"react-dom": "^18",
"react-hook-form": "^7.51.5",
"tailwind-merge": "^2.3.0",
diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx
index 716b93b..629faa7 100644
--- a/src/app/dashboard/layout.tsx
+++ b/src/app/dashboard/layout.tsx
@@ -1,5 +1,6 @@
import Header from "@/components/Header";
import Sidebar from "@/components/Sidebar";
+import { Toaster } from "@/components/ui/toaster";
export default function RootLayout({
children,
@@ -14,6 +15,7 @@ export default function RootLayout({
<main className="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-4 lg:grid-cols-3 xl:grid-cols-3">
{children}
</main>
+ <Toaster />
</div>
</div>
);
diff --git a/src/app/dashboard/myjobs/page.tsx b/src/app/dashboard/myjobs/page.tsx
index 68fc3a4..e9edd7a 100644
--- a/src/app/dashboard/myjobs/page.tsx
+++ b/src/app/dashboard/myjobs/page.tsx
@@ -80,7 +80,8 @@ function MyJobs() {
</Button>
</DialogTrigger>
<DialogContent
- className="lg:max-w-screen-lg overflow-y-scroll lg:max-h-screen"
+ className="lg:max-w-screen-lg lg:max-h-screen"
+ // className="overflow-y-auto sm:overflow-y-scroll md:overflow-y-auto lg:overflow-y-scroll"
// className="sm:max-w-[425px]"
>
<AddJob />
diff --git a/src/components/AddJob.tsx b/src/components/AddJob.tsx
index ff3ee00..8542c5b 100644
--- a/src/components/AddJob.tsx
+++ b/src/components/AddJob.tsx
@@ -1,3 +1,4 @@
+"use client";
import { Button } from "@/components/ui/button";
import {
DialogClose,
@@ -5,6 +6,14 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "./ui/textarea";
@@ -16,162 +25,326 @@ import {
SelectTrigger,
SelectValue,
} from "./ui/select";
+import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
+import { cn } from "@/lib/utils";
+import { Calendar as CalendarIcon } from "lucide-react";
+import { addDays, format } from "date-fns";
+import { Calendar } from "./ui/calendar";
+import { useState } from "react";
+import { z } from "zod";
+import { AddJobFormSchema } from "@/models/addJobForm.schema";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { toast } from "./ui/use-toast";
export function AddJob() {
+ const [date, setDate] = useState<Date>();
+
+ const form = useForm<z.infer<typeof AddJobFormSchema>>({
+ resolver: zodResolver(AddJobFormSchema),
+ // mode: "onChange",
+ defaultValues: {
+ dateApplied: new Date(),
+ status: "draft",
+ },
+ });
+
+ function onSubmit(data: z.infer<typeof AddJobFormSchema>) {
+ console.log("add job form data: ", data);
+ toast({
+ title: "You submitted the following values:",
+ description: (
+ <pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
+ <code className="text-white">{JSON.stringify(data, null, 2)}</code>
+ </pre>
+ ),
+ });
+ }
+
return (
<>
<DialogHeader>
<DialogTitle>Add Job</DialogTitle>
</DialogHeader>
- <form className="grid grid-cols-1 md:grid-cols-2 gap-4 p-4">
- {/* Job Title */}
- <div className="flex flex-col">
- <Label htmlFor="title" className="mb-1">
- Job Title
- </Label>
- <Input
- id="title"
- name="title"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Company */}
- <div className="flex flex-col">
- <Label htmlFor="company" className="mb-1">
- Company
- </Label>
- <Input
- id="company"
- name="company"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Location */}
- <div className="flex flex-col">
- <Label htmlFor="location" className="mb-1">
- Location
- </Label>
- <Input
- id="location"
- name="location"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Job Source */}
- <div className="flex flex-col">
- <Label htmlFor="source" className="mb-1">
- Source
- </Label>
- <Input
- id="source"
- name="source"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Status */}
- <div className="flex flex-col">
- <Label htmlFor="status" className="mb-1">
- Status
- </Label>
- <Select defaultValue="draft">
- <SelectTrigger
- id="status"
- aria-label="Select status"
- className="w-[180px]"
+ <Form {...form}>
+ <form
+ onSubmit={form.handleSubmit(onSubmit)}
+ className="grid grid-cols-1 md:grid-cols-2 gap-4 p-4"
+ >
+ {/* Job Title */}
+ <div>
+ <FormField
+ control={form.control}
+ name="title"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Job Title</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Company */}
+ <div>
+ <FormField
+ control={form.control}
+ name="company"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Company</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Location */}
+ <div>
+ <FormField
+ control={form.control}
+ name="location"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Location</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Job Source */}
+ <div>
+ <FormField
+ control={form.control}
+ name="source"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Source</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Status */}
+ <div>
+ <FormField
+ control={form.control}
+ name="status"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Status</FormLabel>
+ <Select
+ onValueChange={field.onChange}
+ defaultValue={field.value}
+ name="status"
+ >
+ <FormControl>
+ <SelectTrigger
+ aria-label="Select status"
+ className="w-[180px]"
+ >
+ <SelectValue placeholder="Select job status" />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ <SelectGroup>
+ <SelectItem value="draft">Draft</SelectItem>
+ <SelectItem value="applied">Applied</SelectItem>
+ <SelectItem value="interview">Interview</SelectItem>
+ <SelectItem value="rejected">Rejected</SelectItem>
+ <SelectItem value="expired">Expired</SelectItem>
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Due Date */}
+ <div>
+ <FormField
+ control={form.control}
+ name="dueDate"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Due Date</FormLabel>
+ <Popover>
+ <PopoverTrigger asChild>
+ <FormControl>
+ <Button
+ variant={"outline"}
+ className={cn(
+ "w-[280px] pl-3 text-left font-normal",
+ !field.value && "text-muted-foreground"
+ )}
+ >
+ {field.value ? (
+ format(field.value, "PPP")
+ ) : (
+ <span>Pick a date</span>
+ )}
+ <CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
+ </Button>
+ </FormControl>
+ </PopoverTrigger>
+ <PopoverContent className="w-auto p-0" align="start">
+ {/* <Select
+ onValueChange={(value) =>
+ setDate(addDays(new Date(), parseInt(value)))
+ }
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select" />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ <SelectItem value="0">Today</SelectItem>
+ <SelectItem value="1">Tomorrow</SelectItem>
+ <SelectItem value="3">In 3 days</SelectItem>
+ <SelectItem value="7">In a week</SelectItem>
+ </SelectContent>
+ </Select> */}
+ <Calendar
+ mode="single"
+ selected={field.value}
+ onSelect={field.onChange}
+ /* onSelect={() => {
+ setCalendarOpen(false);
+ }} */
+ disabled={(date) =>
+ date > new Date() || date < new Date("1900-01-01")
+ }
+ initialFocus
+ />
+ </PopoverContent>
+ </Popover>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Date Applied */}
+ <div className="flex flex-col">
+ <FormField
+ control={form.control}
+ name="dateApplied"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Date Applied</FormLabel>
+ <Popover>
+ <PopoverTrigger asChild>
+ <FormControl>
+ <Button
+ variant={"outline"}
+ className={cn(
+ "w-[280px] pl-3 text-left font-normal",
+ !field.value && "text-muted-foreground"
+ )}
+ >
+ {field.value ? (
+ format(field.value, "PPP")
+ ) : (
+ <span>Pick a date</span>
+ )}
+ <CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
+ </Button>
+ </FormControl>
+ </PopoverTrigger>
+ <PopoverContent className="w-auto p-0" align="start">
+ {/* <Select
+ onValueChange={(value) =>
+ setDate(addDays(new Date(), parseInt(value)))
+ }
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select" />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ <SelectItem value="0">Today</SelectItem>
+ <SelectItem value="1">Tomorrow</SelectItem>
+ <SelectItem value="3">In 3 days</SelectItem>
+ <SelectItem value="7">In a week</SelectItem>
+ </SelectContent>
+ </Select> */}
+ <Calendar
+ mode="single"
+ selected={field.value}
+ onSelect={field.onChange}
+ /* onSelect={() => {
+ setCalendarOpen(false);
+ }} */
+ disabled={(date) =>
+ date > new Date() || date < new Date("1900-01-01")
+ }
+ initialFocus
+ />
+ </PopoverContent>
+ </Popover>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Salary Range */}
+ <div>
+ <FormField
+ control={form.control}
+ name="salaryRange"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Salary Range</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ {/* Job Description */}
+ <div className="md:col-span-2">
+ <FormField
+ control={form.control}
+ name="jobDescription"
+ render={({ field }) => (
+ <FormItem className="flex flex-col">
+ <FormLabel>Job Description</FormLabel>
+ <FormControl>
+ <Textarea
+ className="h-36 overflow-auto"
+ placeholder="Copy and paste you job description here."
+ {...field}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ <div className="md:col-span-2">
+ <DialogFooter
+ // className="md:col-span
>
- <SelectValue placeholder="Select job status" />
- </SelectTrigger>
- <SelectContent>
- <SelectGroup>
- <SelectItem value="draft">Draft</SelectItem>
- <SelectItem value="applied">Applied</SelectItem>
- <SelectItem value="interview">Interview</SelectItem>
- <SelectItem value="rejected">Rejected</SelectItem>
- <SelectItem value="expired">Expired</SelectItem>
- </SelectGroup>
- </SelectContent>
- </Select>
- </div>
-
- {/* Due Date */}
- <div className="flex flex-col">
- <Label htmlFor="due_date" className="mb-1">
- Due Date
- </Label>
- <Input
- id="due_date"
- name="due_date"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Date Applied */}
- <div className="flex flex-col">
- <Label htmlFor="date_applied" className="mb-1">
- Date Applied
- </Label>
- <Input
- id="date_applied"
- name="date_applied"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Salary Range */}
- <div className="flex flex-col">
- <Label htmlFor="salary_range" className="mb-1">
- Salary Range
- </Label>
- <Input
- id="salary_range"
- name="salary_range"
- type="text"
- className="p-2 border rounded"
- />
- </div>
-
- {/* Job Description */}
- <div className="flex flex-col md:col-span-2">
- <Label htmlFor="message" className="mb-1">
- Job Description
- </Label>
- <Textarea
- className="h-36 overflow-auto"
- placeholder="Paste you job description here."
- id="message"
- />
- </div>
- </form>
- {/* <div className="grid gap-4 py-4">
- <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="title" className="text-right">
- Job Title
- </Label>
- <Input id="title" className="col-span-3" />
- </div>
- <div className="grid grid-cols-4 items-center gap-4">
- <Label htmlFor="company" className="text-right">
- Company
- </Label>
- <Input id="company" className="col-span-3" />
- </div>
- </div> */}
- <DialogFooter>
- <DialogClose>
- <Button variant="outline">Cancel</Button>
- </DialogClose>
- <Button type="submit">Save</Button>
- </DialogFooter>
+ <DialogClose>
+ <Button variant="outline" className="mt-2 md:mt-0 w-full">
+ Cancel
+ </Button>
+ </DialogClose>
+ <Button type="submit">Save</Button>
+ </DialogFooter>
+ </div>
+ </form>
+ </Form>
</>
);
}
diff --git a/src/components/DatePickerWithPresets.tsx b/src/components/DatePickerWithPresets.tsx
new file mode 100644
index 0000000..203bb6e
--- /dev/null
+++ b/src/components/DatePickerWithPresets.tsx
@@ -0,0 +1,62 @@
+"use client";
+
+import * as React from "react";
+import { addDays, format } from "date-fns";
+import { Calendar as CalendarIcon } from "lucide-react";
+
+import { cn } from "@/lib/utils";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+
+export function DatePickerWithPresets() {
+ const [date, setDate] = React.useState<Date>();
+
+ return (
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ variant={"outline"}
+ className={cn(
+ "w-[280px] justify-start text-left font-normal",
+ !date && "text-muted-foreground"
+ )}
+ >
+ <CalendarIcon className="mr-2 h-4 w-4" />
+ {date ? format(date, "PPP") : <span>Pick a date</span>}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="flex w-auto flex-col space-y-2 p-2">
+ <Select
+ onValueChange={(value) =>
+ setDate(addDays(new Date(), parseInt(value)))
+ }
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="Select" />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ <SelectItem value="0">Today</SelectItem>
+ <SelectItem value="1">Tomorrow</SelectItem>
+ <SelectItem value="3">In 3 days</SelectItem>
+ <SelectItem value="7">In a week</SelectItem>
+ </SelectContent>
+ </Select>
+ <div className="rounded-md border">
+ <Calendar mode="single" selected={date} onSelect={setDate} />
+ </div>
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/src/components/SigninForm.tsx b/src/components/SigninForm.tsx
index 87571f7..8b992a7 100644
--- a/src/components/SigninForm.tsx
+++ b/src/components/SigninForm.tsx
@@ -16,26 +16,11 @@ import { Button } from "./ui/button";
import { Input } from "./ui/input";
import { useState } from "react";
import { useRouter } from "next/navigation";
-
-const FormSchema = z.object({
- email: z
- .string({
- required_error: "Email is required.",
- })
- .min(3, {
- message: "Email must be at least 3 characters.",
- })
- .email("Please enter a valid email."),
- password: z
- .string({
- required_error: "Please enter your password.",
- })
- .min(1),
-});
+import { SigninFormSchema } from "@/models/signinForm.schema";
function SigninForm() {
- const form = useForm<z.infer<typeof FormSchema>>({
- resolver: zodResolver(FormSchema),
+ const form = useForm<z.infer<typeof SigninFormSchema>>({
+ resolver: zodResolver(SigninFormSchema),
mode: "onChange",
});
@@ -44,14 +29,17 @@ function SigninForm() {
const { pending } = useFormStatus();
- const getFormData = (object: Object) =>
- Object.keys(object).reduce((formData, key) => {
- formData.append(key, object[key as keyof object]);
- return formData;
- }, new FormData());
+ // const getFormData = (object: Object) =>
+ // Object.keys(object).reduce((formData, key) => {
+ // formData.append(key, object[key as keyof object]);
+ // return formData;
+ // }, new FormData());
- const onSubmit = async (data: z.infer<typeof FormSchema>) => {
- const formData = getFormData(data);
+ const onSubmit = async (data: z.infer<typeof SigninFormSchema>) => {
+ // const formData = getFormData(data);
+ const formData = new FormData();
+ formData.set("email", data.email);
+ formData.set("password", data.password);
const errorResponse = await authenticate("", formData);
if (!!errorResponse) {
setError(errorResponse);
diff --git a/src/components/ui/calendar.tsx b/src/components/ui/calendar.tsx
new file mode 100644
index 0000000..2f02434
--- /dev/null
+++ b/src/components/ui/calendar.tsx
@@ -0,0 +1,66 @@
+"use client"
+
+import * as React from "react"
+import { ChevronLeft, ChevronRight } from "lucide-react"
+import { DayPicker } from "react-day-picker"
+
+import { cn } from "@/lib/utils"
+import { buttonVariants } from "@/components/ui/button"
+
+export type CalendarProps = React.ComponentProps<typeof DayPicker>
+
+function Calendar({
+ className,
+ classNames,
+ showOutsideDays = true,
+ ...props
+}: CalendarProps) {
+ return (
+ <DayPicker
+ showOutsideDays={showOutsideDays}
+ className={cn("p-3", className)}
+ classNames={{
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
+ month: "space-y-4",
+ caption: "flex justify-center pt-1 relative items-center",
+ caption_label: "text-sm font-medium",
+ nav: "space-x-1 flex items-center",
+ nav_button: cn(
+ buttonVariants({ variant: "outline" }),
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
+ ),
+ nav_button_previous: "absolute left-1",
+ nav_button_next: "absolute right-1",
+ table: "w-full border-collapse space-y-1",
+ head_row: "flex",
+ head_cell:
+ "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
+ row: "flex w-full mt-2",
+ cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
+ day: cn(
+ buttonVariants({ variant: "ghost" }),
+ "h-9 w-9 p-0 font-normal aria-selected:opacity-100"
+ ),
+ day_range_end: "day-range-end",
+ day_selected:
+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
+ day_today: "bg-accent text-accent-foreground",
+ day_outside:
+ "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
+ day_disabled: "text-muted-foreground opacity-50",
+ day_range_middle:
+ "aria-selected:bg-accent aria-selected:text-accent-foreground",
+ day_hidden: "invisible",
+ ...classNames,
+ }}
+ components={{
+ IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,
+ IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,
+ }}
+ {...props}
+ />
+ )
+}
+Calendar.displayName = "Calendar"
+
+export { Calendar }
diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx
index 01ff19c..42b363d 100644
--- a/src/components/ui/dialog.tsx
+++ b/src/components/ui/dialog.tsx
@@ -1,18 +1,18 @@
-"use client"
+"use client";
-import * as React from "react"
-import * as DialogPrimitive from "@radix-ui/react-dialog"
-import { X } from "lucide-react"
+import * as React from "react";
+import * as DialogPrimitive from "@radix-ui/react-dialog";
+import { X } from "lucide-react";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
-const Dialog = DialogPrimitive.Root
+const Dialog = DialogPrimitive.Root;
-const DialogTrigger = DialogPrimitive.Trigger
+const DialogTrigger = DialogPrimitive.Trigger;
-const DialogPortal = DialogPrimitive.Portal
+const DialogPortal = DialogPrimitive.Portal;
-const DialogClose = DialogPrimitive.Close
+const DialogClose = DialogPrimitive.Close;
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
@@ -26,8 +26,8 @@ const DialogOverlay = React.forwardRef<
)}
{...props}
/>
-))
-DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
+));
+DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
@@ -50,8 +50,8 @@ const DialogContent = React.forwardRef<
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
-))
-DialogContent.displayName = DialogPrimitive.Content.displayName
+));
+DialogContent.displayName = DialogPrimitive.Content.displayName;
const DialogHeader = ({
className,
@@ -64,8 +64,8 @@ const DialogHeader = ({
)}
{...props}
/>
-)
-DialogHeader.displayName = "DialogHeader"
+);
+DialogHeader.displayName = "DialogHeader";
const DialogFooter = ({
className,
@@ -78,8 +78,8 @@ const DialogFooter = ({
)}
{...props}
/>
-)
-DialogFooter.displayName = "DialogFooter"
+);
+DialogFooter.displayName = "DialogFooter";
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
@@ -93,8 +93,8 @@ const DialogTitle = React.forwardRef<
)}
{...props}
/>
-))
-DialogTitle.displayName = DialogPrimitive.Title.displayName
+));
+DialogTitle.displayName = DialogPrimitive.Title.displayName;
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
@@ -105,8 +105,8 @@ const DialogDescription = React.forwardRef<
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
-))
-DialogDescription.displayName = DialogPrimitive.Description.displayName
+));
+DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
@@ -119,4 +119,4 @@ export {
DialogFooter,
DialogTitle,
DialogDescription,
-}
+};
diff --git a/src/components/ui/popover.tsx b/src/components/ui/popover.tsx
new file mode 100644
index 0000000..a0ec48b
--- /dev/null
+++ b/src/components/ui/popover.tsx
@@ -0,0 +1,31 @@
+"use client"
+
+import * as React from "react"
+import * as PopoverPrimitive from "@radix-ui/react-popover"
+
+import { cn } from "@/lib/utils"
+
+const Popover = PopoverPrimitive.Root
+
+const PopoverTrigger = PopoverPrimitive.Trigger
+
+const PopoverContent = React.forwardRef<
+ React.ElementRef<typeof PopoverPrimitive.Content>,
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
+>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
+ <PopoverPrimitive.Portal>
+ <PopoverPrimitive.Content
+ ref={ref}
+ align={align}
+ sideOffset={sideOffset}
+ className={cn(
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ className
+ )}
+ {...props}
+ />
+ </PopoverPrimitive.Portal>
+))
+PopoverContent.displayName = PopoverPrimitive.Content.displayName
+
+export { Popover, PopoverTrigger, PopoverContent }
diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsx
new file mode 100644
index 0000000..521b94b
--- /dev/null
+++ b/src/components/ui/toast.tsx
@@ -0,0 +1,129 @@
+"use client"
+
+import * as React from "react"
+import * as ToastPrimitives from "@radix-ui/react-toast"
+import { cva, type VariantProps } from "class-variance-authority"
+import { X } from "lucide-react"
+
+import { cn } from "@/lib/utils"
+
+const ToastProvider = ToastPrimitives.Provider
+
+const ToastViewport = React.forwardRef<
+ React.ElementRef<typeof ToastPrimitives.Viewport>,
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
+>(({ className, ...props }, ref) => (
+ <ToastPrimitives.Viewport
+ ref={ref}
+ className={cn(
+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
+ className
+ )}
+ {...props}
+ />
+))
+ToastViewport.displayName = ToastPrimitives.Viewport.displayName
+
+const toastVariants = cva(
+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
+ {
+ variants: {
+ variant: {
+ default: "border bg-background text-foreground",
+ destructive:
+ "destructive group border-destructive bg-destructive text-destructive-foreground",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ }
+)
+
+const Toast = React.forwardRef<
+ React.ElementRef<typeof ToastPrimitives.Root>,
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
+ VariantProps<typeof toastVariants>
+>(({ className, variant, ...props }, ref) => {
+ return (
+ <ToastPrimitives.Root
+ ref={ref}
+ className={cn(toastVariants({ variant }), className)}
+ {...props}
+ />
+ )
+})
+Toast.displayName = ToastPrimitives.Root.displayName
+
+const ToastAction = React.forwardRef<
+ React.ElementRef<typeof ToastPrimitives.Action>,
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
+>(({ className, ...props }, ref) => (
+ <ToastPrimitives.Action
+ ref={ref}
+ className={cn(
+ "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",
+ className
+ )}
+ {...props}
+ />
+))
+ToastAction.displayName = ToastPrimitives.Action.displayName
+
+const ToastClose = React.forwardRef<
+ React.ElementRef<typeof ToastPrimitives.Close>,
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
+>(({ className, ...props }, ref) => (
+ <ToastPrimitives.Close
+ ref={ref}
+ className={cn(
+ "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
+ className
+ )}
+ toast-close=""
+ {...props}
+ >
+ <X className="h-4 w-4" />
+ </ToastPrimitives.Close>
+))
+ToastClose.displayName = ToastPrimitives.Close.displayName
+
+const ToastTitle = React.forwardRef<
+ React.ElementRef<typeof ToastPrimitives.Title>,
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
+>(({ className, ...props }, ref) => (
+ <ToastPrimitives.Title
+ ref={ref}
+ className={cn("text-sm font-semibold", className)}
+ {...props}
+ />
+))
+ToastTitle.displayName = ToastPrimitives.Title.displayName
+
+const ToastDescription = React.forwardRef<
+ React.ElementRef<typeof ToastPrimitives.Description>,
+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
+>(({ className, ...props }, ref) => (
+ <ToastPrimitives.Description
+ ref={ref}
+ className={cn("text-sm opacity-90", className)}
+ {...props}
+ />
+))
+ToastDescription.displayName = ToastPrimitives.Description.displayName
+
+type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
+
+type ToastActionElement = React.ReactElement<typeof ToastAction>
+
+export {
+ type ToastProps,
+ type ToastActionElement,
+ ToastProvider,
+ ToastViewport,
+ Toast,
+ ToastTitle,
+ ToastDescription,
+ ToastClose,
+ ToastAction,
+}
diff --git a/src/components/ui/toaster.tsx b/src/components/ui/toaster.tsx
new file mode 100644
index 0000000..e223385
--- /dev/null
+++ b/src/components/ui/toaster.tsx
@@ -0,0 +1,35 @@
+"use client"
+
+import {
+ Toast,
+ ToastClose,
+ ToastDescription,
+ ToastProvider,
+ ToastTitle,
+ ToastViewport,
+} from "@/components/ui/toast"
+import { useToast } from "@/components/ui/use-toast"
+
+export function Toaster() {
+ const { toasts } = useToast()
+
+ return (
+ <ToastProvider>
+ {toasts.map(function ({ id, title, description, action, ...props }) {
+ return (
+ <Toast key={id} {...props}>
+ <div className="grid gap-1">
+ {title && <ToastTitle>{title}</ToastTitle>}
+ {description && (
+ <ToastDescription>{description}</ToastDescription>
+ )}
+ </div>
+ {action}
+ <ToastClose />
+ </Toast>
+ )
+ })}
+ <ToastViewport />
+ </ToastProvider>
+ )
+}
diff --git a/src/components/ui/use-toast.ts b/src/components/ui/use-toast.ts
new file mode 100644
index 0000000..02e111d
--- /dev/null
+++ b/src/components/ui/use-toast.ts
@@ -0,0 +1,194 @@
+"use client"
+
+// Inspired by react-hot-toast library
+import * as React from "react"
+
+import type {
+ ToastActionElement,
+ ToastProps,
+} from "@/components/ui/toast"
+
+const TOAST_LIMIT = 1
+const TOAST_REMOVE_DELAY = 1000000
+
+type ToasterToast = ToastProps & {
+ id: string
+ title?: React.ReactNode
+ description?: React.ReactNode
+ action?: ToastActionElement
+}
+
+const actionTypes = {
+ ADD_TOAST: "ADD_TOAST",
+ UPDATE_TOAST: "UPDATE_TOAST",
+ DISMISS_TOAST: "DISMISS_TOAST",
+ REMOVE_TOAST: "REMOVE_TOAST",
+} as const
+
+let count = 0
+
+function genId() {
+ count = (count + 1) % Number.MAX_SAFE_INTEGER
+ return count.toString()
+}
+
+type ActionType = typeof actionTypes
+
+type Action =
+ | {
+ type: ActionType["ADD_TOAST"]
+ toast: ToasterToast
+ }
+ | {
+ type: ActionType["UPDATE_TOAST"]
+ toast: Partial<ToasterToast>
+ }
+ | {
+ type: ActionType["DISMISS_TOAST"]
+ toastId?: ToasterToast["id"]
+ }
+ | {
+ type: ActionType["REMOVE_TOAST"]
+ toastId?: ToasterToast["id"]
+ }
+
+interface State {
+ toasts: ToasterToast[]
+}
+
+const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
+
+const addToRemoveQueue = (toastId: string) => {
+ if (toastTimeouts.has(toastId)) {
+ return
+ }
+
+ const timeout = setTimeout(() => {
+ toastTimeouts.delete(toastId)
+ dispatch({
+ type: "REMOVE_TOAST",
+ toastId: toastId,
+ })
+ }, TOAST_REMOVE_DELAY)
+
+ toastTimeouts.set(toastId, timeout)
+}
+
+export const reducer = (state: State, action: Action): State => {
+ switch (action.type) {
+ case "ADD_TOAST":
+ return {
+ ...state,
+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
+ }
+
+ case "UPDATE_TOAST":
+ return {
+ ...state,
+ toasts: state.toasts.map((t) =>
+ t.id === action.toast.id ? { ...t, ...action.toast } : t
+ ),
+ }
+
+ case "DISMISS_TOAST": {
+ const { toastId } = action
+
+ // ! Side effects ! - This could be extracted into a dismissToast() action,
+ // but I'll keep it here for simplicity
+ if (toastId) {
+ addToRemoveQueue(toastId)
+ } else {
+ state.toasts.forEach((toast) => {
+ addToRemoveQueue(toast.id)
+ })
+ }
+
+ return {
+ ...state,
+ toasts: state.toasts.map((t) =>
+ t.id === toastId || toastId === undefined
+ ? {
+ ...t,
+ open: false,
+ }
+ : t
+ ),
+ }
+ }
+ case "REMOVE_TOAST":
+ if (action.toastId === undefined) {
+ return {
+ ...state,
+ toasts: [],
+ }
+ }
+ return {
+ ...state,
+ toasts: state.toasts.filter((t) => t.id !== action.toastId),
+ }
+ }
+}
+
+const listeners: Array<(state: State) => void> = []
+
+let memoryState: State = { toasts: [] }
+
+function dispatch(action: Action) {
+ memoryState = reducer(memoryState, action)
+ listeners.forEach((listener) => {
+ listener(memoryState)
+ })
+}
+
+type Toast = Omit<ToasterToast, "id">
+
+function toast({ ...props }: Toast) {
+ const id = genId()
+
+ const update = (props: ToasterToast) =>
+ dispatch({
+ type: "UPDATE_TOAST",
+ toast: { ...props, id },
+ })
+ const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
+
+ dispatch({
+ type: "ADD_TOAST",
+ toast: {
+ ...props,
+ id,
+ open: true,
+ onOpenChange: (open) => {
+ if (!open) dismiss()
+ },
+ },
+ })
+
+ return {
+ id: id,
+ dismiss,
+ update,
+ }
+}
+
+function useToast() {
+ const [state, setState] = React.useState<State>(memoryState)
+
+ React.useEffect(() => {
+ listeners.push(setState)
+ return () => {
+ const index = listeners.indexOf(setState)
+ if (index > -1) {
+ listeners.splice(index, 1)
+ }
+ }
+ }, [state])
+
+ return {
+ ...state,
+ toast,
+ dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
+ }
+}
+
+export { useToast, toast }
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index d084cca..365058c 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -1,6 +1,6 @@
-import { type ClassValue, clsx } from "clsx"
-import { twMerge } from "tailwind-merge"
+import { type ClassValue, clsx } from "clsx";
+import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs))
+ return twMerge(clsx(inputs));
}
diff --git a/src/models/addJobForm.schema.ts b/src/models/addJobForm.schema.ts
new file mode 100644
index 0000000..a9e942d
--- /dev/null
+++ b/src/models/addJobForm.schema.ts
@@ -0,0 +1,51 @@
+import { z } from "zod";
+
+export const AddJobFormSchema = z.object({
+ title: z
+ .string({
+ required_error: "Job title is required.",
+ })
+ .min(2, {
+ message: "Job title must be at least 2 characters.",
+ }),
+ company: z
+ .string({
+ required_error: "Company name is required.",
+ })
+ .min(2, {
+ message: "Company name must be at least 2 characters.",
+ }),
+ location: z
+ .string({
+ required_error: "Location is required.",
+ })
+ .min(2, {
+ message: "Location name must be at least 2 characters.",
+ }),
+ source: z
+ .string({
+ required_error: "Source is required.",
+ })
+ .min(2, {
+ message: "Source name must be at least 2 characters.",
+ }),
+ status: z
+ .string({
+ required_error: "Status is required.",
+ })
+ .min(2, {
+ message: "Status must be at least 2 characters.",
+ })
+ .default("draft"),
+ dueDate: z.date(),
+ /**
+ * Note: Timezone offsets can be allowed by setting the offset option to true.
+ * z.string().datetime({ offset: true });
+ */
+ //
+ dateApplied: z.date(),
+ salaryRange: z.string(),
+ jobDescription: z.string().min(10, {
+ message: "Job description must be at least 10 characters.",
+ }),
+});
diff --git a/src/models/signinForm.schema.ts b/src/models/signinForm.schema.ts
new file mode 100644
index 0000000..f79ee47
--- /dev/null
+++ b/src/models/signinForm.schema.ts
@@ -0,0 +1,17 @@
+import { z } from "zod";
+
+export const SigninFormSchema = z.object({
+ email: z
+ .string({
+ required_error: "Email is required.",
+ })
+ .min(3, {
+ message: "Email must be at least 3 characters.",
+ })
+ .email("Please enter a valid email."),
+ password: z
+ .string({
+ required_error: "Please enter your password.",
+ })
+ .min(1),
+});