Skip to content

Commit 361ab37

Browse files
authored
feat: session ui improvements (#250)
Some bug fixes, along with better chat UI, and rendering of interrupts and the agent todos: ![image.png](https://app.graphite.com/user-attachments/assets/f655f26d-a287-4e28-bf51-224116946712.png) --- ## Collapsed plan: ![image.png](https://app.graphite.com/user-attachments/assets/c8c27ad8-64e3-467f-afd8-7aca73f1106d.png) ## Expanded plan ![image.png](https://app.graphite.com/user-attachments/assets/8f9e121f-a682-4fb2-84b9-49a715f0199f.png)
1 parent 70dce2c commit 361ab37

31 files changed

+481
-491
lines changed

apps/array/src/main/services/workspace/workspaceService.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ export class WorkspaceService {
130130
log.info(`Switched to existing branch ${branch}`);
131131
}
132132
} catch (error) {
133-
log.error(`Failed to create/switch to branch ${branch}:`, error);
134-
throw new Error(
135-
`Failed to create/switch to branch ${branch}: ${String(error)}`,
136-
);
133+
const message = `Could not switch to branch "${branch}". Please commit or stash your changes first.`;
134+
log.error(message, error);
135+
this.emitWorkspaceError(taskId, message);
136+
throw new Error(message);
137137
}
138138
}
139139

apps/array/src/renderer/App.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { AuthScreen } from "@features/auth/components/AuthScreen";
33
import { useAuthStore } from "@features/auth/stores/authStore";
44
import { Flex, Spinner, Text } from "@radix-ui/themes";
55
import { initializePostHog } from "@renderer/lib/analytics";
6+
import { toast } from "@utils/toast";
67
import { useEffect, useState } from "react";
78

89
function App() {
@@ -14,6 +15,14 @@ function App() {
1415
initializePostHog();
1516
}, []);
1617

18+
// Global workspace error listener for toasts
19+
useEffect(() => {
20+
const unsubscribe = window.electronAPI?.workspace.onError((data) => {
21+
toast.error("Workspace error", { description: data.message });
22+
});
23+
return () => unsubscribe?.();
24+
}, []);
25+
1726
useEffect(() => {
1827
initializeOAuth().finally(() => setIsLoading(false));
1928
}, [initializeOAuth]);

apps/array/src/renderer/components/List.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function List({ children, as = "ul" }: ListProps) {
4444

4545
return (
4646
<Component
47+
className="marker:text-[var(--accent-10)]"
4748
style={{
4849
margin: 0,
4950
marginTop: "var(--space-2)",

apps/array/src/renderer/features/editor/components/MarkdownRenderer.tsx

Lines changed: 46 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ import {
66
Checkbox,
77
Code,
88
Em,
9-
Heading,
109
Kbd,
1110
Link,
12-
Strong,
13-
Table,
1411
Text,
1512
} from "@radix-ui/themes";
1613
import type { Components } from "react-markdown";
@@ -27,44 +24,20 @@ function preprocessMarkdown(content: string): string {
2724
return content.replace(/\n([^\n].*)\n(---+|___+|\*\*\*+)\n/g, "\n$1\n\n$2\n");
2825
}
2926

30-
const fontStyle = {
31-
fontSize: "var(--font-size-1-5)",
32-
lineHeight: "var(--line-height-1-5)",
33-
};
27+
const HeadingText = ({ children }: { children: React.ReactNode }) => (
28+
<Text as="p" size="1" mb="2" style={{ color: "var(--accent-11)" }}>
29+
<strong>{children}</strong>
30+
</Text>
31+
);
3432

3533
const components: Components = {
36-
h1: ({ children }) => (
37-
<Heading as="h1" size="4" mb="3" color="gray" highContrast>
38-
{children}
39-
</Heading>
40-
),
41-
h2: ({ children }) => (
42-
<Heading as="h2" size="3" mb="3" color="gray" highContrast>
43-
{children}
44-
</Heading>
45-
),
46-
h3: ({ children }) => (
47-
<Heading as="h3" size="2" mb="2" color="gray" highContrast>
48-
{children}
49-
</Heading>
50-
),
51-
h4: ({ children }) => (
52-
<Heading as="h4" size="2" mb="2" color="gray" highContrast>
53-
{children}
54-
</Heading>
55-
),
56-
h5: ({ children }) => (
57-
<Heading as="h5" size="2" mb="2" color="gray" highContrast>
58-
{children}
59-
</Heading>
60-
),
61-
h6: ({ children }) => (
62-
<Heading as="h6" size="2" mb="2" color="gray" highContrast>
63-
{children}
64-
</Heading>
65-
),
34+
h1: ({ children }) => <HeadingText>{children}</HeadingText>,
35+
h2: ({ children }) => <HeadingText>{children}</HeadingText>,
36+
h3: ({ children }) => <HeadingText>{children}</HeadingText>,
37+
h4: ({ children }) => <HeadingText>{children}</HeadingText>,
38+
h5: ({ children }) => <HeadingText>{children}</HeadingText>,
39+
h6: ({ children }) => <HeadingText>{children}</HeadingText>,
6640
p: ({ children, node }) => {
67-
// Check if paragraph only contains a strong element (used as pseudo-heading by LLMs)
6841
const isStrongOnly =
6942
node?.children?.length === 1 &&
7043
node.children[0].type === "element" &&
@@ -76,66 +49,66 @@ const components: Components = {
7649
size="1"
7750
mb={isStrongOnly ? "2" : "3"}
7851
color="gray"
79-
style={fontStyle}
8052
highContrast
8153
>
8254
{children}
8355
</Text>
8456
);
8557
},
8658
blockquote: ({ children }) => (
87-
<Blockquote size="2" mb="3" color="gray" style={fontStyle} highContrast>
59+
<Blockquote
60+
size="1"
61+
mb="3"
62+
style={{ color: "var(--accent-10)", borderColor: "var(--accent-6)" }}
63+
>
8864
{children}
8965
</Blockquote>
9066
),
9167
code: ({ children, className }) => {
9268
const isInline = !className?.includes("language-");
9369
if (isInline) {
9470
return (
95-
<Code
96-
size="2"
97-
variant="soft"
98-
color="gray"
99-
style={fontStyle}
100-
highContrast
101-
>
71+
<Code size="1" variant="soft" color="gray" highContrast>
10272
{children}
10373
</Code>
10474
);
10575
}
10676
return <code>{children}</code>;
10777
},
108-
pre: ({ children }) => <CodeBlock size="1.5">{children}</CodeBlock>,
109-
em: ({ children }) => <Em>{children}</Em>,
110-
strong: ({ children }) => <Strong>{children}</Strong>,
78+
pre: ({ children }) => <CodeBlock size="1">{children}</CodeBlock>,
79+
em: ({ children }) => (
80+
<Em style={{ color: "var(--accent-10)" }}>{children}</Em>
81+
),
82+
strong: ({ children }) => (
83+
<strong
84+
style={{ fontSize: "var(--font-size-1)", color: "var(--accent-11)" }}
85+
>
86+
{children}
87+
</strong>
88+
),
11189
del: ({ children }) => (
112-
<del style={{ textDecoration: "line-through", color: "var(--gray-11)" }}>
90+
<del style={{ textDecoration: "line-through", color: "var(--gray-9)" }}>
11391
{children}
11492
</del>
11593
),
11694
a: ({ href, children }) => (
117-
<Link
118-
href={href}
119-
target="_blank"
120-
rel="noopener noreferrer"
121-
style={fontStyle}
122-
>
95+
<Link href={href} target="_blank" rel="noopener noreferrer" size="1">
12396
{children}
12497
</Link>
12598
),
126-
kbd: ({ children }) => <Kbd style={fontStyle}>{children}</Kbd>,
99+
kbd: ({ children }) => <Kbd size="1">{children}</Kbd>,
127100
ul: ({ children }) => (
128-
<List as="ul" size="1.5">
101+
<List as="ul" size="1">
129102
{children}
130103
</List>
131104
),
132105
ol: ({ children }) => (
133-
<List as="ol" size="1.5">
106+
<List as="ol" size="1">
134107
{children}
135108
</List>
136109
),
137-
li: ({ children }) => <ListItem size="1.5">{children}</ListItem>,
138-
hr: () => <Divider size="2" />,
110+
li: ({ children }) => <ListItem size="1">{children}</ListItem>,
111+
hr: () => <Divider size="1" />,
139112
// Task list checkbox
140113
input: ({ type, checked }) => {
141114
if (type === "checkbox") {
@@ -149,22 +122,24 @@ const components: Components = {
149122
}
150123
return <input type={type} />;
151124
},
152-
// Table components using Radix Table
125+
// Table components - plain HTML for size control
153126
table: ({ children }) => (
154-
<Table.Root size="1" variant="surface" mb="3">
127+
<table className="mb-3" style={{ fontSize: "var(--font-size-1)" }}>
155128
{children}
156-
</Table.Root>
129+
</table>
157130
),
158-
thead: ({ children }) => <Table.Header>{children}</Table.Header>,
159-
tbody: ({ children }) => <Table.Body>{children}</Table.Body>,
160-
tr: ({ children }) => <Table.Row>{children}</Table.Row>,
131+
thead: ({ children }) => <thead>{children}</thead>,
132+
tbody: ({ children }) => <tbody>{children}</tbody>,
133+
tr: ({ children }) => <tr className="border-gray-6 border-b">{children}</tr>,
161134
th: ({ children, style }) => (
162-
<Table.ColumnHeaderCell style={{ ...fontStyle, ...style }}>
135+
<th className="px-2 py-1 text-left text-gray-11" style={style}>
163136
{children}
164-
</Table.ColumnHeaderCell>
137+
</th>
165138
),
166139
td: ({ children, style }) => (
167-
<Table.Cell style={{ ...fontStyle, ...style }}>{children}</Table.Cell>
140+
<td className="px-2 py-1 text-gray-12" style={style}>
141+
{children}
142+
</td>
168143
),
169144
};
170145

apps/array/src/renderer/features/sessions/components/ChatBubble.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)