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 companyand company table

Khuram Niaz78b4f0cd0585
diff --git a/package.json b/package.json
index f911907..3613505 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "dev": "next dev -p 3002",
+ "dev": "next dev -p 3000",
"build": "next build",
"start": "next start",
"lint": "next lint",
diff --git a/src/actions/company.actions.ts b/src/actions/company.actions.ts
index 386db5c..feda438 100644
--- a/src/actions/company.actions.ts
+++ b/src/actions/company.actions.ts
@@ -3,39 +3,109 @@ import prisma from "@/lib/db";
import { getCurrentUser } from "@/utils/user.utils";
export const getCompanyList = async (
+ page = 1,
+ limit = 10,
countBy?: string
): Promise<any | undefined> => {
try {
- const companies = await prisma.company.findMany({
- ...(countBy
- ? {
- select: {
- label: true,
- value: true,
- _count: {
- select: {
- jobsApplied: {
- where: {
- Status: {
- value: countBy,
+ const user = await getCurrentUser();
+
+ if (!user) {
+ throw new Error("Not authenticated");
+ }
+ const skip = (page - 1) * limit;
+
+ const [data, total] = await Promise.all([
+ prisma.company.findMany({
+ where: {
+ createdBy: user.id,
+ },
+ skip,
+ take: limit,
+ ...(countBy
+ ? {
+ select: {
+ label: true,
+ value: true,
+ _count: {
+ select: {
+ jobsApplied: {
+ where: {
+ Status: {
+ value: countBy,
+ },
},
},
},
},
},
- },
- }
- : {}),
- // orderBy: {
- // jobsApplied: {
- // _count: "desc",
- // },
- // },
- });
- return companies;
+ }
+ : {}),
+ // orderBy: {
+ // jobsApplied: {
+ // _count: "desc",
+ // },
+ // },
+ }),
+ prisma.company.count({
+ where: {
+ createdBy: user.id,
+ },
+ }),
+ ]);
+ return { data, total };
} catch (error) {
const msg = "Failed to fetch company list. ";
console.error(msg, error);
throw new Error(msg);
}
};
+
+export const getAllCompanies = async (): Promise<any | undefined> => {
+ try {
+ const user = await getCurrentUser();
+
+ if (!user) {
+ throw new Error("Not authenticated");
+ }
+
+ const comapnies = await prisma.company.findMany({
+ where: {
+ createdBy: user.id,
+ },
+ });
+ return comapnies;
+ } catch (error) {
+ const msg = "Failed to fetch all companies. ";
+ console.error(msg, error);
+ throw new Error(msg);
+ }
+};
+
+export const createCompany = async (
+ label: string,
+ logoUrl?: string
+): Promise<any | undefined> => {
+ try {
+ const user = await getCurrentUser();
+
+ if (!user) {
+ throw new Error("Not authenticated");
+ }
+
+ const value = label.trim().toLowerCase();
+
+ // Upsert the name (create if it does not exist, update if it exists)
+ const upsertedName = await prisma.company.upsert({
+ where: { value },
+ update: { label, value, logoUrl },
+ create: { label, value, logoUrl, createdBy: user.id },
+ });
+
+ return upsertedName;
+ } catch (error) {
+ const msg = "Failed to create company. ";
+ console.error(msg, error);
+ throw new Error(msg);
+ }
+};
diff --git a/src/actions/job.actions.ts b/src/actions/job.actions.ts
index 21dcb77..5d088f7 100644
--- a/src/actions/job.actions.ts
+++ b/src/actions/job.actions.ts
@@ -139,33 +139,6 @@ export const getJobDetails = async (
}
};
-export const createCompany = async (
- label: string
-): Promise<any | undefined> => {
- try {
- const user = await getCurrentUser();
-
- if (!user) {
- throw new Error("Not authenticated");
- }
-
- const value = label.trim().toLowerCase();
-
- // Upsert the name (create if it does not exist, update if it exists)
- const upsertedName = await prisma.company.upsert({
- where: { value },
- update: { label },
- create: { label, value, createdBy: user.id },
- });
-
- return upsertedName;
- } catch (error) {
- const msg = "Failed to create company. ";
- console.error(msg, error);
- throw new Error(msg);
- }
-};
-
export const createJobTitle = async (
label: string
): Promise<any | undefined> => {
diff --git a/src/app/api/company/route.ts b/src/app/api/company/route.example.ts
similarity index 100%
rename from src/app/api/company/route.ts
rename to src/app/api/company/route.example.ts
diff --git a/src/app/dashboard/admin/page.tsx b/src/app/dashboard/admin/page.tsx
index b09d2de..025b045 100644
--- a/src/app/dashboard/admin/page.tsx
+++ b/src/app/dashboard/admin/page.tsx
@@ -1,9 +1,7 @@
-import { getCompanyList } from "@/actions/company.actions";
-import CompaniesTable from "@/components/CompaniesTable";
+import CompaniesContainer from "@/components/CompaniesContainer";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
async function AdminPage() {
- const companies = await getCompanyList("applied");
return (
<div className="flex flex-col col-span-3">
<h3 className="text-2xl font-semibold leading-none tracking-tight mb-4">
@@ -16,7 +14,7 @@ async function AdminPage() {
<TabsTrigger value="locations">Locations</TabsTrigger>
</TabsList>
<TabsContent value="companies">
- <CompaniesTable companies={companies} />
+ <CompaniesContainer />
</TabsContent>
<TabsContent value="titles">titles table here</TabsContent>
<TabsContent value="locations">location table here</TabsContent>
diff --git a/src/app/dashboard/myjobs/page.tsx b/src/app/dashboard/myjobs/page.tsx
index d8c9e20..a0d3436 100644
--- a/src/app/dashboard/myjobs/page.tsx
+++ b/src/app/dashboard/myjobs/page.tsx
@@ -7,7 +7,7 @@ import {
getStatusList,
} from "@/actions/job.actions";
import JobsContainer from "@/components/JobsContainer";
-import { getCompanyList } from "@/actions/company.actions";
+import { getAllCompanies, getCompanyList } from "@/actions/company.actions";
export const metadata: Metadata = {
title: "My Jobs | JobSync",
@@ -16,7 +16,7 @@ export const metadata: Metadata = {
async function MyJobs() {
const [statuses, companies, titles, locations, sources] = await Promise.all([
getStatusList(),
- getCompanyList(),
+ getAllCompanies(),
getJobTitleList(),
getJobLocationList(),
getJobSourceList(),
diff --git a/src/components/AddCompany.tsx b/src/components/AddCompany.tsx
new file mode 100644
index 0000000..d905783
--- /dev/null
+++ b/src/components/AddCompany.tsx
@@ -0,0 +1,148 @@
+"use client";
+import { useTransition, useState } from "react";
+import { Button } from "./ui/button";
+import {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "./ui/dialog";
+import { Loader, PlusCircle } from "lucide-react";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { AddCompanyFormSchema } from "@/models/addCompanyForm.schema";
+import { zodResolver } from "@hookform/resolvers/zod";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "./ui/form";
+import { Input } from "./ui/input";
+import { toast } from "./ui/use-toast";
+import { createCompany } from "@/actions/company.actions";
+
+type AddCompanyProps = {
+ reloadCompanies: () => void;
+};
+
+function AddCompany({ reloadCompanies }: AddCompanyProps) {
+ const [dialogOpen, setDialogOpen] = useState(false);
+ const [isPending, startTransition] = useTransition();
+
+ const editJob = false;
+ const pageTitle = "editJob" ? "Edit Company" : "Add Company";
+
+ const form = useForm<z.infer<typeof AddCompanyFormSchema>>({
+ resolver: zodResolver(AddCompanyFormSchema),
+ });
+
+ const { setValue, reset } = form;
+
+ const addCompanyForm = () => {
+ // reset();
+ // resetEditJob();
+ setDialogOpen(true);
+ };
+
+ const onSubmit = (data: z.infer<typeof AddCompanyFormSchema>) => {
+ console.log("form data: ", data);
+ startTransition(async () => {
+ const res = await createCompany(data.company, data.logoUrl);
+ reset();
+ setDialogOpen(false);
+ reloadCompanies();
+ });
+ toast({
+ description: `Company has been ${
+ editJob ? "updated" : "created"
+ } successfully`,
+ });
+ };
+
+ return (
+ <>
+ <Button size="sm" className="h-8 gap-1" onClick={addCompanyForm}>
+ <PlusCircle className="h-3.5 w-3.5" />
+ <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
+ Add Company
+ </span>
+ </Button>
+ <Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
+ <DialogContent className="lg:max-h-screen overflow-y-scroll">
+ <DialogHeader>
+ <DialogTitle>{pageTitle}</DialogTitle>
+ </DialogHeader>
+ <Form {...form}>
+ <form
+ onSubmit={form.handleSubmit(onSubmit)}
+ className="grid grid-cols-1 md:grid-cols-2 gap-4 p-4"
+ >
+ {/* COMPANY NAME */}
+ <div className="md:col-span-2">
+ <FormField
+ control={form.control}
+ name="company"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Company Name</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+
+ {/* COMPANY LOGO URL */}
+ <div className="md:col-span-2">
+ <FormField
+ control={form.control}
+ name="logoUrl"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>Company Logo URL</FormLabel>
+ <FormControl>
+ <Input {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ <div className="md:col-span-2 mt-4">
+ <DialogFooter
+ // className="md:col-span
+ >
+ <DialogClose>
+ <Button
+ type="reset"
+ variant="outline"
+ className="mt-2 md:mt-0 w-full"
+ >
+ Cancel
+ </Button>
+ </DialogClose>
+ <Button type="submit">
+ Save
+ {isPending ? (
+ <Loader className="h-4 w-4 shrink-0 spinner" />
+ ) : null}
+ </Button>
+ </DialogFooter>
+ </div>
+ </form>
+ </Form>
+ </DialogContent>
+ </Dialog>
+ </>
+ );
+}
+
+export default AddCompany;
diff --git a/src/components/ComboBox.tsx b/src/components/ComboBox.tsx
index 35208da..a76abc1 100644
--- a/src/components/ComboBox.tsx
+++ b/src/components/ComboBox.tsx
@@ -22,12 +22,9 @@ import {
import { ScrollArea } from "./ui/scroll-area";
import { useState, useTransition } from "react";
import { delay } from "@/utils/delay";
-import {
- createCompany,
- createJobTitle,
- createLocation,
-} from "@/actions/job.actions";
+import { createJobTitle, createLocation } from "@/actions/job.actions";
import { JobForm } from "@/models/job.model";
+import { createCompany } from "@/actions/company.actions";
interface ComboboxProps {
options: any[];
diff --git a/src/components/CompaniesContainer.tsx b/src/components/CompaniesContainer.tsx
new file mode 100644
index 0000000..569bd84
--- /dev/null
+++ b/src/components/CompaniesContainer.tsx
@@ -0,0 +1,71 @@
+"use client";
+import { useEffect, useState } from "react";
+import AddCompany from "./AddCompany";
+import CompaniesTable from "./CompaniesTable";
+import {
+ Card,
+ CardContent,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+} from "./ui/card";
+import { Company } from "@/models/job.model";
+import { getCompanyList } from "@/actions/company.actions";
+import { APP_CONSTANTS } from "@/lib/constants";
+
+function CompaniesContainer() {
+ const [companies, setCompanies] = useState<Company[]>([]);
+ const [totalCompanies, setTotalCompanies] = useState(0);
+ const [currentPage, setCurrentPage] = useState(1);
+
+ const recordsPerPage = APP_CONSTANTS.RECORDS_PER_PAGE;
+
+ const totalPages = Math.ceil(totalCompanies / recordsPerPage);
+
+ const loadCompanies = async (page: number) => {
+ const { data, total } = await getCompanyList(
+ page,
+ recordsPerPage,
+ "applied"
+ );
+ setCompanies(data);
+ setTotalCompanies(total);
+ };
+
+ const reloadCompanies = () => {
+ loadCompanies(1);
+ };
+
+ useEffect(() => {
+ loadCompanies(currentPage);
+ }, [currentPage]);
+
+ return (
+ <>
+ <div className="col-span-3">
+ <Card x-chunk="dashboard-06-chunk-0">
+ <CardHeader className="flex-row justify-between items-center">
+ <CardTitle>Companies</CardTitle>
+ <div className="flex items-center">
+ <div className="ml-auto flex items-center gap-2">
+ <AddCompany reloadCompanies={reloadCompanies} />
+ </div>
+ </div>
+ </CardHeader>
+ <CardContent>
+ <CompaniesTable
+ companies={companies}
+ currentPage={currentPage}
+ totalPages={totalPages}
+ recordsPerPage={recordsPerPage}
+ totalCompanies={totalCompanies}
+ onPageChange={setCurrentPage}
+ />
+ </CardContent>
+ </Card>
+ </div>
+ </>
+ );
+}
+
+export default CompaniesContainer;
diff --git a/src/components/CompaniesTable.tsx b/src/components/CompaniesTable.tsx
index 94cdef8..158ddc9 100644
--- a/src/components/CompaniesTable.tsx
+++ b/src/components/CompaniesTable.tsx
@@ -4,11 +4,9 @@ import Image from "next/image";
import {
DropdownMenu,
- DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
- DropdownMenuSeparator,
DropdownMenuTrigger,
} from "./ui/dropdown-menu";
import {
@@ -19,114 +17,101 @@ import {
TableHeader,
TableRow,
} from "./ui/table";
-import { File, ListFilter, MoreHorizontal, PlusCircle } from "lucide-react";
-import {
- Card,
- CardContent,
- CardFooter,
- CardHeader,
- CardTitle,
-} from "./ui/card";
-import { Dialog, DialogContent } from "./ui/dialog";
import { Company } from "@/models/job.model";
-import { useState } from "react";
+import { MoreHorizontal } from "lucide-react";
+import { TablePagination } from "./TablePagination";
+
+type CompaniesTableProps = {
+ companies: Company[];
+ currentPage: number;
+ totalPages: number;
+ totalCompanies: number;
+ recordsPerPage: number;
+ onPageChange: (n: number) => void;
+};
+
+function CompaniesTable({
+ companies,
+ currentPage,
+ totalPages,
+ totalCompanies,
+ recordsPerPage,
+ onPageChange,
+}: CompaniesTableProps) {
+ const startPostIndex = (currentPage - 1) * recordsPerPage + 1;
+ const endPostIndex = Math.min(currentPage * recordsPerPage, totalCompanies);
-function CompaniesTable({ companies }: { companies: Company[] }) {
- const [dialogOpen, setDialogOpen] = useState(false);
- const addCompanyForm = () => {
- // reset();
- // resetEditJob();
- setDialogOpen(true);
- };
return (
- <div className="col-span-3">
- <Card x-chunk="dashboard-06-chunk-0">
- <CardHeader className="flex-row justify-between items-center">
- <CardTitle>Companies</CardTitle>
- <div className="flex items-center">
- <div className="ml-auto flex items-center gap-2">
- <Button size="sm" className="h-8 gap-1" onClick={addCompanyForm}>
- <PlusCircle className="h-3.5 w-3.5" />
- <span className="sr-only sm:not-sr-only sm:whitespace-nowrap">
- Add Company
- </span>
- </Button>
- <Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
- <DialogContent className="lg:max-w-screen-lg lg:max-h-screen overflow-y-scroll"></DialogContent>
- </Dialog>
- </div>
- </div>
- </CardHeader>
- <CardContent>
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="hidden w-[100px] sm:table-cell">
- <span className="sr-only">Company Logo</span>
- </TableHead>
- <TableHead>Company Name</TableHead>
- <TableHead>Value</TableHead>
- <TableHead>Jobs Applied</TableHead>
- <TableHead>Actions</TableHead>
- <TableHead>
- <span className="sr-only">Actions</span>
- </TableHead>
+ <>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="hidden w-[100px] sm:table-cell">
+ <span className="sr-only">Company Logo</span>
+ </TableHead>
+ <TableHead>Company Name</TableHead>
+ <TableHead>Value</TableHead>
+ <TableHead>Jobs Applied</TableHead>
+ <TableHead>Actions</TableHead>
+ <TableHead>
+ <span className="sr-only">Actions</span>
+ </TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {companies.map((company: Company) => {
+ return (
+ <TableRow key={company.id}>
+ <TableCell className="hidden sm:table-cell">
+ <Image
+ alt="Company logo"
+ className="aspect-square rounded-md object-cover"
+ height="32"
+ src="/icons/amazon-logo.svg"
+ width="32"
+ />
+ </TableCell>
+ <TableCell className="font-medium">{company.label}</TableCell>
+ <TableCell className="font-medium">{company.value}</TableCell>
+ <TableCell className="font-medium">
+ {company._count?.jobsApplied}
+ </TableCell>
+ <TableCell>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button aria-haspopup="true" size="icon" variant="ghost">
+ <MoreHorizontal className="h-4 w-4" />
+ <span className="sr-only">Toggle menu</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuLabel>Actions</DropdownMenuLabel>
+ <DropdownMenuItem>Edit</DropdownMenuItem>
+ <DropdownMenuItem>Delete</DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </TableCell>
</TableRow>
- </TableHeader>
- <TableBody>
- {companies.map((company: Company) => {
- return (
- <TableRow key={company.id}>
- <TableCell className="hidden sm:table-cell">
- <Image
- alt="Company logo"
- className="aspect-square rounded-md object-cover"
- height="32"
- src="/icons/amazon-logo.svg"
- width="32"
- />
- </TableCell>
- <TableCell className="font-medium">
- {company.label}
- </TableCell>
- <TableCell className="font-medium">
- {company.value}
- </TableCell>
- <TableCell className="font-medium">
- {company._count?.jobsApplied}
- </TableCell>
- <TableCell>
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button
- aria-haspopup="true"
- size="icon"
- variant="ghost"
- >
- <MoreHorizontal className="h-4 w-4" />
- <span className="sr-only">Toggle menu</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuLabel>Actions</DropdownMenuLabel>
- <DropdownMenuItem>Edit</DropdownMenuItem>
- <DropdownMenuItem>Delete</DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- </CardContent>
- <CardFooter>
- <div className="text-xs text-muted-foreground">
- Showing <strong>1-10</strong> of <strong>32</strong> products
- </div>
- </CardFooter>
- </Card>
- </div>
+ );
+ })}
+ </TableBody>
+ </Table>
+ <div className="text-xs text-muted-foreground">
+ Showing{" "}
+ <strong>
+ {startPostIndex} to {endPostIndex}
+ </strong>{" "}
+ of
+ <strong> {totalCompanies}</strong> jobs
+ </div>
+ {totalCompanies > recordsPerPage ? (
+ <TablePagination
+ currentPage={currentPage}
+ totalPages={totalPages}
+ onPageChange={onPageChange}
+ />
+ ) : null}
+ </>
);
}
diff --git a/src/components/JobsContainer.tsx b/src/components/JobsContainer.tsx
index 5575206..d3ddb22 100644
--- a/src/components/JobsContainer.tsx
+++ b/src/components/JobsContainer.tsx
@@ -35,6 +35,7 @@ import {
SelectTrigger,
SelectValue,
} from "./ui/select";
+import { APP_CONSTANTS } from "@/lib/constants";
type MyJobsProps = {
statuses: JobStatus[];
@@ -56,7 +57,7 @@ function JobsContainer({
const [totalJobs, setTotalJobs] = useState(0);
const [editJob, setEditJob] = useState(null);
- const jobsPerPage = 10;
+ const jobsPerPage = APP_CONSTANTS.RECORDS_PER_PAGE;
const totalPages = Math.ceil(totalJobs / jobsPerPage);
diff --git a/src/components/MyJobsTable.tsx b/src/components/MyJobsTable.tsx
index 2aec3fd..840d606 100644
--- a/src/components/MyJobsTable.tsx
+++ b/src/components/MyJobsTable.tsx
@@ -125,7 +125,7 @@ function MyJobsTable({
</TableRow>
</TableHeader>
<TableBody>
- {jobs.map((job: any) => {
+ {jobs.map((job: JobResponse) => {
return (
<TableRow
key={job.id}
@@ -137,11 +137,11 @@ function MyJobsTable({
alt="Company logo"
className="aspect-square rounded-md object-cover"
height="32"
- src="/icons/amazon-logo.svg"
+ src={job.Company?.logoUrl || "/images/jobsync-logo.svg"}
width="32"
/>
</TableCell>
- <TableCell className="hidden md:table-cell">
+ <TableCell className="hidden md:table-cell w-[120px]">
{format(job.appliedDate, "PP")}
</TableCell>
<TableCell className="font-medium">
diff --git a/src/components/RecentJobsCard.tsx b/src/components/RecentJobsCard.tsx
index 8fc157d..64ce0da 100644
--- a/src/components/RecentJobsCard.tsx
+++ b/src/components/RecentJobsCard.tsx
@@ -4,6 +4,8 @@ import { JobResponse } from "@/models/job.model";
import { format } from "date-fns";
export default function RecentJobsCard({ jobs }: { jobs: JobResponse[] }) {
+ debugger;
+
return (
<Card>
<CardHeader>
@@ -12,9 +14,12 @@ export default function RecentJobsCard({ jobs }: { jobs: JobResponse[] }) {
<CardContent className="grid gap-6">
{jobs.map((job) => (
<div key={job.id} className="flex items-center gap-4">
- <Avatar className="hidden h-9 w-9 sm:flex">
- <AvatarImage src="/icons/google-logo.svg" alt="Avatar" />
- <AvatarFallback>MS</AvatarFallback>
+ <Avatar className="hidden h-8 w-8 sm:flex">
+ <AvatarImage
+ src={job.Company?.logoUrl || "/images/jobsync-logo.svg"}
+ alt="Avatar"
+ />
+ <AvatarFallback>JS</AvatarFallback>
</Avatar>
<div className="grid gap-1">
<p className="text-sm font-medium leading-none">
@@ -24,7 +29,7 @@ export default function RecentJobsCard({ jobs }: { jobs: JobResponse[] }) {
{job.Company?.label}
</p>
</div>
- <div className="ml-auto font-medium">
+ <div className="ml-auto text-sm font-medium">
{format(job?.appliedDate, "PP")}
</div>
</div>
diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx
index 7f3502f..bb0650a 100644
--- a/src/components/ui/table.tsx
+++ b/src/components/ui/table.tsx
@@ -1,6 +1,6 @@
-import * as React from "react"
+import * as React from "react";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
const Table = React.forwardRef<
HTMLTableElement,
@@ -13,16 +13,16 @@ const Table = React.forwardRef<
{...props}
/>
</div>
-))
-Table.displayName = "Table"
+));
+Table.displayName = "Table";
const TableHeader = React.forwardRef<
HTMLTableSectionElement,
React.HTMLAttributes<HTMLTableSectionElement>
>(({ className, ...props }, ref) => (
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
-))
-TableHeader.displayName = "TableHeader"
+));
+TableHeader.displayName = "TableHeader";
const TableBody = React.forwardRef<
HTMLTableSectionElement,
@@ -33,8 +33,8 @@ const TableBody = React.forwardRef<
className={cn("[&_tr:last-child]:border-0", className)}
{...props}
/>
-))
-TableBody.displayName = "TableBody"
+));
+TableBody.displayName = "TableBody";
const TableFooter = React.forwardRef<
HTMLTableSectionElement,
@@ -48,8 +48,8 @@ const TableFooter = React.forwardRef<
)}
{...props}
/>
-))
-TableFooter.displayName = "TableFooter"
+));
+TableFooter.displayName = "TableFooter";
const TableRow = React.forwardRef<
HTMLTableRowElement,
@@ -63,8 +63,8 @@ const TableRow = React.forwardRef<
)}
{...props}
/>
-))
-TableRow.displayName = "TableRow"
+));
+TableRow.displayName = "TableRow";
const TableHead = React.forwardRef<
HTMLTableCellElement,
@@ -78,8 +78,8 @@ const TableHead = React.forwardRef<
)}
{...props}
/>
-))
-TableHead.displayName = "TableHead"
+));
+TableHead.displayName = "TableHead";
const TableCell = React.forwardRef<
HTMLTableCellElement,
@@ -90,8 +90,8 @@ const TableCell = React.forwardRef<
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
{...props}
/>
-))
-TableCell.displayName = "TableCell"
+));
+TableCell.displayName = "TableCell";
const TableCaption = React.forwardRef<
HTMLTableCaptionElement,
@@ -102,8 +102,8 @@ const TableCaption = React.forwardRef<
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
-))
-TableCaption.displayName = "TableCaption"
+));
+TableCaption.displayName = "TableCaption";
export {
Table,
@@ -114,4 +114,4 @@ export {
TableRow,
TableCell,
TableCaption,
-}
+};
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 5ea709f..4ebb7be 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -6,6 +6,10 @@ import {
Sheet,
} from "lucide-react";
+export enum APP_CONSTANTS {
+ RECORDS_PER_PAGE = 10,
+}
+
export const SIDEBAR_LINKS = [
{
icon: LayoutDashboard,
diff --git a/src/models/addCompanyForm.schema.ts b/src/models/addCompanyForm.schema.ts
new file mode 100644
index 0000000..8f29e3b
--- /dev/null
+++ b/src/models/addCompanyForm.schema.ts
@@ -0,0 +1,10 @@
+import { z } from "zod";
+
+export const AddCompanyFormSchema = z.object({
+ id: z.string().optional(),
+ createdBy: z.string().optional(),
+ company: z.string({
+ required_error: "Company name is required.",
+ }),
+ logoUrl: z.string().optional(),
+});