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
202 changes: 202 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"tauri:build": "npm run doctor:strict && tauri build"
},
"dependencies": {
"@pierre/diffs": "^1.0.6",
"@tauri-apps/api": "^2",
"@tauri-apps/plugin-dialog": "^2",
"@tauri-apps/plugin-opener": "^2",
Expand All @@ -36,9 +37,9 @@
"@types/prismjs": "^1.26.5",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-react": "^4.6.0",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.36.1",
"eslint-plugin-react-hooks": "^4.6.2",
Expand Down
44 changes: 3 additions & 41 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import { useCopyThread } from "./features/threads/hooks/useCopyThread";
import { usePanelVisibility } from "./features/layout/hooks/usePanelVisibility";
import { useTerminalController } from "./features/terminal/hooks/useTerminalController";
import { playNotificationSound } from "./utils/notificationSounds";
import type { AccessMode, DiffLineReference, QueuedMessage, WorkspaceInfo } from "./types";
import type { AccessMode, QueuedMessage, WorkspaceInfo } from "./types";

function useWindowLabel() {
const [label, setLabel] = useState("main");
Expand Down Expand Up @@ -627,43 +627,6 @@ function MainApp() {
}
}

function handleActiveDiffPath(path: string) {
if (path !== selectedDiffPath) {
setSelectedDiffPath(path);
}
}

function handleDiffLineReference(reference: DiffLineReference) {
const startLine = reference.newLine ?? reference.oldLine;
const endLine =
reference.endNewLine ?? reference.endOldLine ?? startLine ?? null;
const lineRange =
startLine && endLine && endLine !== startLine
? `${startLine}-${endLine}`
: startLine
? `${startLine}`
: null;
const lineLabel = lineRange
? `${reference.path}:${lineRange}`
: reference.path;
const changeLabel =
reference.type === "add"
? "added"
: reference.type === "del"
? "removed"
: reference.type === "mixed"
? "mixed"
: "context";
const snippet = reference.lines.join("\n").trimEnd();
const snippetBlock = snippet ? `\n\`\`\`\n${snippet}\n\`\`\`` : "";
const label = reference.lines.length > 1 ? "Line range" : "Line reference";
const text = `${label} (${changeLabel}): ${lineLabel}${snippetBlock}`;
setComposerInsert({
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
text,
createdAt: Date.now()
});
}

const handleOpenSettings = useCallback(
(section?: SettingsSection) => {
Expand Down Expand Up @@ -741,13 +704,14 @@ function MainApp() {
terminalOpen,
onDebug: addDebugEntry,
});
const isDefaultScale = Math.abs(uiScale - 1) < 0.001;
const appClassName = `app ${isCompact ? "layout-compact" : "layout-desktop"}${
isPhone ? " layout-phone" : ""
}${isTablet ? " layout-tablet" : ""}${
reduceTransparency ? " reduced-transparency" : ""
}${!isCompact && sidebarCollapsed ? " sidebar-collapsed" : ""}${
!isCompact && rightPanelCollapsed ? " right-panel-collapsed" : ""
}`;
}${isDefaultScale ? " ui-scale-default" : ""}`;
const {
sidebarNode,
messagesNode,
Expand Down Expand Up @@ -909,8 +873,6 @@ function MainApp() {
gitDiffs,
gitDiffLoading: isDiffLoading,
gitDiffError: diffError,
onDiffLineReference: handleDiffLineReference,
onDiffActivePathChange: handleActiveDiffPath,
onSend: handleSend,
onQueue: queueMessage,
onStop: interruptTurn,
Expand Down
5 changes: 1 addition & 4 deletions src/features/git/components/GitDiffPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type GitDiffPanelProps = {
issuesLoading?: boolean;
issuesError?: string | null;
gitRemoteUrl?: string | null;
selectedPath?: string | null;
onSelectFile?: (path: string) => void;
files: {
path: string;
Expand Down Expand Up @@ -106,7 +105,6 @@ export function GitDiffPanel({
logLoading = false,
logTotal = 0,
gitRemoteUrl = null,
selectedPath,
onSelectFile,
files,
logEntries,
Expand Down Expand Up @@ -271,13 +269,12 @@ export function GitDiffPanel({
{files.map((file) => {
const { name, dir } = splitPath(file.path);
const { base, extension } = splitNameAndExtension(name);
const isSelected = file.path === selectedPath;
const statusSymbol = getStatusSymbol(file.status);
const statusClass = getStatusClass(file.status);
return (
<div
key={file.path}
className={`diff-row ${isSelected ? "active" : ""}`}
className="diff-row"
role="button"
tabIndex={0}
onClick={() => onSelectFile?.(file.path)}
Expand Down
Loading