diff --git a/package.json b/package.json index d4e558964..5b5451652 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "react-dropzone": "^14.2.3", "react-hook-form": "^7.49.3", "server-only": "^0.0.1", + "sharp": "^0.33.2", "superjson": "^2.2.1", "tailwind-merge": "^2.2.0", "tailwindcss-animate": "^1.0.7", diff --git a/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx b/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx index b1445ed09..366d81ddb 100644 --- a/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx +++ b/src/app/(authenticated)/(dashboard)/[publicId]/page.tsx @@ -19,7 +19,7 @@ const OverviewPage = ({

-
+
{/* Overview */}
diff --git a/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/components/form.tsx b/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/components/form.tsx index efbed047b..528336f81 100644 --- a/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/components/form.tsx +++ b/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/components/form.tsx @@ -110,7 +110,8 @@ const ShareClassForm = ({ Basic Information:

- Let{`'`}s start with share class name and type. + Let{`'`}s start with share class name, type of share and + authorized number of shares.

@@ -184,8 +185,9 @@ const ShareClassForm = ({ Financial Details:

- Specify votes per share, par value, and price per share to - outline the financial characteristics of the Share Class. + Please provide the number of votes each share carries, mention + the par value, and state the price per share to describe the + financial features of the share class.

@@ -296,7 +298,7 @@ const ShareClassForm = ({

Specify seniority, conversion rights, and participation cap multiples to highlight conversion options and preferences for - the Share Class. + the share class.

diff --git a/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/page.tsx b/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/page.tsx index c3788b2d8..9502e5b68 100644 --- a/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/page.tsx +++ b/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/page.tsx @@ -1,27 +1,78 @@ -"use client"; import Link from "next/link"; -import { useParams } from "next/navigation"; +import { db } from "@/server/db"; +import ShareClassTable from "./table"; +import { Card } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; +import type { ShareClass } from "@prisma/client"; +import { withServerSession } from "@/server/auth"; import EmptyState from "@/components/shared/empty-state"; import { RiPieChart2Line, RiAddFill } from "@remixicon/react"; -const SharesPage = () => { - const params = useParams<{ publicId: string }>(); - const publicCompanyId = params.publicId; +type SharesPageParams = { + params: { + publicId: string; + }; +}; + +const getShareClasses = async (companyId: string) => { + return await db.shareClass.findMany({ + where: { companyId }, + }); +}; + +const SharesPage = async ({ params }: SharesPageParams) => { + const { publicId } = params; + const session = await withServerSession(); + const companyId = session?.user?.companyId; + let shareClasses: ShareClass[] = []; + + if (companyId) { + shareClasses = await getShareClasses(companyId); + } + + if (shareClasses.length === 0) { + return ( + } + title="You do not have any share classes!" + subtitle="Please click the button below to create a new share class." + > + + + + + ); + } return ( - } - title="You do not have any share classes!" - subtitle="Please click the button below to create a new share class." - > - - - - +
+
+
+

Share classes

+

+ Manage the share classes for your company +

+
+ +
+ + + +
+
+ + +
+ +
+
+
); }; diff --git a/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/table.tsx b/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/table.tsx new file mode 100644 index 000000000..81445e42e --- /dev/null +++ b/src/app/(authenticated)/(dashboard)/[publicId]/share-classes/table.tsx @@ -0,0 +1,58 @@ +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; + +import { Card } from "@/components/ui/card"; +import type { ShareClass } from "@prisma/client"; +const formatter = new Intl.NumberFormat("en-US"); +import { RiEqualizer2Line } from "@remixicon/react"; + +type ShareClassTableProps = { + shareClasses: ShareClass[]; +}; + +const ShareClassTable = ({ shareClasses }: ShareClassTableProps) => { + return ( + + + + + Name + Type + Authorized shares + Board approval date + Stockholder approval date + + + + + {shareClasses.map((klass) => ( + + {klass.name} + {klass.classType} + + {formatter.format(klass.initialSharesAuthorized)} + + {`${new Date( + klass.boardApprovalDate, + ).toLocaleDateString("en-US")}`} + {`${new Date( + klass.stockholderApprovalDate, + ).toLocaleDateString("en-US")}`} + + + + + ))} + +
+
+ ); +}; + +export default ShareClassTable; diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx index 785d0d048..cb40f2cdb 100644 --- a/src/components/ui/form.tsx +++ b/src/components/ui/form.tsx @@ -156,7 +156,7 @@ const FormMessage = React.forwardRef<

{body}