@justinechang39/maki
Version:
AI-powered CLI agent for file operations, CSV manipulation, todo management, and web content fetching using OpenRouter
34 lines (33 loc) • 1.78 kB
JavaScript
import React from 'react';
import { Box, Text, useInput } from 'ink';
export const ThreadManager = ({ thread, selectedIndex, onContinue, onDelete, onBack, isDeleting = false }) => {
const options = [
{ name: 'Continue conversation', icon: '▶️', action: onContinue, color: 'green' },
{ name: 'Delete thread', icon: '🗑️', action: onDelete, color: 'red' },
{ name: 'Back to list', icon: '⬅️', action: onBack, color: 'gray' }
];
useInput((input, key) => {
if (key.return && !isDeleting) {
options[selectedIndex].action();
}
});
return (React.createElement(Box, { flexDirection: "column", padding: 1 },
React.createElement(Box, { paddingBottom: 1 },
React.createElement(Text, { bold: true, color: "yellow" },
"\u258C",
thread.title || 'untitled'),
React.createElement(Text, { dimColor: true },
thread.messageCount,
" msgs \u2022 ",
thread.createdAt.toLocaleDateString())),
React.createElement(Box, { flexDirection: "column" }, options.map((option, index) => (React.createElement(Box, { key: index },
React.createElement(Text, { color: index === selectedIndex ? option.color : 'white', backgroundColor: index === selectedIndex ? option.color : undefined, inverse: index === selectedIndex },
index === selectedIndex ? '▶' : ' ',
" ",
option.icon,
" ",
option.name,
index === 1 && isDeleting ? ' ⏳' : ''))))),
React.createElement(Box, { paddingTop: 1 },
React.createElement(Text, { dimColor: true }, "\u2191\u2193 \u2022 \u23CE \u2022 ^C"))));
};