aboutsummaryrefslogtreecommitdiff
path: root/apps/web/components/editor/generative/ai-completion-command.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/components/editor/generative/ai-completion-command.tsx')
-rw-r--r--apps/web/components/editor/generative/ai-completion-command.tsx69
1 files changed, 0 insertions, 69 deletions
diff --git a/apps/web/components/editor/generative/ai-completion-command.tsx b/apps/web/components/editor/generative/ai-completion-command.tsx
deleted file mode 100644
index 7fb64a0b..00000000
--- a/apps/web/components/editor/generative/ai-completion-command.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { CommandGroup, CommandItem, CommandSeparator } from "../ui/command";
-import { useEditor } from "novel";
-import { Check, TextQuote, TrashIcon } from "lucide-react";
-
-const AICompletionCommands = ({
- completion,
- onDiscard,
-}: {
- completion: string;
- onDiscard: () => void;
-}) => {
- const { editor } = useEditor();
- return (
- <>
- <CommandGroup>
- <CommandItem
- className="gap-2 px-4"
- value="replace"
- onSelect={() => {
- const selection = editor?.view.state.selection;
-
- if (!selection) return;
-
- editor
- ?.chain()
- .focus()
- .insertContentAt(
- {
- from: selection.from,
- to: selection.to,
- },
- completion,
- )
- .run();
- }}
- >
- <Check className="h-4 w-4 text-muted-foreground" />
- Replace selection
- </CommandItem>
- <CommandItem
- className="gap-2 px-4"
- value="insert"
- onSelect={() => {
- const selection = editor?.view.state.selection;
- if (!selection) return;
- editor
- ?.chain()
- .focus()
- .insertContentAt(selection.to + 1, completion)
- .run();
- }}
- >
- <TextQuote className="h-4 w-4 text-muted-foreground" />
- Insert below
- </CommandItem>
- </CommandGroup>
- <CommandSeparator />
-
- <CommandGroup>
- <CommandItem onSelect={onDiscard} value="thrash" className="gap-2 px-4">
- <TrashIcon className="h-4 w-4 text-muted-foreground" />
- Discard
- </CommandItem>
- </CommandGroup>
- </>
- );
-};
-
-export default AICompletionCommands;