mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-21 12:51:17 -05:00
Fix CodeBlock diffs
This commit is contained in:
@@ -126,25 +126,64 @@ export const mockMessages: ClaudeMessage[] = [
|
||||
text: JSON.stringify({
|
||||
tool: "editedExistingFile",
|
||||
path: "/src/components/TodoList.tsx",
|
||||
diff: `@@ -14,6 +14,11 @@
|
||||
}
|
||||
};
|
||||
diff: `+
|
||||
+
|
||||
import React, { useState } from "react"
|
||||
|
||||
+ const deleteTodo = (id: number) => {
|
||||
+ setTodos(todos.filter(todo => todo.id !== id));
|
||||
+ };
|
||||
+
|
||||
const toggleTodo = (id: number) => {
|
||||
setTodos(todos.map(todo =>
|
||||
todo.id === id ? { ...todo, completed: !todo.completed } : todo
|
||||
@@ -35,6 +40,7 @@
|
||||
style={{ textDecoration: todo.completed ? 'line-through' : 'none' }}
|
||||
>
|
||||
{todo.text}
|
||||
+ <button onClick={() => deleteTodo(todo.id)}>Delete</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>`,
|
||||
interface Todo {
|
||||
id: number
|
||||
text: string
|
||||
completed: boolean
|
||||
}
|
||||
|
||||
const TodoList: React.FC = () => {
|
||||
const [todos, setTodos] = useState<Todo[]>([])
|
||||
const [inputValue, setInputValue] = useState("")
|
||||
|
||||
const addTodo = () => {
|
||||
if (inputValue.trim() !== "") {
|
||||
setTodos([...todos, { id: Date.now(), text: inputValue, completed: false }])
|
||||
setInputValue("")
|
||||
}
|
||||
}
|
||||
|
||||
const toggleTodo = (id: number) => {
|
||||
setTodos(todos.map((todo) => (todo.id === id ? { ...todo, completed: !todo.completed } : todo)))
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Todo List</h1>
|
||||
<input
|
||||
type="text"
|
||||
value={inputValue}
|
||||
onChange={(e) => setInputValue(e.target.value)}
|
||||
placeholder="Add a new todo"
|
||||
/>
|
||||
|
||||
- <button onClick={addTodo}>Add</button>
|
||||
- <ul>
|
||||
- {todos.map((todo) => (
|
||||
- <li
|
||||
- key={todo.id}
|
||||
- onClick={() => toggleTodo(todo.id)}
|
||||
- style={{ textDecoration: todo.completed ? "line-through" : "none" }}>
|
||||
- {todo.text}
|
||||
- </li>
|
||||
- ))}
|
||||
- </ul>
|
||||
- </div>
|
||||
-
|
||||
+
|
||||
+
|
||||
)
|
||||
}
|
||||
|
||||
export default TodoList
|
||||
|
||||
+
|
||||
+
|
||||
`,
|
||||
}),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user