Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3172791

Browse files
committed
feat: make task panels resizable
1 parent 48bb534 commit 3172791

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"react-helmet-async": "2.0.5",
103103
"react-markdown": "9.0.3",
104104
"react-query": "npm:@tanstack/[email protected]",
105+
"react-resizable-panels": "3.0.3",
105106
"react-router-dom": "6.26.2",
106107
"react-syntax-highlighter": "15.6.1",
107108
"react-textarea-autosize": "8.5.9",

site/pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/pages/TaskPage/TaskApps.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const TaskApps: FC<TaskAppsProps> = ({ task }) => {
5757
}
5858

5959
return (
60-
<main className="flex-1 flex flex-col">
60+
<main className="flex flex-col h-full">
6161
<div className="w-full flex items-center border-0 border-b border-border border-solid">
6262
<div className="p-2 pb-0 flex gap-2 items-center">
6363
{embeddedApps.map((app) => (

site/src/pages/TaskPage/TaskPage.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { AI_PROMPT_PARAMETER_NAME, type Task } from "modules/tasks/tasks";
1212
import type { ReactNode } from "react";
1313
import { Helmet } from "react-helmet-async";
1414
import { useQuery } from "react-query";
15+
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
1516
import { useParams } from "react-router-dom";
1617
import { Link as RouterLink } from "react-router-dom";
1718
import { ellipsizeText } from "utils/ellipsizeText";
@@ -193,11 +194,15 @@ const TaskPage = () => {
193194
<Helmet>
194195
<title>{pageTitle(ellipsizeText(task.prompt, 64) ?? "Task")}</title>
195196
</Helmet>
196-
197-
<div className="h-full flex justify-stretch">
198-
<TaskSidebar task={task} />
199-
{content}
200-
</div>
197+
<PanelGroup autoSaveId="task" direction="horizontal">
198+
<Panel defaultSize={25} minSize={20}>
199+
<TaskSidebar task={task} />
200+
</Panel>
201+
<PanelResizeHandle>
202+
<div className="w-1 bg-border h-full hover:bg-border-hover transition-all relative" />
203+
</PanelResizeHandle>
204+
<Panel>{content}</Panel>
205+
</PanelGroup>
201206
</>
202207
);
203208
};

site/src/pages/TaskPage/TaskSidebar.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
import type { Task } from "modules/tasks/tasks";
2525
import type { FC } from "react";
2626
import { Link as RouterLink } from "react-router-dom";
27-
import { cn } from "utils/cn";
2827
import { truncateURI } from "utils/uri";
2928
import { TaskAppIFrame } from "./TaskAppIframe";
3029

@@ -89,15 +88,7 @@ export const TaskSidebar: FC<TaskSidebarProps> = ({ task }) => {
8988
const [sidebarApp, sidebarAppStatus] = getSidebarApp(task);
9089

9190
return (
92-
<aside
93-
className={cn([
94-
[
95-
"flex flex-col h-full shrink-0",
96-
"border-0 border-r border-solid border-border",
97-
],
98-
"w-[520px]",
99-
])}
100-
>
91+
<aside className="flex flex-col h-full shrink-0 w-full">
10192
<header className="border-0 border-b border-solid border-border p-4 pt-0">
10293
<div className="flex items-center justify-between py-1">
10394
<TooltipProvider>

0 commit comments

Comments
 (0)