|
1 | 1 | import EmptyState from "@/components/common/empty-state"; |
| 2 | +import Tldr from "@/components/common/tldr"; |
| 3 | +import { ShareModal } from "@/components/securities/shares/share-modal"; |
| 4 | +import ShareTable from "@/components/securities/shares/share-table"; |
2 | 5 | import { Button } from "@/components/ui/button"; |
3 | | -import { RiPieChartFill } from "@remixicon/react"; |
4 | | -import { type Metadata } from "next"; |
| 6 | +import { Card } from "@/components/ui/card"; |
| 7 | +import { api } from "@/trpc/server"; |
| 8 | +import { RiAddFill, RiPieChartFill } from "@remixicon/react"; |
| 9 | +import type { Metadata } from "next"; |
5 | 10 |
|
6 | 11 | export const metadata: Metadata = { |
7 | | - title: "Cap table", |
| 12 | + title: "Captable | Shares", |
8 | 13 | }; |
9 | 14 |
|
10 | | -const SharesPage = () => { |
| 15 | +const SharesPage = async () => { |
| 16 | + const shares = await api.securities.getShares.query(); |
| 17 | + |
| 18 | + if (shares?.data?.length === 0) { |
| 19 | + return ( |
| 20 | + <EmptyState |
| 21 | + icon={<RiPieChartFill />} |
| 22 | + title="You have not issued any shares" |
| 23 | + subtitle="Please click the button below to start issuing shares." |
| 24 | + > |
| 25 | + <ShareModal |
| 26 | + size="4xl" |
| 27 | + title="Create a share" |
| 28 | + subtitle="Please fill in the details to create and issue a share." |
| 29 | + trigger={ |
| 30 | + <Button size="lg"> |
| 31 | + <RiAddFill className="mr-2 h-5 w-5" /> |
| 32 | + Create a share |
| 33 | + </Button> |
| 34 | + } |
| 35 | + /> |
| 36 | + </EmptyState> |
| 37 | + ); |
| 38 | + } |
| 39 | + |
11 | 40 | return ( |
12 | | - <EmptyState |
13 | | - icon={<RiPieChartFill />} |
14 | | - title="Work in progress." |
15 | | - subtitle="This page is not yet available." |
16 | | - > |
17 | | - <Button size="lg">Coming soon...</Button> |
18 | | - </EmptyState> |
| 41 | + <div className="flex flex-col gap-y-3"> |
| 42 | + <div className="flex items-center justify-between gap-y-3 "> |
| 43 | + <div className="gap-y-3"> |
| 44 | + <h3 className="font-medium">Shares</h3> |
| 45 | + <p className="mt-1 text-sm text-muted-foreground"> |
| 46 | + Issue shares to stakeholders |
| 47 | + </p> |
| 48 | + </div> |
| 49 | + <div> |
| 50 | + <ShareModal |
| 51 | + size="4xl" |
| 52 | + title="Create a share" |
| 53 | + subtitle="Please fill in the details to create and issue a share." |
| 54 | + trigger={ |
| 55 | + <Button> |
| 56 | + <RiAddFill className="mr-2 h-5 w-5" /> |
| 57 | + Create a share |
| 58 | + </Button> |
| 59 | + } |
| 60 | + /> |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + <Card className="mx-auto mt-3 w-[28rem] sm:w-[38rem] md:w-full"> |
| 64 | + <ShareTable shares={shares.data} /> |
| 65 | + </Card> |
| 66 | + </div> |
19 | 67 | ); |
20 | 68 | }; |
21 | 69 |
|
|
0 commit comments