* feat: /title slash command * fix: /title slash command should be able to be submitted with text * test: add tests for last commit's changes * fix: EOF in action.yml * feat: list remote sessions in cn ls and /resume * feat: load more sessions and make them scrollable * chore: format * improv: debug script builds automatically for cli * feat: load remote session * fix: wrap entrypoint in function so it doesn't run at import-time * feat: /diff and /apply slash commands for cn remote * feat: full screen diff viewer * feat: status message for /apply slash command * Update extensions/cli/src/ui/UserInput.tsx Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix: remove console.logs * Potential fix for code scanning alert no. 60: Uncontrolled command line Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 61: Uncontrolled command line Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix: build.js * feat: list remote sessions in history of extensions * feat: open remote agents in browser * chore: fix tests and lint * fix: import Text * fix: small bug * fix: address feedback * fix: adjust extension gui for compatibility with cli session history * feat: load session history from remote * feat: open remote session in browser * fix: tests, linting, formatting * fix: don't use any * address nitpicks --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
65 lines
1.4 KiB
TypeScript
65 lines
1.4 KiB
TypeScript
import { Box, Text, useInput } from "ink";
|
|
import React, { useEffect } from "react";
|
|
|
|
import { ColoredDiff } from "./ColoredDiff.js";
|
|
|
|
interface DiffViewerProps {
|
|
diffContent: string;
|
|
onClose: () => void;
|
|
}
|
|
|
|
/**
|
|
* Full-screen diff viewer overlay
|
|
* Shows diff content with syntax highlighting and allows closing with ESC
|
|
*/
|
|
export const DiffViewer: React.FC<DiffViewerProps> = ({
|
|
diffContent,
|
|
onClose,
|
|
}) => {
|
|
// Handle ESC key to close the diff viewer
|
|
useInput((input, key) => {
|
|
if (key.escape) {
|
|
onClose();
|
|
}
|
|
});
|
|
|
|
// Auto-focus when component mounts
|
|
useEffect(() => {
|
|
// Component is already focused by default in Ink
|
|
}, []);
|
|
|
|
return (
|
|
<Box
|
|
flexDirection="column"
|
|
height="100%"
|
|
borderStyle="single"
|
|
borderColor="blue"
|
|
padding={1}
|
|
>
|
|
{/* Header */}
|
|
<Box marginBottom={1}>
|
|
<Text color="blue" bold>
|
|
Git Diff (Press ESC to close)
|
|
</Text>
|
|
</Box>
|
|
|
|
{/* Diff content - scrollable */}
|
|
<Box flexDirection="column" flexGrow={1} overflow="hidden">
|
|
{diffContent.trim() ? (
|
|
<ColoredDiff diffContent={diffContent} />
|
|
) : (
|
|
<Text color="gray" italic>
|
|
No changes to display
|
|
</Text>
|
|
)}
|
|
</Box>
|
|
|
|
{/* Footer */}
|
|
<Box marginTop={1} justifyContent="center">
|
|
<Text color="gray" dimColor>
|
|
ESC to close
|
|
</Text>
|
|
</Box>
|
|
</Box>
|
|
);
|
|
};
|