Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/server/src/keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export const DEFAULT_KEYBINDINGS: ReadonlyArray<KeybindingRule> = [
{ key: "mod+d", command: "terminal.split", when: "terminalFocus" },
{ key: "mod+n", command: "terminal.new", when: "terminalFocus" },
{ key: "mod+w", command: "terminal.close", when: "terminalFocus" },
{ key: "mod+d", command: "diff.toggle", when: "!terminalFocus" },
{ key: "mod+n", command: "chat.new", when: "!terminalFocus" },
{ key: "mod+shift+o", command: "chat.new", when: "!terminalFocus" },
{ key: "mod+shift+n", command: "chat.newLocal", when: "!terminalFocus" },
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/appSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export const AppSettingsSchema = Schema.Struct({
confirmThreadDelete: Schema.Boolean.pipe(withDefaults(() => true)),
autoDeleteMergedThreads: Schema.Boolean.pipe(withDefaults(() => false)),
autoDeleteMergedThreadsDelayMinutes: Schema.Number.pipe(withDefaults(() => 5)),
diffWordWrap: Schema.Boolean.pipe(withDefaults(() => false)),
enableAssistantStreaming: Schema.Boolean.pipe(withDefaults(() => false)),
showAuthFailuresAsErrors: Schema.Boolean.pipe(withDefaults(() => true)),
locale: AppLocale.pipe(withDefaults(() => DEFAULT_APP_LOCALE)),
Expand Down
51 changes: 1 addition & 50 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useDebouncedValue } from "@tanstack/react-pacer";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { useNavigate } from "@tanstack/react-router";
import { gitBranchesQueryOptions, gitCreateWorktreeMutationOptions } from "~/lib/gitReactQuery";
import { projectSearchEntriesQueryOptions } from "~/lib/projectReactQuery";
import {
Expand All @@ -42,7 +42,6 @@ import {
import { serverConfigQueryOptions, serverQueryKeys } from "~/lib/serverReactQuery";
import { isElectron } from "../env";
import { openFileReference } from "../fileOpen";
import { parseDiffRouteSearch, stripDiffSearchParams } from "../diffRouteSearch";
import {
clampCollapsedComposerCursor,
type ComposerTrigger,
Expand Down Expand Up @@ -407,10 +406,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
startY: number;
startSize: number;
} | null>(null);
const rawSearch = useSearch({
strict: false,
select: (params) => parseDiffRouteSearch(params),
});
const { resolvedTheme } = useTheme();
const queryClient = useQueryClient();
const createWorktreeMutation = useMutation(gitCreateWorktreeMutationOptions({ queryClient }));
Expand Down Expand Up @@ -669,7 +664,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
const isServerThread = serverThread !== undefined;
const isLocalDraftThread = !isServerThread && localDraftThread !== undefined;
const canCheckoutPullRequestIntoThread = isLocalDraftThread;
const diffOpen = rawSearch.diff === "1";
const activeThreadId = activeThread?.id ?? null;
const activeLatestTurn = activeThread?.latestTurn ?? null;
const activeContextWindow = useMemo(
Expand Down Expand Up @@ -1473,26 +1467,11 @@ export default function ChatView({ threadId }: ChatViewProps) {
() => shortcutLabelForCommand(keybindings, "terminal.close"),
[keybindings],
);
const diffPanelShortcutLabel = useMemo(
() => shortcutLabelForCommand(keybindings, "diff.toggle"),
[keybindings],
);
const platform = typeof navigator !== "undefined" ? navigator.platform : "";
const chatShortcutGuides = useMemo(
() => buildChatShortcutGuides(keybindings, platform),
[keybindings, platform],
);
const onToggleDiff = useCallback(() => {
void navigate({
to: "/$threadId",
params: { threadId },
replace: true,
search: (previous) => {
const rest = stripDiffSearchParams(previous);
return diffOpen ? { ...rest, diff: undefined } : { ...rest, diff: "1" };
},
});
}, [diffOpen, navigate, threadId]);

const pendingContext = useCodeViewerStore((state) => state.pendingContext);
const clearPendingContext = useCodeViewerStore((state) => state.clearPendingContext);
Expand Down Expand Up @@ -2775,13 +2754,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
return;
}

if (command === "diff.toggle") {
event.preventDefault();
event.stopPropagation();
onToggleDiff();
return;
}

const scriptId = projectScriptIdFromCommand(command);
if (!scriptId || !activeProject) return;
const script = activeProject.scripts.find((entry) => entry.id === scriptId);
Expand All @@ -2803,7 +2775,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
runProjectScript,
splitTerminal,
keybindings,
onToggleDiff,
toggleTerminalVisibility,
]);

Expand Down Expand Up @@ -4481,21 +4452,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
setExpandedImage(preview);
}, []);
const expandedImageItem = expandedImage ? expandedImage.images[expandedImage.index] : null;
const onOpenTurnDiff = useCallback(
(turnId: TurnId, filePath?: string) => {
void navigate({
to: "/$threadId",
params: { threadId },
search: (previous) => {
const rest = stripDiffSearchParams(previous);
return filePath
? { ...rest, diff: "1", diffTurnId: turnId, diffFilePath: filePath }
: { ...rest, diff: "1", diffTurnId: turnId };
},
});
},
[navigate, threadId],
);
const onRevertUserMessage = (messageId: MessageId) => {
const targetTurnCount = revertTurnCountByUserMessageId.get(messageId);
if (typeof targetTurnCount !== "number") {
Expand Down Expand Up @@ -4646,7 +4602,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
activeProjectId={activeProject?.id}
activeProjectName={activeProject?.name}
activeProjectCwd={activeProject?.cwd}
isGitRepo={isGitRepo}
isLocalDraftThread={isLocalDraftThread}
threadBranch={activeThread.branch ?? null}
openInCwd={gitCwd}
Expand All @@ -4658,12 +4613,10 @@ export default function ChatView({ threadId }: ChatViewProps) {
terminalAvailable={activeProject !== undefined}
terminalOpen={terminalState.terminalOpen}
terminalToggleShortcutLabel={terminalToggleShortcutLabel}
diffToggleShortcutLabel={diffPanelShortcutLabel}
previewAvailable={isElectron && activeProject !== undefined}
previewOpen={previewOpen}
previewDock={previewDock}
gitCwd={gitCwd}
diffOpen={diffOpen}
clientMode={clientMode}
onRenameDraftThreadTitle={(title) => {
setDraftThreadTitle(activeThread.id, title);
Expand All @@ -4676,7 +4629,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
onDeleteProjectScript={deleteProjectScript}
onImportProjectScripts={importProjectScripts}
onToggleTerminal={toggleTerminalVisibility}
onToggleDiff={onToggleDiff}
onTogglePreview={() => activeProjectId && togglePreviewOpen(activeProjectId)}
onTogglePreviewLayout={() => activeProjectId && togglePreviewLayout(activeProjectId)}
/>
Expand Down Expand Up @@ -4783,7 +4735,6 @@ export default function ChatView({ threadId }: ChatViewProps) {
nowIso={nowIso}
expandedWorkGroups={expandedWorkGroups}
onToggleWorkGroup={onToggleWorkGroup}
onOpenTurnDiff={onOpenTurnDiff}
revertTurnCountByUserMessageId={revertTurnCountByUserMessageId}
onRevertUserMessage={onRevertUserMessage}
isRevertingCheckpoint={isRevertingCheckpoint}
Expand Down
9 changes: 7 additions & 2 deletions apps/web/src/components/CodeViewerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { projectReadFileQueryOptions } from "~/lib/projectReactQuery";
import { cn, isMacPlatform } from "~/lib/utils";
import { isMarkdownPreviewFilePath } from "~/markdownPreview";
import { CodeMirrorViewer, type CodeContextSelection } from "./CodeMirrorViewer";
import { DiffPanelLoadingState } from "./DiffPanelShell";
import { Loader2Icon } from "lucide-react";
import { MarkdownPreview } from "./MarkdownPreview";
import { isElectron } from "~/env";
import { Button } from "./ui/button";
Expand Down Expand Up @@ -83,7 +83,12 @@ export const CodeViewerFileContent = memo(function CodeViewerFileContent(props:
);

if (query.isLoading) {
return <DiffPanelLoadingState label="Loading file..." />;
return (
<div className="flex flex-1 flex-col items-center justify-center gap-2 text-muted-foreground/60">
<Loader2Icon className="size-5 animate-spin" />
<span className="text-xs">Loading file...</span>
</div>
);
}

if (query.isError) {
Expand Down
Loading
Loading