import { useState } from 'react' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import { ListTodo, FileText, X, ExternalLink } from 'lucide-react' import { useStore } from '../store' const API = '/api' export function RightSidebar() { const { activeRoomId, tasks, workspace } = useStore() const [previewFile, setPreviewFile] = useState<{ name: string; content: string } | null>(null) const tasksMd = activeRoomId ? (tasks[activeRoomId] || '') : '' const files = activeRoomId ? (workspace[activeRoomId] || []) : [] const openFile = async (filename: string) => { if (!activeRoomId) return const d = await fetch(`${API}/rooms/${activeRoomId}/workspace/${filename}`).then(r => r.json()) setPreviewFile({ name: filename, content: d.content || '' }) } if (!activeRoomId) { return (
工作区
选择群聊查看工作区
) } return ( <>
工作区
{/* TodoList */}
任务列表
{tasksMd ? (
{tasksMd}
) : (

暂无任务

)}
{/* Modified Files */}
修改的文件 ({files.length})
{files.length > 0 ? (
{files.map(f => ( ))}
) : (

暂无修改的文件

)}
{/* File preview modal */} {previewFile && (
setPreviewFile(null)} >
e.stopPropagation()} >
{previewFile.name}
{previewFile.content}
)} ) }