File size: 1,454 Bytes
9fbb3f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from "react";

export default function UserProfile({ profile, netWorth, debtRatio }) {
  let debtClass = "success";
  let debtMsg = "Conservative leverage.";
  if (debtRatio > 0.5) {
    debtClass = "warning";
    debtMsg = "High leverage may limit risk capacity.";
  } else if (debtRatio > 0.3) {
    debtClass = "info";
    debtMsg = "Moderate leverage.";
  }

  return (
    <section className="section">
      <h2>Investor Profile</h2>
      <div className="metrics-row">
        <div className="metric-card">
          <span className="metric-label">Total Assets</span>
          <span className="metric-value">${profile.total_assets.toLocaleString()}</span>
        </div>
        <div className="metric-card">
          <span className="metric-label">Total Liabilities</span>
          <span className="metric-value">${profile.total_liabilities.toLocaleString()}</span>
        </div>
        <div className="metric-card">
          <span className="metric-label">Net Worth</span>
          <span className="metric-value">${netWorth.toLocaleString()}</span>
        </div>
        <div className="metric-card">
          <span className="metric-label">Risk Tolerance</span>
          <span className="metric-value">{profile.risk_tolerance}</span>
        </div>
      </div>
      <div className={`alert ${debtClass}`}>
        Debt-to-asset ratio: {(debtRatio * 100).toFixed(1)}% &mdash; {debtMsg}
      </div>
    </section>
  );
}