import { View, Text, TouchableOpacity, StyleSheet } from "react-native"; import { ReactNode } from "react"; import { ChevronDown, ChevronRight } from "../../icons"; import { gameUIColors } from "../gameUI"; export interface CompactRowProps { // Status section statusDotColor: string; statusLabel: string; statusSublabel?: string; // Content section primaryText: string; secondaryText?: string; expandedContent?: ReactNode; isExpanded?: boolean; // Badge section (right side) - can be text or custom component badgeText?: string | number; badgeColor?: string; customBadge?: ReactNode; showChevron?: boolean; bottomRightText?: string; // New: text positioned at bottom right of card // Interaction isSelected?: boolean; onPress?: () => void; disabled?: boolean; expandedGlowColor?: string; } export function CompactRow({ statusDotColor, statusLabel, statusSublabel, primaryText, secondaryText, expandedContent, isExpanded, badgeText, badgeColor, customBadge, showChevron, bottomRightText, isSelected, onPress, disabled, expandedGlowColor, }: CompactRowProps) { return ( {/* Actual card content */} {/* Status Section */} {statusLabel} {statusSublabel && ( {statusSublabel} )} {/* Content Section */} {primaryText} {!isExpanded && secondaryText && ( {secondaryText} )} {/* Badge and Chevron Section */} {(customBadge || badgeText !== undefined) && ( {customBadge ? ( customBadge ) : ( {badgeText} )} )} {showChevron && ( {isExpanded ? ( ) : ( )} )} {/* Expanded Content */} {isExpanded && expandedContent && ( {expandedContent} )} {/* Bottom Right Text (timestamp) */} {!isExpanded && bottomRightText && ( {bottomRightText} )} ); } const styles = StyleSheet.create({ rowWrapper: { position: "relative", marginHorizontal: 8, marginVertical: 3, }, row: { backgroundColor: gameUIColors.panel, borderRadius: 8, borderWidth: 1, borderColor: gameUIColors.border + "40", padding: 12, transform: [{ scale: 1 }], }, selectedRow: { backgroundColor: gameUIColors.info + "15", borderColor: gameUIColors.info + "50", transform: [{ scale: 1.01 }], shadowColor: gameUIColors.info, shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.1, shadowRadius: 8, elevation: 2, }, expandedRowActive: { transform: [{ scale: 1.02 }], borderWidth: 2, shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.8, shadowRadius: 20, elevation: 10, }, rowContent: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", }, statusSection: { flexDirection: "row", alignItems: "center", gap: 8, width: 90, // Fixed width instead of flex to ensure consistent alignment minWidth: 90, }, statusDot: { width: 8, height: 8, borderRadius: 4, }, statusInfo: { flex: 1, maxWidth: 70, // Ensure status text doesn't overflow }, statusLabel: { fontSize: 11, fontWeight: "600", lineHeight: 14, }, observerText: { fontSize: 10, color: gameUIColors.muted, marginTop: 1, }, querySection: { flex: 2, paddingHorizontal: 12, }, queryHash: { fontFamily: "monospace", fontSize: 12, color: gameUIColors.primary, lineHeight: 16, }, secondaryText: { fontSize: 10, color: gameUIColors.muted, marginTop: 1, }, rightSection: { flexDirection: "row", alignItems: "center", gap: 8, }, badgeContainer: { alignItems: "flex-end", }, statusBadge: { fontSize: 12, fontWeight: "600", fontVariant: ["tabular-nums"], }, chevronContainer: { padding: 2, }, expandedContent: { marginTop: 8, paddingTop: 8, borderTopWidth: 1, borderTopColor: gameUIColors.border + "20", marginLeft: 24, // Align with content after status dot }, bottomRightContainer: { position: "absolute", bottom: 4, right: 8, }, bottomRightText: { fontSize: 9, color: gameUIColors.muted, fontFamily: "monospace", }, });