@@ -8,7 +8,7 @@ import { CreateCompanyDialog } from '@/components/create-company-dialog';
88import { Button } from '@/components/ui/button' ;
99import Link from 'next/link' ;
1010import { InvestDialog } from '@/components/invest-dialog' ;
11- import type { CompanyWithDetails , ManagedCompany , InvestedCompany , OtherCompany } from '@/lib/actions/companies' ;
11+ import type { CompanyWithDetails , ManagedCompany , InvestedCompany , ListedCompany , OtherCompany } from '@/lib/actions/companies' ;
1212import { SellSharesDialog } from '@/components/sell-shares-dialog' ;
1313import { Area , AreaChart , Tooltip } from 'recharts' ;
1414import { ChartContainer , ChartTooltipContent } from "@/components/ui/chart" ;
@@ -18,13 +18,11 @@ function CompanyTableRow({ company, type }: { company: any, type: 'managed' | 'i
1818
1919 return (
2020 < TableRow >
21- { /* Column 1: Entreprise */ }
2221 < TableCell >
2322 < div className = "font-medium" > { company . name } ({ company . ticker } )</ div >
2423 < div className = "text-sm text-muted-foreground" > { company . industry } </ div >
2524 </ TableCell >
2625
27- { /* Columns 2 & 3 based on type */ }
2826 { type === 'managed' && < >
2927 < TableCell > < Badge variant = "secondary" > { company . role . toUpperCase ( ) } </ Badge > </ TableCell >
3028 < TableCell className = "font-mono" > { hasShares ? company . sharesHeld . toFixed ( 4 ) : '-' } </ TableCell >
@@ -39,15 +37,23 @@ function CompanyTableRow({ company, type }: { company: any, type: 'managed' | 'i
3937 < TableCell className = "font-mono" > ${ company . marketCap . toLocaleString ( undefined , { maximumFractionDigits : 0 } ) } </ TableCell >
4038 </ > }
4139
42- { /* Actions Column */ }
4340 < TableCell className = "text-right space-x-2" >
4441 < Button asChild variant = "outline" size = "sm" >
4542 < Link href = { `/companies/${ company . id } ` } > Détails</ Link >
4643 </ Button >
47- { /* Note: Investing in private companies from this table */ }
4844 < InvestDialog company = { company as CompanyWithDetails } >
4945 < Button size = "sm" > Investir</ Button >
5046 </ InvestDialog >
47+ { hasShares && (
48+ < SellSharesDialog
49+ companyId = { company . id }
50+ companyName = { company . name }
51+ sharePrice = { company . sharePrice }
52+ sharesHeld = { company . sharesHeld }
53+ >
54+ < Button size = "sm" variant = "secondary" > Vendre</ Button >
55+ </ SellSharesDialog >
56+ ) }
5157 </ TableCell >
5258 </ TableRow >
5359 ) ;
@@ -81,7 +87,7 @@ function CompanyTable({ title, description, companies, type }: { title: string,
8187 ) : (
8288 < TableRow >
8389 < TableCell colSpan = { headers [ type ] . length } className = "h-24 text-center text-muted-foreground" >
84- { type === 'managed' ? "Vous ne gérez aucune entreprise." : type === 'invested' ? "Vous n'avez investi dans aucune entreprise." : "Aucune entreprise privée disponible." }
90+ { type === 'managed' ? "Vous ne gérez aucune entreprise." : type === 'invested' ? "Vous n'avez investi dans aucune entreprise privée ." : "Aucune entreprise privée disponible." }
8591 </ TableCell >
8692 </ TableRow >
8793 ) }
@@ -93,7 +99,7 @@ function CompanyTable({ title, description, companies, type }: { title: string,
9399}
94100
95101
96- function StockExchangeCard ( { company } : { company : OtherCompany } ) {
102+ function StockExchangeCard ( { company } : { company : ListedCompany } ) {
97103 const changeIsPositive = company . change24h . startsWith ( '+' ) ;
98104 const chartConfig = {
99105 price : {
@@ -175,13 +181,11 @@ function StockExchangeCard({ company }: { company: OtherCompany }) {
175181interface CompaniesClientPageProps {
176182 managedCompanies : ManagedCompany [ ] ;
177183 investedCompanies : InvestedCompany [ ] ;
178- otherCompanies : OtherCompany [ ] ;
184+ otherPrivateCompanies : OtherCompany [ ] ;
185+ listedCompanies : ListedCompany [ ] ;
179186}
180187
181- export function CompaniesClientPage ( { managedCompanies, investedCompanies, otherCompanies } : CompaniesClientPageProps ) {
182- const listedCompanies = otherCompanies . filter ( c => c . isListed ) ;
183- const privateCompanies = otherCompanies . filter ( c => ! c . isListed ) ;
184-
188+ export function CompaniesClientPage ( { managedCompanies, investedCompanies, otherPrivateCompanies, listedCompanies } : CompaniesClientPageProps ) {
185189 return (
186190 < div className = "space-y-6" >
187191 < div className = "flex items-center justify-between" >
@@ -203,8 +207,8 @@ export function CompaniesClientPage({ managedCompanies, investedCompanies, other
203207
204208 { investedCompanies . length > 0 && (
205209 < CompanyTable
206- title = "Mes Investissements"
207- description = "Les entreprises dans lesquelles vous détenez des parts mais que vous ne gérez pas."
210+ title = "Mes Investissements (Entreprises Privées) "
211+ description = "Les entreprises privées dans lesquelles vous détenez des parts mais que vous ne gérez pas."
208212 companies = { investedCompanies }
209213 type = "invested"
210214 />
@@ -224,11 +228,11 @@ export function CompaniesClientPage({ managedCompanies, investedCompanies, other
224228 </ CardContent >
225229 </ Card >
226230
227- { privateCompanies . length > 0 && (
231+ { otherPrivateCompanies . length > 0 && (
228232 < CompanyTable
229233 title = "Autres Entreprises Privées"
230234 description = "Entreprises non cotées dans lesquelles vous pouvez réaliser un investissement initial."
231- companies = { privateCompanies }
235+ companies = { otherPrivateCompanies }
232236 type = "other"
233237 />
234238 ) }
0 commit comments