Files
vibe-kanban/frontend/src/components/tasks/TodoPanel.tsx

49 lines
1.5 KiB
TypeScript
Raw Normal View History

import { Circle, CircleCheckBig, CircleDotDashed } from 'lucide-react';
Fix todos and delete useProcessesLogs (vibe-kanban) (#755) * Perfect! The implementation is complete and working. Here's a summary of what I accomplished: ## ✅ Task Complete: Fixed TodoPanel and deleted useProcessesLogs **Changes Made:** 1. **Created [`EntriesContext`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/contexts/EntriesContext.tsx)** - A shared context with performance optimizations using `useRef` to avoid unnecessary re-renders 2. **Modified [`TaskDetailsPanel`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/components/tasks/TaskDetailsPanel.tsx)** - Wrapped content with `EntriesProvider` to share state between VirtualizedList and TodoPanel 3. **Updated [`VirtualizedList`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/components/logs/VirtualizedList.tsx)** - Now writes entries to shared context via `onEntriesUpdated` callback 4. **Simplified [`TodoPanel`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/components/tasks/TodoPanel.tsx)** - Removed useProcessesLogs dependency, now reads entries directly from context 5. **Deleted `useProcessesLogs.ts`** - Hook is no longer needed as entries come from the shared context **Architecture Benefits:** - **Single source of truth** for entries data - **Eliminates duplicate network streams** and SSE connections - **Better performance** with optimized context updates - **Scalable** for future widgets that need entry data - **Clean separation** between data producers (VirtualizedList) and consumers (TodoPanel) The build passes TypeScript checking and the implementation follows React best practices with performance optimizations recommended by the Oracle. * Perfect! The implementation is complete and working. Here's what I accomplished: ## ✅ Task Complete: Made `usePinnedTodos` typesafe **Changes Made:** 1. **Updated [`usePinnedTodos`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/hooks/usePinnedTodos.ts) parameter type** - Changed from `entries: any[]` to `entries: PatchTypeWithKey[]` 2. **Fixed entry structure logic:** - Changed `entry.channel === 'normalized'` → `entry.type === 'NORMALIZED_ENTRY'` - Changed `entry.payload` → `entry.content` 3. **Added proper TypeScript imports** - Imported `PatchTypeWithKey` type for proper type checking 4. **Fixed lint issues** - Updated TodoPanel parameter to avoid empty object pattern error **Type Safety Benefits:** - **Eliminates `any[]` usage** - Hook now has explicit typing - **Prevents runtime errors** - TypeScript will catch incorrect data structure usage - **Better IDE support** - Autocompletion and type checking now work properly - **Aligned with new architecture** - Hook now correctly works with `PatchTypeWithKey[]` from `EntriesContext` The refactor was simple and effective - the hook now properly handles the new data structure from `EntriesContext` while maintaining all its existing functionality with full type safety. * Excellent! All the lint errors have been fixed. Here's a summary of what I accomplished: **Changes Made:** 1. **Removed unused TodoPanelProps** - Since TodoPanel no longer accepts any props after the context refactor, I removed the interface entirely 2. **Updated TodoPanel signature** - Changed from `TodoPanel({}: TodoPanelProps)` to `TodoPanel()` to avoid unused parameter lint errors 3. **Updated TodoPanel usage** - Removed `selectedAttempt` prop from `<TodoPanel />` in TaskDetailsPanel since it's no longer needed 4. **Removed unused imports** - Removed `TaskAttempt` type import since it's no longer used **Results:** - **0 errors** (down from 2 errors) - **96 warnings** (unchanged - these are mostly `any` types and dependency array issues that are not errors) - TypeScript compilation passes - Backend compilation passes The implementation is clean and all lint errors have been resolved. The remaining warnings are pre-existing and not related to our changes. * useState internally * fmt
2025-09-18 11:22:10 +01:00
import { useEntries } from '@/contexts/EntriesContext';
import { usePinnedTodos } from '@/hooks/usePinnedTodos';
Overhaul UI (#577) * font * flat ui * burger menu * button styles * drag effects * search * Improve * navbar * task details header WIP * task attempt window actions * task details * split out title description component * follow up * better board spacing * Incrementally use tanstack (vibe-kanban 0c34261d) Let's refactor the codebase to remove: @frontend/src/components/context/TaskDetailsContextProvider.tsx @frontend/src/components/context/TaskDetailsContextProvider.ts Instead, we want to use @tanstack/react-query * task attempt header info * ui for dropdown * optionally disable * Create hook for attempt actions (vibe-kanban 651551d9) - Start dev server - Rebase - Create PR - Merge These should all be hooks, similar to frontend/src/hooks/useOpenInEditor.ts Their usage in two places should be standardised: - frontend/src/components/tasks/AttemptHeaderCard.tsx - frontend/src/components/tasks/Toolbar/CurrentAttempt.tsx * dropdown positioning * color * soften colours * add new task button * editor dialog via hook * project provider * fmt * lint * follow up styling * break words * card styles * Stop executions from follow up (vibe-kanban e2a2c75b) The follow up section currently disables the 'send' button if a task attempt is running, however instead we should show a destructive 'stop' button which will perform the same functionality as 'stop attempt' frontend/src/components/tasks/TaskFollowUpSection.tsx You can see how we stop already in frontend/src/components/tasks/Toolbar/CurrentAttempt.tsx Maybe we could make this a hook and use tanstack similar to frontend/src/hooks/useBranchStatus.ts What about making the hook more generic, to cover start/stop and status retrieval. We should also combine the hook frontend/src/hooks/useExecutionProcesses.ts * Make sure the kanban columns are always at least full height (vibe-kanban 220cb780) There can be whitespace underneath the columns, ideally there should be no whitespace - the columns should extend to the bottom of the page, even when there aren't enough tasks to fill it up all the way ![Screenshot 2025-08-27 at 14.42.41.png](.vibe-images/11efe690-ec72-4513-a7b6-49641ff170c4.png) frontend/src/pages/project-tasks.tsx * Display diff summary (vibe-kanban f1736551) If files have been changed, we should display a summary of the changes like "6 files changed, +21 -19" in the AttemptHeaderCard, to the right of the dropdown, similar to how we do at the top of the difftab. We should also add an icon button to open the task attempt in full screen and at the diff tab. frontend/src/components/tasks/AttemptHeaderCard.tsx frontend/src/components/tasks/TaskDetails/DiffTab.tsx * styles * projects * full screen max width * full screen actions * remove log * style improve * create new attempt * darkmode * scroll diffs * Refactor useCreatePR (vibe-kanban e6b76f10) The useCreatePR hook should function similarly to useOpenInEditor, in that the the popup should be rendered in some root node. This improves the reusability of this functionality. We should then update TaskDetailsPanel to make the 'create pr' button real. frontend/src/hooks/useOpenInEditor.ts frontend/src/hooks/useCreatePR.ts frontend/src/components/tasks/TaskDetailsPanel.tsx * Rebasing should cause branch status to refresh (vibe-kanban 3da4fe0f) Currently doesn't in frontend/src/components/tasks/TaskDetailsPanel.tsx * project name * Change ?view=full to /full (vibe-kanban a25483a6) * Hide TaskDetailsHeader (vibe-kanban b73697bd) If the app is running inside of VS Code * copy * Add button to open repo (vibe-kanban e447df94) Open repo in IDE button in the navbar, next to create task button * style process cards * Errors not displayed properly (vibe-kanban fb65eb03) frontend/src/components/tasks/TaskDetailsToolbar.tsx Errors are currently failing silently on actions like merge and rebase * fmt * fix * fix border
2025-08-27 23:59:26 +01:00
import { Card } from '../ui/card';
function getStatusIcon(status?: string) {
const s = (status || '').toLowerCase();
if (s === 'completed')
return <CircleCheckBig aria-hidden className="h-4 w-4 text-success" />;
if (s === 'in_progress' || s === 'in-progress')
return <CircleDotDashed aria-hidden className="h-4 w-4 text-blue-500" />;
return <Circle aria-hidden className="h-4 w-4 text-muted-foreground" />;
}
Fix todos and delete useProcessesLogs (vibe-kanban) (#755) * Perfect! The implementation is complete and working. Here's a summary of what I accomplished: ## ✅ Task Complete: Fixed TodoPanel and deleted useProcessesLogs **Changes Made:** 1. **Created [`EntriesContext`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/contexts/EntriesContext.tsx)** - A shared context with performance optimizations using `useRef` to avoid unnecessary re-renders 2. **Modified [`TaskDetailsPanel`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/components/tasks/TaskDetailsPanel.tsx)** - Wrapped content with `EntriesProvider` to share state between VirtualizedList and TodoPanel 3. **Updated [`VirtualizedList`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/components/logs/VirtualizedList.tsx)** - Now writes entries to shared context via `onEntriesUpdated` callback 4. **Simplified [`TodoPanel`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/components/tasks/TodoPanel.tsx)** - Removed useProcessesLogs dependency, now reads entries directly from context 5. **Deleted `useProcessesLogs.ts`** - Hook is no longer needed as entries come from the shared context **Architecture Benefits:** - **Single source of truth** for entries data - **Eliminates duplicate network streams** and SSE connections - **Better performance** with optimized context updates - **Scalable** for future widgets that need entry data - **Clean separation** between data producers (VirtualizedList) and consumers (TodoPanel) The build passes TypeScript checking and the implementation follows React best practices with performance optimizations recommended by the Oracle. * Perfect! The implementation is complete and working. Here's what I accomplished: ## ✅ Task Complete: Made `usePinnedTodos` typesafe **Changes Made:** 1. **Updated [`usePinnedTodos`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-3135-fix-todos/frontend/src/hooks/usePinnedTodos.ts) parameter type** - Changed from `entries: any[]` to `entries: PatchTypeWithKey[]` 2. **Fixed entry structure logic:** - Changed `entry.channel === 'normalized'` → `entry.type === 'NORMALIZED_ENTRY'` - Changed `entry.payload` → `entry.content` 3. **Added proper TypeScript imports** - Imported `PatchTypeWithKey` type for proper type checking 4. **Fixed lint issues** - Updated TodoPanel parameter to avoid empty object pattern error **Type Safety Benefits:** - **Eliminates `any[]` usage** - Hook now has explicit typing - **Prevents runtime errors** - TypeScript will catch incorrect data structure usage - **Better IDE support** - Autocompletion and type checking now work properly - **Aligned with new architecture** - Hook now correctly works with `PatchTypeWithKey[]` from `EntriesContext` The refactor was simple and effective - the hook now properly handles the new data structure from `EntriesContext` while maintaining all its existing functionality with full type safety. * Excellent! All the lint errors have been fixed. Here's a summary of what I accomplished: **Changes Made:** 1. **Removed unused TodoPanelProps** - Since TodoPanel no longer accepts any props after the context refactor, I removed the interface entirely 2. **Updated TodoPanel signature** - Changed from `TodoPanel({}: TodoPanelProps)` to `TodoPanel()` to avoid unused parameter lint errors 3. **Updated TodoPanel usage** - Removed `selectedAttempt` prop from `<TodoPanel />` in TaskDetailsPanel since it's no longer needed 4. **Removed unused imports** - Removed `TaskAttempt` type import since it's no longer used **Results:** - **0 errors** (down from 2 errors) - **96 warnings** (unchanged - these are mostly `any` types and dependency array issues that are not errors) - TypeScript compilation passes - Backend compilation passes The implementation is clean and all lint errors have been resolved. The remaining warnings are pre-existing and not related to our changes. * useState internally * fmt
2025-09-18 11:22:10 +01:00
export function TodoPanel() {
const { entries } = useEntries();
const { todos } = usePinnedTodos(entries);
// Only show once the agent has created subtasks
if (!todos || todos.length === 0) return null;
return (
Overhaul UI (#577) * font * flat ui * burger menu * button styles * drag effects * search * Improve * navbar * task details header WIP * task attempt window actions * task details * split out title description component * follow up * better board spacing * Incrementally use tanstack (vibe-kanban 0c34261d) Let's refactor the codebase to remove: @frontend/src/components/context/TaskDetailsContextProvider.tsx @frontend/src/components/context/TaskDetailsContextProvider.ts Instead, we want to use @tanstack/react-query * task attempt header info * ui for dropdown * optionally disable * Create hook for attempt actions (vibe-kanban 651551d9) - Start dev server - Rebase - Create PR - Merge These should all be hooks, similar to frontend/src/hooks/useOpenInEditor.ts Their usage in two places should be standardised: - frontend/src/components/tasks/AttemptHeaderCard.tsx - frontend/src/components/tasks/Toolbar/CurrentAttempt.tsx * dropdown positioning * color * soften colours * add new task button * editor dialog via hook * project provider * fmt * lint * follow up styling * break words * card styles * Stop executions from follow up (vibe-kanban e2a2c75b) The follow up section currently disables the 'send' button if a task attempt is running, however instead we should show a destructive 'stop' button which will perform the same functionality as 'stop attempt' frontend/src/components/tasks/TaskFollowUpSection.tsx You can see how we stop already in frontend/src/components/tasks/Toolbar/CurrentAttempt.tsx Maybe we could make this a hook and use tanstack similar to frontend/src/hooks/useBranchStatus.ts What about making the hook more generic, to cover start/stop and status retrieval. We should also combine the hook frontend/src/hooks/useExecutionProcesses.ts * Make sure the kanban columns are always at least full height (vibe-kanban 220cb780) There can be whitespace underneath the columns, ideally there should be no whitespace - the columns should extend to the bottom of the page, even when there aren't enough tasks to fill it up all the way ![Screenshot 2025-08-27 at 14.42.41.png](.vibe-images/11efe690-ec72-4513-a7b6-49641ff170c4.png) frontend/src/pages/project-tasks.tsx * Display diff summary (vibe-kanban f1736551) If files have been changed, we should display a summary of the changes like "6 files changed, +21 -19" in the AttemptHeaderCard, to the right of the dropdown, similar to how we do at the top of the difftab. We should also add an icon button to open the task attempt in full screen and at the diff tab. frontend/src/components/tasks/AttemptHeaderCard.tsx frontend/src/components/tasks/TaskDetails/DiffTab.tsx * styles * projects * full screen max width * full screen actions * remove log * style improve * create new attempt * darkmode * scroll diffs * Refactor useCreatePR (vibe-kanban e6b76f10) The useCreatePR hook should function similarly to useOpenInEditor, in that the the popup should be rendered in some root node. This improves the reusability of this functionality. We should then update TaskDetailsPanel to make the 'create pr' button real. frontend/src/hooks/useOpenInEditor.ts frontend/src/hooks/useCreatePR.ts frontend/src/components/tasks/TaskDetailsPanel.tsx * Rebasing should cause branch status to refresh (vibe-kanban 3da4fe0f) Currently doesn't in frontend/src/components/tasks/TaskDetailsPanel.tsx * project name * Change ?view=full to /full (vibe-kanban a25483a6) * Hide TaskDetailsHeader (vibe-kanban b73697bd) If the app is running inside of VS Code * copy * Add button to open repo (vibe-kanban e447df94) Open repo in IDE button in the navbar, next to create task button * style process cards * Errors not displayed properly (vibe-kanban fb65eb03) frontend/src/components/tasks/TaskDetailsToolbar.tsx Errors are currently failing silently on actions like merge and rebase * fmt * fix * fix border
2025-08-27 23:59:26 +01:00
<div>
<Card className="bg-background p-3 border border-dashed text-sm">
Overhaul UI (#577) * font * flat ui * burger menu * button styles * drag effects * search * Improve * navbar * task details header WIP * task attempt window actions * task details * split out title description component * follow up * better board spacing * Incrementally use tanstack (vibe-kanban 0c34261d) Let's refactor the codebase to remove: @frontend/src/components/context/TaskDetailsContextProvider.tsx @frontend/src/components/context/TaskDetailsContextProvider.ts Instead, we want to use @tanstack/react-query * task attempt header info * ui for dropdown * optionally disable * Create hook for attempt actions (vibe-kanban 651551d9) - Start dev server - Rebase - Create PR - Merge These should all be hooks, similar to frontend/src/hooks/useOpenInEditor.ts Their usage in two places should be standardised: - frontend/src/components/tasks/AttemptHeaderCard.tsx - frontend/src/components/tasks/Toolbar/CurrentAttempt.tsx * dropdown positioning * color * soften colours * add new task button * editor dialog via hook * project provider * fmt * lint * follow up styling * break words * card styles * Stop executions from follow up (vibe-kanban e2a2c75b) The follow up section currently disables the 'send' button if a task attempt is running, however instead we should show a destructive 'stop' button which will perform the same functionality as 'stop attempt' frontend/src/components/tasks/TaskFollowUpSection.tsx You can see how we stop already in frontend/src/components/tasks/Toolbar/CurrentAttempt.tsx Maybe we could make this a hook and use tanstack similar to frontend/src/hooks/useBranchStatus.ts What about making the hook more generic, to cover start/stop and status retrieval. We should also combine the hook frontend/src/hooks/useExecutionProcesses.ts * Make sure the kanban columns are always at least full height (vibe-kanban 220cb780) There can be whitespace underneath the columns, ideally there should be no whitespace - the columns should extend to the bottom of the page, even when there aren't enough tasks to fill it up all the way ![Screenshot 2025-08-27 at 14.42.41.png](.vibe-images/11efe690-ec72-4513-a7b6-49641ff170c4.png) frontend/src/pages/project-tasks.tsx * Display diff summary (vibe-kanban f1736551) If files have been changed, we should display a summary of the changes like "6 files changed, +21 -19" in the AttemptHeaderCard, to the right of the dropdown, similar to how we do at the top of the difftab. We should also add an icon button to open the task attempt in full screen and at the diff tab. frontend/src/components/tasks/AttemptHeaderCard.tsx frontend/src/components/tasks/TaskDetails/DiffTab.tsx * styles * projects * full screen max width * full screen actions * remove log * style improve * create new attempt * darkmode * scroll diffs * Refactor useCreatePR (vibe-kanban e6b76f10) The useCreatePR hook should function similarly to useOpenInEditor, in that the the popup should be rendered in some root node. This improves the reusability of this functionality. We should then update TaskDetailsPanel to make the 'create pr' button real. frontend/src/hooks/useOpenInEditor.ts frontend/src/hooks/useCreatePR.ts frontend/src/components/tasks/TaskDetailsPanel.tsx * Rebasing should cause branch status to refresh (vibe-kanban 3da4fe0f) Currently doesn't in frontend/src/components/tasks/TaskDetailsPanel.tsx * project name * Change ?view=full to /full (vibe-kanban a25483a6) * Hide TaskDetailsHeader (vibe-kanban b73697bd) If the app is running inside of VS Code * copy * Add button to open repo (vibe-kanban e447df94) Open repo in IDE button in the navbar, next to create task button * style process cards * Errors not displayed properly (vibe-kanban fb65eb03) frontend/src/components/tasks/TaskDetailsToolbar.tsx Errors are currently failing silently on actions like merge and rebase * fmt * fix * fix border
2025-08-27 23:59:26 +01:00
Todos
</Card>
<div className="p-3">
<ul className="space-y-2">
{todos.map((todo, index) => (
<li
key={`${todo.content}-${index}`}
className="flex items-start gap-2"
>
<span className="mt-0.5 h-4 w-4 flex items-center justify-center shrink-0">
{getStatusIcon(todo.status)}
</span>
<span className="text-sm leading-5 break-words">
{todo.content}
</span>
</li>
))}
</ul>
</div>
</div>
);
}
export default TodoPanel;