import { Ionicons } from '@expo/vector-icons'; import React from 'react'; import { ActivityIndicator, Modal, ScrollView, StyleSheet, Text, TouchableOpacity, View, } from 'react-native'; import dayjs from 'dayjs'; import { AiConversationListItem } from '@/services/aiCoach'; interface HistoryModalProps { visible: boolean; onClose: () => void; historyLoading: boolean; historyItems: AiConversationListItem[]; historyPage: number; onRefreshHistory: (page: number) => void; onSelectConversation: (id: string) => void; onDeleteConversation: (id: string) => void; } export const HistoryModal: React.FC = ({ visible, onClose, historyLoading, historyItems, historyPage, onRefreshHistory, onSelectConversation, onDeleteConversation, }) => { return ( 历史会话 onRefreshHistory(historyPage)} style={styles.modalRefreshBtn} > {historyLoading ? ( 加载中... ) : ( {historyItems.length === 0 ? ( 暂无会话 ) : ( historyItems.map((it) => ( onSelectConversation(it.conversationId)} > {it.title || '未命名会话'} {dayjs(it.lastMessageAt || it.createdAt).format('YYYY/MM/DD HH:mm')} onDeleteConversation(it.conversationId)} style={styles.historyDeleteBtn} > )) )} )} 关闭 ); }; const styles = StyleSheet.create({ modalBackdrop: { flex: 1, backgroundColor: 'rgba(0,0,0,0.35)', padding: 16, justifyContent: 'flex-end', }, modalSheet: { borderTopLeftRadius: 16, borderTopRightRadius: 16, paddingHorizontal: 12, paddingTop: 10, paddingBottom: 12, }, modalHeader: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 4, paddingBottom: 8, }, modalTitle: { fontSize: 16, fontWeight: '800', color: '#192126', }, modalRefreshBtn: { width: 28, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center', backgroundColor: 'rgba(0,0,0,0.06)' }, historyRow: { flexDirection: 'row', alignItems: 'center', paddingVertical: 10, paddingHorizontal: 8, borderRadius: 10, }, historyTitle: { fontSize: 15, color: '#192126', fontWeight: '600', }, historyMeta: { marginTop: 2, fontSize: 12, color: '#687076', }, historyDeleteBtn: { width: 28, height: 28, borderRadius: 14, alignItems: 'center', justifyContent: 'center', backgroundColor: 'rgba(255,68,68,0.08)' }, modalFooter: { paddingTop: 8, alignItems: 'flex-end', }, modalCloseBtn: { paddingHorizontal: 14, paddingVertical: 8, borderRadius: 10, backgroundColor: 'rgba(0,0,0,0.06)' }, }); export default HistoryModal;