import { AlertCircle, ClipboardList, FileText, RefreshCcw } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import type {
DashboardActivityResponse,
DashboardTradeSide,
} from "@/features/dashboard/types/dashboard.types";
import {
formatCurrency,
formatPercent,
getChangeToneClass,
} from "@/features/dashboard/utils/dashboard-format";
import { cn } from "@/lib/utils";
interface ActivitySectionProps {
activity: DashboardActivityResponse | null;
isLoading: boolean;
error: string | null;
onRetry?: () => void;
}
/**
* @description 대시보드 하단 주문내역/매매일지 섹션입니다.
* @remarks UI 흐름: DashboardContainer -> ActivitySection -> tabs(주문내역/매매일지) -> 리스트 렌더링
* @see features/dashboard/components/DashboardContainer.tsx 하단 영역에서 호출합니다.
* @see app/api/kis/domestic/activity/route.ts 주문내역/매매일지 데이터 소스
*/
export function ActivitySection({
activity,
isLoading,
error,
onRetry,
}: ActivitySectionProps) {
const orders = activity?.orders ?? [];
const journalRows = activity?.tradeJournal ?? [];
const summary = activity?.journalSummary;
const warnings = activity?.warnings ?? [];
return (
주문내역/매매일지를 불러오는 중입니다.
주문/매매일지 API는 장중 혼잡 시간에 간헐적 실패가 발생할 수 있습니다.
표시할 주문내역이 없습니다.
{order.orderDate} {order.orderTime} {order.name}
{order.symbol} · {getSideLabel(order.side)}
수량 {order.orderQuantity.toLocaleString("ko-KR")}주
{order.orderTypeName} · {formatCurrency(order.orderPrice)}원
체결 {order.filledQuantity.toLocaleString("ko-KR")}주
금액 {formatCurrency(order.filledAmount)}원
표시할 매매일지가 없습니다.
{row.tradeDate} {row.name} {row.symbol}
{getSideLabel(row.side)}
매수 {formatCurrency(row.buyAmount)}원 / 매도 {formatCurrency(row.sellAmount)}원
{formatCurrency(row.realizedProfit)}원 ({formatPercent(row.realizedRate)})
수수료 {formatCurrency(row.fee)}원
세금 {formatCurrency(row.tax)}원
{label}
{value}