CIOAgent / frontend /src /components /DividendAnalysis.jsx
bhuvighosh3
Deployment with restored Stress Specialist data
9fbb3f2
Raw History Blame Contribute Delete
2 kB
import React from "react";
export default function DividendAnalysis({ data }) {
if (!data) return null;
return (
<div className="section">
<h2>Dividend Analysis</h2>
<div className="metrics-row">
<div className="metric-card">
<span className="metric-label">Portfolio Yield</span>
<span className="metric-value">{(data.portfolio_yield * 100).toFixed(2)}%</span>
</div>
<div className="metric-card">
<span className="metric-label">Annual Income</span>
<span className="metric-value">${data.total_annual_income.toLocaleString(undefined, { maximumFractionDigits: 0 })}</span>
</div>
<div className="metric-card">
<span className="metric-label">Monthly Income</span>
<span className="metric-value">${data.monthly_income.toLocaleString(undefined, { maximumFractionDigits: 0 })}</span>
</div>
<div className="metric-card">
<span className="metric-label">Investment Basis</span>
<span className="metric-value">${data.investment_amount.toLocaleString()}</span>
</div>
</div>
<table className="data-table" style={{ marginTop: "1rem" }}>
<thead>
<tr>
<th>Ticker</th>
<th>Weight</th>
<th>Div Yield</th>
<th>Div Rate</th>
<th>Payout Ratio</th>
<th>Annual Income</th>
</tr>
</thead>
<tbody>
{data.holdings.map((h, i) => (
<tr key={i}>
<td><strong>{h.ticker}</strong></td>
<td>{(h.weight * 100).toFixed(1)}%</td>
<td>{(h.dividend_yield * 100).toFixed(2)}%</td>
<td>${h.dividend_rate.toFixed(2)}</td>
<td>{(h.payout_ratio * 100).toFixed(0)}%</td>
<td>${h.annual_income.toLocaleString(undefined, { maximumFractionDigits: 0 })}</td>
</tr>
))}
</tbody>
</table>
</div>
);
}