/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import type React from 'react'; import { Box, Text } from 'ink'; import { theme } from '../../semantic-colors.js'; import type { ChatDetail } from '../../types.js'; interface ChatListProps { chats: readonly ChatDetail[]; } export const ChatList: React.FC = ({ chats }) => { if (chats.length === 0) { return No saved conversation checkpoints found.; } return ( List of saved conversations: {chats.map((chat) => { const isoString = chat.mtime; const match = isoString.match( /(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/, ); const formattedDate = match ? `${match[1]} ${match[2]}` : 'Invalid Date'; return ( {' '}- {chat.name}{' '} ({formattedDate}) ); })} Note: Newest last, oldest first ); };