Files
atrade/src/main/kotlin/ui/ActiveTradeRow.kt
T

117 lines
5.0 KiB
Kotlin
Raw Normal View History

2026-04-07 17:32:21 +09:00
//// src/main/kotlin/ui/ActiveTradeRow.kt
//package ui
//
//import AutoTradeItem
//import androidx.compose.foundation.background
//import androidx.compose.foundation.clickable
//import androidx.compose.foundation.layout.*
//import androidx.compose.foundation.shape.RoundedCornerShape
//import androidx.compose.material.*
//import androidx.compose.runtime.Composable
//import androidx.compose.ui.Alignment
//import androidx.compose.ui.Modifier
//import androidx.compose.ui.graphics.Color
//import androidx.compose.ui.text.font.FontWeight
//import androidx.compose.ui.unit.dp
//import androidx.compose.ui.unit.sp
//
//@Composable
//fun ActiveTradeRow(
// item: AutoTradeItem, // UI 모델 대신 통합 데이터 모델 사용
// onCancelClick: () -> Unit, // 미체결 취소 시 주문번호(orderNo) 전달
// onClick: () -> Unit
//) {
// // 상태에 따른 UI 구성 요소 정의
// val (statusText, statusColor, backgroundColor) = when (item.status) {
// "PENDING_BUY" -> Triple("매수중", Color(0xFFFBC02D), Color(0xFFFFF9C4)) // 노랑
// "MONITORING" -> Triple("감시중", Color(0xFF0E62CF), Color.White) // 파랑
// "SELLING" -> Triple("매도중", Color(0xFFE03E2D), Color(0xFFFFF4F4)) // 빨강
// "COMPLETED" -> Triple("완료", Color.Gray, Color(0xFFF5F5F5)) // 회색
// else -> Triple("알 수 없음", Color.Black, Color.White)
// }
//
// Card(
// modifier = Modifier
// .fillMaxWidth()
// .padding(vertical = 4.dp, horizontal = 2.dp)
// .clickable { onClick() },
// elevation = 2.dp,
// shape = RoundedCornerShape(4.dp),
// backgroundColor = backgroundColor
// ) {
// Row(
// modifier = Modifier.padding(12.dp),
// verticalAlignment = Alignment.CenterVertically
// ) {
// // 좌측 정보 영역
// Column(modifier = Modifier.weight(1f)) {
// Row(verticalAlignment = Alignment.CenterVertically) {
// // 상태 배지 표시
// Surface(
// color = statusColor,
// shape = RoundedCornerShape(2.dp),
// modifier = Modifier.padding(end = 6.dp)
// ) {
// Text(
// text = statusText,
// color = Color.White,
// fontSize = 9.sp,
// modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp),
// fontWeight = FontWeight.Bold
// )
// }
// Text(
// text = item.name,
// style = MaterialTheme.typography.body2,
// fontWeight = FontWeight.Bold,
// maxLines = 1
// )
// }
//
// // 상세 가격 정보 (상태에 따라 비율 또는 목표가 표시)
// val detailText = when (item.status) {
// "PENDING_BUY" -> "설정 비율: 익절 ${item.profitRate}% / 손절 ${item.stopLossRate}%"
// "MONITORING" -> "목표가: ${String.format("%,.0f", item.targetPrice)} / 손절가: ${String.format("%,.0f", item.stopLossPrice)}"
// else -> "주문번호: ${item.orderNo} ${item.orderedPrice} ${item.quantity}"
// }
//
// Text(
// text = "${item.code} | $detailText",
// fontSize = 11.sp,
// color = Color.Gray
// )
// }
//
// // 우측 액션 및 수량 영역
// Column(horizontalAlignment = Alignment.End) {
// if (item.status == "PENDING_BUY" || item.status == "SELLING") {
// // 진행 중인 주문인 경우 취소 버튼 노출
// Button(
// onClick = { onCancelClick() },
// contentPadding = PaddingValues(horizontal = 8.dp),
// modifier = Modifier.height(28.dp),
// colors = ButtonDefaults.buttonColors(backgroundColor = Color.LightGray)
// ) {
// Text("취소", fontSize = 11.sp)
// }
// } else {
// Button(
// onClick = { onCancelClick() },
// contentPadding = PaddingValues(horizontal = 8.dp),
// modifier = Modifier.height(28.dp),
// colors = ButtonDefaults.buttonColors(backgroundColor = Color.LightGray)
// ) {
// Text("취소", fontSize = 11.sp)
// }
// }
//
// Text(
// text = "${item.quantity}주",
// fontSize = 12.sp,
// fontWeight = FontWeight.Bold,
// color = statusColor
// )
// }
// }
// }
//}