Skip to content

Commit 98a99a7

Browse files
authored
fix: Misc minor UI changes for upcoming PRs (#628)
1 parent a3adc80 commit 98a99a7

5 files changed

Lines changed: 59 additions & 11 deletions

File tree

apps/twig/src/renderer/components/HeaderRow.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { RightSidebarTrigger } from "@features/right-sidebar/components/RightSid
22
import { useRightSidebarStore } from "@features/right-sidebar/stores/rightSidebarStore";
33
import { SidebarTrigger } from "@features/sidebar/components/SidebarTrigger";
44
import { useSidebarStore } from "@features/sidebar/stores/sidebarStore";
5-
import { ChangesTabBadge } from "@features/task-detail/components/ChangesTabBadge";
65
import { Box, Flex } from "@radix-ui/themes";
76
import { useHeaderStore } from "@stores/headerStore";
87
import { useNavigationStore } from "@stores/navigationStore";
@@ -119,9 +118,6 @@ export function HeaderRow() {
119118
}}
120119
>
121120
<RightSidebarTrigger />
122-
{rightSidebarOpen && (
123-
<ChangesTabBadge taskId={view.data.id} task={view.data} />
124-
)}
125121
{rightSidebarOpen && (
126122
<Box
127123
onMouseDown={handleRightSidebarMouseDown}

apps/twig/src/renderer/constants/keyboard-shortcuts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const SHORTCUTS = {
2-
COMMAND_MENU: "mod+shift+p",
2+
COMMAND_MENU: "mod+k",
33
NEW_TASK: "mod+n",
44
SETTINGS: "mod+,",
55
SHORTCUTS_SHEET: "mod+/",

apps/twig/src/renderer/features/message-editor/components/MessageEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
206206
</Flex>
207207
</Flex>
208208
{onModeChange && currentMode && (
209-
<ModeIndicatorInput mode={currentMode} />
209+
<ModeIndicatorInput mode={currentMode} taskId={taskId} />
210210
)}
211211
</Flex>
212212
);

apps/twig/src/renderer/features/message-editor/components/ModeIndicatorInput.tsx

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import type { ExecutionMode } from "@features/sessions/stores/sessionStore";
2-
import { Pause, Pencil, ShieldCheck } from "@phosphor-icons/react";
2+
import { useCwd } from "@features/sidebar/hooks/useCwd";
3+
import { Circle, Pause, Pencil, ShieldCheck } from "@phosphor-icons/react";
34
import { Flex, Text } from "@radix-ui/themes";
5+
import { trpcVanilla } from "@renderer/trpc";
6+
import { useQuery } from "@tanstack/react-query";
47

58
interface ModeIndicatorInputProps {
69
mode: ExecutionMode;
10+
taskId?: string;
711
}
812

913
const modeConfig: Record<
@@ -31,8 +35,23 @@ const modeConfig: Record<
3135
},
3236
};
3337

34-
export function ModeIndicatorInput({ mode }: ModeIndicatorInputProps) {
38+
export function ModeIndicatorInput({ mode, taskId }: ModeIndicatorInputProps) {
3539
const config = modeConfig[mode];
40+
const repoPath = useCwd(taskId ?? "");
41+
42+
const { data: diffStats } = useQuery({
43+
queryKey: ["diff-stats", repoPath],
44+
queryFn: () =>
45+
trpcVanilla.git.getDiffStats.query({
46+
directoryPath: repoPath as string,
47+
}),
48+
enabled: !!repoPath && !!taskId,
49+
staleTime: 5000,
50+
refetchInterval: 5000,
51+
placeholderData: (prev) => prev,
52+
});
53+
54+
const hasDiffStats = diffStats && diffStats.filesChanged > 0;
3655

3756
return (
3857
<Flex align="center" justify="between" py="1">
@@ -59,6 +78,30 @@ export function ModeIndicatorInput({ mode }: ModeIndicatorInputProps) {
5978
>
6079
(shift+tab to cycle)
6180
</Text>
81+
{hasDiffStats && (
82+
<Text
83+
size="1"
84+
style={{
85+
color: "var(--gray-9)",
86+
fontFamily: "monospace",
87+
display: "flex",
88+
alignItems: "center",
89+
gap: "6px",
90+
}}
91+
>
92+
<Circle size={4} weight="fill" style={{ margin: "0 4px" }} />
93+
<span style={{ color: "var(--gray-11)" }}>
94+
{diffStats.filesChanged}{" "}
95+
{diffStats.filesChanged === 1 ? "file" : "files"}
96+
</span>
97+
<span style={{ color: "var(--green-9)" }}>
98+
+{diffStats.linesAdded}
99+
</span>
100+
<span style={{ color: "var(--red-9)" }}>
101+
-{diffStats.linesRemoved}
102+
</span>
103+
</Text>
104+
)}
62105
</Flex>
63106
</Flex>
64107
);

apps/twig/src/renderer/features/sessions/components/GeneratingIndicator.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Campfire } from "@phosphor-icons/react";
1+
import { Campfire, Circle } from "@phosphor-icons/react";
22
import { Flex, Text } from "@radix-ui/themes";
33
import { useEffect, useState } from "react";
44

@@ -50,12 +50,21 @@ export function GeneratingIndicator({ startedAt }: GeneratingIndicatorProps) {
5050
>
5151
<Campfire size={14} weight="fill" className="campfire-pulse" />
5252
<Text size="1">{ACTIVITIES[activityIndex]}...</Text>
53+
<Text size="1" color="gray">
54+
(Esc to interrupt
55+
</Text>
56+
<Circle
57+
size={4}
58+
weight="fill"
59+
className="text-gray-9"
60+
style={{ margin: "0 2px" }}
61+
/>
5362
<Text
5463
size="1"
5564
color="gray"
56-
style={{ fontVariantNumeric: "tabular-nums", minWidth: "50px" }}
65+
style={{ fontVariantNumeric: "tabular-nums" }}
5766
>
58-
{formatDuration(elapsed)}
67+
{formatDuration(elapsed)})
5968
</Text>
6069
</Flex>
6170
);

0 commit comments

Comments
 (0)