Skip to content

Commit 27211de

Browse files
committed
feat: integrate code viewer and refactored panels into task detail
- Migrate from taskPanelLayoutStore to centralized panelLayoutStore - Add TabContentRenderer for code viewer integration - Add comprehensive integration tests for panel splitting - Simplify TaskDetail component - Remove deprecated useTaskArtifacts hook - Delete old taskPanelLayoutStore
1 parent ad3f7c8 commit 27211de

File tree

11 files changed

+758
-317
lines changed

11 files changed

+758
-317
lines changed

src/renderer/features/task-detail/components/FileTreePanel.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { usePanelLayoutStore } from "@features/panels";
12
import { useTaskData } from "@features/task-detail/hooks/useTaskData";
23
import { FileIcon, FolderIcon, FolderOpenIcon } from "@phosphor-icons/react";
34
import { Box, Flex, Text } from "@radix-ui/themes";
@@ -93,14 +94,18 @@ function buildTreeFromPaths(
9394
interface TreeItemProps {
9495
node: TreeNode;
9596
depth: number;
97+
taskId: string;
9698
}
9799

98-
function TreeItem({ node, depth }: TreeItemProps) {
100+
function TreeItem({ node, depth, taskId }: TreeItemProps) {
99101
const [isExpanded, setIsExpanded] = useState(depth === 0);
102+
const openFile = usePanelLayoutStore((state) => state.openFile);
100103

101-
const handleToggle = () => {
104+
const handleClick = () => {
102105
if (node.type === "folder") {
103106
setIsExpanded(!isExpanded);
107+
} else {
108+
openFile(taskId, node.path);
104109
}
105110
};
106111

@@ -113,10 +118,10 @@ function TreeItem({ node, depth }: TreeItemProps) {
113118
px="2"
114119
style={{
115120
paddingLeft: `${depth * 16 + 8}px`,
116-
cursor: node.type === "folder" ? "pointer" : "default",
121+
cursor: "pointer",
117122
}}
118123
className="rounded hover:bg-gray-2"
119-
onClick={handleToggle}
124+
onClick={handleClick}
120125
>
121126
{node.type === "folder" ? (
122127
isExpanded ? (
@@ -138,6 +143,7 @@ function TreeItem({ node, depth }: TreeItemProps) {
138143
key={`${child.name}-${index}`}
139144
node={child}
140145
depth={depth + 1}
146+
taskId={taskId}
141147
/>
142148
))}
143149
</Box>
@@ -205,7 +211,7 @@ export function FileTreePanel({ taskId, task }: FileTreePanelProps) {
205211
<Box height="100%" overflowY="auto" p="4">
206212
<Flex direction="column" gap="1">
207213
{fileTree.map((node) => (
208-
<TreeItem key={node.path} node={node} depth={0} />
214+
<TreeItem key={node.path} node={node} depth={0} taskId={taskId} />
209215
))}
210216
</Flex>
211217
</Box>

0 commit comments

Comments
 (0)