대시보드 수정및 전략수정중

This commit is contained in:
2026-02-27 11:22:44 +09:00
parent 38ff312321
commit 4de03bad67
9 changed files with 159 additions and 65 deletions

View File

@@ -25,12 +25,21 @@ export const PortfolioSummary = ({ summary, error }: PortfolioSummaryProps) => {
);
}
const { total_assets, total_value, total_investment, total_profit_loss, total_profit_loss_rate, available_cash } = summary;
const isProfit = total_profit_loss >= 0;
const {
total_assets,
total_value, // 주식 평가금액
total_investment, // 총 매입금액
total_profit_loss,
total_profit_loss_rate,
available_cash, // 예수금 (현금)
} = summary;
const isProfit = (total_profit_loss ?? 0) >= 0;
const fmt = (v: number) => Math.round(v || 0).toLocaleString();
return (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
{/* 총 자산 */}
{/* 총 자산 (예수금 + 주식평가) */}
<div className="bg-gray-800/50 backdrop-blur-sm border border-gray-700/50 p-5 rounded-xl">
<div className="flex justify-between items-start mb-2">
<p className="text-gray-400 text-sm font-medium">총 자산</p>
@@ -39,25 +48,23 @@ export const PortfolioSummary = ({ summary, error }: PortfolioSummaryProps) => {
</div>
</div>
<h3 className="text-2xl font-bold text-white mb-1">
{Math.round(total_assets || 0).toLocaleString()}원
{fmt(total_assets)}원
</h3>
<div className="flex flex-col gap-0.5 text-xs text-gray-400">
<span>예수금: {Math.round(available_cash || 0).toLocaleString()}원</span>
<span>평가금액: {Math.round(total_value || 0).toLocaleString()}원</span>
</div>
<p className="text-xs text-gray-500">예수금 + 주식평가</p>
</div>
{/* 총 매입금액 */}
{/* 예수금 (현금) */}
<div className="bg-gray-800/50 backdrop-blur-sm border border-gray-700/50 p-5 rounded-xl">
<div className="flex justify-between items-start mb-2">
<p className="text-gray-400 text-sm font-medium">총 매입금액</p>
<p className="text-gray-400 text-sm font-medium">예수금</p>
<div className="p-2 bg-purple-500/10 rounded-lg text-purple-400">
<Activity size={18} />
</div>
</div>
<h3 className="text-2xl font-bold text-white mb-1">
{Math.round(total_investment || 0).toLocaleString()}원
{fmt(available_cash)}원
</h3>
<p className="text-xs text-gray-500">주식평가: {fmt(total_value)}원</p>
</div>
{/* 총 평가손익 */}
@@ -69,8 +76,9 @@ export const PortfolioSummary = ({ summary, error }: PortfolioSummaryProps) => {
</div>
</div>
<h3 className={`text-2xl font-bold mb-1 ${isProfit ? 'text-red-400' : 'text-blue-400'}`}>
{total_profit_loss > 0 ? '+' : ''}{Math.round(total_profit_loss || 0).toLocaleString()}원
{(total_profit_loss ?? 0) > 0 ? '+' : ''}{fmt(total_profit_loss)}원
</h3>
<p className="text-xs text-gray-500">매입: {fmt(total_investment)}원</p>
</div>
{/* 수익률 */}
@@ -82,8 +90,9 @@ export const PortfolioSummary = ({ summary, error }: PortfolioSummaryProps) => {
</div>
</div>
<h3 className={`text-2xl font-bold mb-1 ${isProfit ? 'text-red-400' : 'text-blue-400'}`}>
{total_profit_loss_rate > 0 ? '+' : ''}{total_profit_loss_rate?.toFixed(2)}%
{(total_profit_loss_rate ?? 0) > 0 ? '+' : ''}{(total_profit_loss_rate ?? 0).toFixed(2)}%
</h3>
<p className="text-xs text-gray-500">주식 매입 대비</p>
</div>
</div>
);