@@ -9,7 +9,11 @@ import {
99import { Separator } from "~/components/ui/separator" ;
1010import { SidebarTrigger } from "~/components/ui/sidebar" ;
1111import { TableSkeleton } from "~/components/table-skeleton" ;
12- import { Currency , RoundedCurrency } from "~/components/ui/number" ;
12+ import {
13+ Currency ,
14+ RoundedCurrency ,
15+ RoundedNumber ,
16+ } from "~/components/ui/number" ;
1317import type Decimal from "decimal.js" ;
1418import { Button } from "../ui/button" ;
1519import { PlusIcon } from "lucide-react" ;
@@ -18,6 +22,7 @@ import { holdingDetailColumn } from "./config";
1822import { DataTable } from "../ui/data-table" ;
1923import { DataTableColumns } from "../ui/data-table-columns" ;
2024import { useTable } from "~/hooks/useTable" ;
25+ import { Badge } from "../ui/badge" ;
2126
2227export type ValueHistoryRow = {
2328 timestamp : Date ;
@@ -45,6 +50,7 @@ export function HoldingDetail({
4550 tickerName,
4651 valueHistory = [ ] ,
4752 type,
53+ quantity,
4854 onQuantityEdit,
4955 onQuantityDelete,
5056 onNewHolding,
@@ -60,6 +66,7 @@ export function HoldingDetail({
6066 latestStockPrice ?: Decimal ;
6167 valueHistory ?: ValueHistoryRow [ ] ;
6268 type : "asset" | "debt" ;
69+ quantity ?: Decimal ;
6370 onQuantityEdit : ( args : { id : string } ) => void ;
6471 onQuantityDelete : ( args : { timestamp : Date } ) => void ;
6572 onNewHolding : ( ) => void ;
@@ -118,9 +125,17 @@ export function HoldingDetail({
118125 < div className = "flex flex-col gap-2 md:flex-row" >
119126 < div className = "mr-auto" >
120127 < p className = "text-sm text-muted-foreground" > { holdingName } </ p >
121- < p className = "text-3xl font-semibold" >
122- < RoundedCurrency value = { holdingComputedValue } />
123- </ p >
128+ < div className = "flex items-center gap-2" >
129+ < p className = "text-3xl font-semibold" >
130+ < RoundedCurrency value = { holdingComputedValue } />
131+ </ p >
132+ { isCategoryStock && (
133+ < Badge variant = "secondary" >
134+ < RoundedNumber value = { quantity } />
135+ shares
136+ </ Badge >
137+ ) }
138+ </ div >
124139 </ div >
125140
126141 < DataTableColumns table = { table } />
@@ -131,14 +146,15 @@ export function HoldingDetail({
131146 </ Button >
132147 </ div >
133148
134- < Overview
135- holdingCurrency = { holdingCurrency }
136- isCategoryStock = { isCategoryStock }
137- latestStockPrice = { latestStockPrice }
138- ticker = { ticker }
139- tickerName = { tickerName }
140- tickerExchange = { tickerExchange }
141- />
149+ { isCategoryStock && (
150+ < Overview
151+ holdingCurrency = { holdingCurrency }
152+ latestStockPrice = { latestStockPrice }
153+ ticker = { ticker }
154+ tickerName = { tickerName }
155+ tickerExchange = { tickerExchange }
156+ />
157+ ) }
142158
143159 < DataTable table = { table } />
144160 </ div >
@@ -152,38 +168,32 @@ export function Overview({
152168 ticker,
153169 tickerName,
154170 tickerExchange,
155- isCategoryStock,
156171 holdingCurrency,
157172 latestStockPrice,
158173} : {
159174 holdingCurrency ?: string ;
160175 tickerName ?: string ;
161176 ticker ?: string ;
162177 tickerExchange ?: string ;
163- isCategoryStock ?: boolean ;
164178 latestStockPrice ?: Decimal ;
165179} ) {
166180 return (
167- < >
168- { isCategoryStock && (
169- < div className = "flex items-center justify-between rounded-lg border p-5 text-sm" >
170- < div >
171- < p > { tickerName } </ p >
172- < p className = "text-muted-foreground" >
173- { ticker } · { tickerExchange }
174- </ p >
175- </ div >
176- < p >
177- < Currency
178- value = { latestStockPrice }
179- options = { {
180- currency : holdingCurrency ,
181- maximumFractionDigits : 2 ,
182- } }
183- />
184- </ p >
185- </ div >
186- ) }
187- </ >
181+ < div className = "flex items-center justify-between rounded-lg border p-5 text-sm" >
182+ < div >
183+ < p > { tickerName } </ p >
184+ < p className = "text-muted-foreground" >
185+ { ticker } · { tickerExchange }
186+ </ p >
187+ </ div >
188+ < p >
189+ < Currency
190+ value = { latestStockPrice }
191+ options = { {
192+ currency : holdingCurrency ,
193+ maximumFractionDigits : 2 ,
194+ } }
195+ />
196+ </ p >
197+ </ div >
188198 ) ;
189199}
0 commit comments