feat: add AI chat button to open it
This commit is contained in:
parent
f6077ed516
commit
198b59aa55
@ -1028,6 +1028,8 @@ export default function CodeEditor({
|
|||||||
setFiles={setFiles}
|
setFiles={setFiles}
|
||||||
addNew={(name, type) => addNew(name, type, setFiles, sandboxData)}
|
addNew={(name, type) => addNew(name, type, setFiles, sandboxData)}
|
||||||
deletingFolderId={deletingFolderId}
|
deletingFolderId={deletingFolderId}
|
||||||
|
toggleAIChat={toggleAIChat}
|
||||||
|
isAIChatOpen={isAIChatOpen}
|
||||||
/>
|
/>
|
||||||
{/* Outer ResizablePanelGroup for main layout */}
|
{/* Outer ResizablePanelGroup for main layout */}
|
||||||
<ResizablePanelGroup
|
<ResizablePanelGroup
|
||||||
|
@ -10,7 +10,7 @@ import New from "./new"
|
|||||||
|
|
||||||
import { Button } from "@/components/ui/button"
|
import { Button } from "@/components/ui/button"
|
||||||
import { Skeleton } from "@/components/ui/skeleton"
|
import { Skeleton } from "@/components/ui/skeleton"
|
||||||
import { sortFileExplorer } from "@/lib/utils"
|
import { cn, sortFileExplorer } from "@/lib/utils"
|
||||||
import {
|
import {
|
||||||
dropTargetForElements,
|
dropTargetForElements,
|
||||||
monitorForElements,
|
monitorForElements,
|
||||||
@ -27,6 +27,8 @@ export default function Sidebar({
|
|||||||
setFiles,
|
setFiles,
|
||||||
addNew,
|
addNew,
|
||||||
deletingFolderId,
|
deletingFolderId,
|
||||||
|
toggleAIChat,
|
||||||
|
isAIChatOpen,
|
||||||
}: {
|
}: {
|
||||||
sandboxData: Sandbox
|
sandboxData: Sandbox
|
||||||
files: (TFile | TFolder)[]
|
files: (TFile | TFolder)[]
|
||||||
@ -43,6 +45,8 @@ export default function Sidebar({
|
|||||||
setFiles: (files: (TFile | TFolder)[]) => void
|
setFiles: (files: (TFile | TFolder)[]) => void
|
||||||
addNew: (name: string, type: "file" | "folder") => void
|
addNew: (name: string, type: "file" | "folder") => void
|
||||||
deletingFolderId: string
|
deletingFolderId: string
|
||||||
|
toggleAIChat: () => void
|
||||||
|
isAIChatOpen: boolean
|
||||||
}) {
|
}) {
|
||||||
const ref = useRef(null) // drop target
|
const ref = useRef(null) // drop target
|
||||||
|
|
||||||
@ -188,7 +192,7 @@ export default function Sidebar({
|
|||||||
style={{ opacity: 1 }}
|
style={{ opacity: 1 }}
|
||||||
>
|
>
|
||||||
<Sparkles className="h-4 w-4 mr-2 text-indigo-500 opacity-70" />
|
<Sparkles className="h-4 w-4 mr-2 text-indigo-500 opacity-70" />
|
||||||
Copilot
|
AI Editor
|
||||||
<div className="ml-auto">
|
<div className="ml-auto">
|
||||||
<kbd className="pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground">
|
<kbd className="pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground">
|
||||||
<span className="text-xs">⌘</span>G
|
<span className="text-xs">⌘</span>G
|
||||||
@ -197,12 +201,24 @@ export default function Sidebar({
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
className="w-full justify-start text-sm text-muted-foreground font-normal h-8 px-2 mb-2"
|
className={cn(
|
||||||
disabled
|
"w-full justify-start text-sm font-normal h-8 px-2 mb-2 border-t",
|
||||||
aria-disabled="true"
|
isAIChatOpen
|
||||||
|
? "bg-muted-foreground/25 text-foreground"
|
||||||
|
: "text-muted-foreground"
|
||||||
|
)}
|
||||||
|
onClick={toggleAIChat}
|
||||||
|
aria-disabled={false}
|
||||||
style={{ opacity: 1 }}
|
style={{ opacity: 1 }}
|
||||||
>
|
>
|
||||||
<MessageSquareMore className="h-4 w-4 mr-2 text-indigo-500 opacity-70" />
|
<MessageSquareMore
|
||||||
|
className={cn(
|
||||||
|
"h-4 w-4 mr-2",
|
||||||
|
isAIChatOpen
|
||||||
|
? "text-indigo-500"
|
||||||
|
: "text-indigo-500 opacity-70"
|
||||||
|
)}
|
||||||
|
/>
|
||||||
AI Chat
|
AI Chat
|
||||||
<div className="ml-auto">
|
<div className="ml-auto">
|
||||||
<kbd className="pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground">
|
<kbd className="pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground">
|
||||||
|
6
frontend/package-lock.json
generated
6
frontend/package-lock.json
generated
@ -37,6 +37,7 @@
|
|||||||
"@xterm/xterm": "^5.5.0",
|
"@xterm/xterm": "^5.5.0",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"embla-carousel": "^8.3.0",
|
||||||
"embla-carousel-react": "^8.3.0",
|
"embla-carousel-react": "^8.3.0",
|
||||||
"embla-carousel-wheel-gestures": "^8.0.1",
|
"embla-carousel-wheel-gestures": "^8.0.1",
|
||||||
"framer-motion": "^11.2.3",
|
"framer-motion": "^11.2.3",
|
||||||
@ -3128,12 +3129,14 @@
|
|||||||
"node_modules/embla-carousel": {
|
"node_modules/embla-carousel": {
|
||||||
"version": "8.3.0",
|
"version": "8.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.3.0.tgz",
|
||||||
"integrity": "sha512-Ve8dhI4w28qBqR8J+aMtv7rLK89r1ZA5HocwFz6uMB/i5EiC7bGI7y+AM80yAVUJw3qqaZYK7clmZMUR8kM3UA=="
|
"integrity": "sha512-Ve8dhI4w28qBqR8J+aMtv7rLK89r1ZA5HocwFz6uMB/i5EiC7bGI7y+AM80yAVUJw3qqaZYK7clmZMUR8kM3UA==",
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/embla-carousel-react": {
|
"node_modules/embla-carousel-react": {
|
||||||
"version": "8.3.0",
|
"version": "8.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/embla-carousel-react/-/embla-carousel-react-8.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/embla-carousel-react/-/embla-carousel-react-8.3.0.tgz",
|
||||||
"integrity": "sha512-P1FlinFDcIvggcErRjNuVqnUR8anyo8vLMIH8Rthgofw7Nj8qTguCa2QjFAbzxAUTQTPNNjNL7yt0BGGinVdFw==",
|
"integrity": "sha512-P1FlinFDcIvggcErRjNuVqnUR8anyo8vLMIH8Rthgofw7Nj8qTguCa2QjFAbzxAUTQTPNNjNL7yt0BGGinVdFw==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"embla-carousel": "8.3.0",
|
"embla-carousel": "8.3.0",
|
||||||
"embla-carousel-reactive-utils": "8.3.0"
|
"embla-carousel-reactive-utils": "8.3.0"
|
||||||
@ -3154,6 +3157,7 @@
|
|||||||
"version": "8.0.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/embla-carousel-wheel-gestures/-/embla-carousel-wheel-gestures-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/embla-carousel-wheel-gestures/-/embla-carousel-wheel-gestures-8.0.1.tgz",
|
||||||
"integrity": "sha512-LMAnruDqDmsjL6UoQD65aLotpmfO49Fsr3H0bMi7I+BH6jbv9OJiE61kN56daKsVtCQEt0SU1MrJslbhtgF3yQ==",
|
"integrity": "sha512-LMAnruDqDmsjL6UoQD65aLotpmfO49Fsr3H0bMi7I+BH6jbv9OJiE61kN56daKsVtCQEt0SU1MrJslbhtgF3yQ==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"wheel-gestures": "^2.2.5"
|
"wheel-gestures": "^2.2.5"
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
"@xterm/xterm": "^5.5.0",
|
"@xterm/xterm": "^5.5.0",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
|
"embla-carousel": "^8.3.0",
|
||||||
"embla-carousel-react": "^8.3.0",
|
"embla-carousel-react": "^8.3.0",
|
||||||
"embla-carousel-wheel-gestures": "^8.0.1",
|
"embla-carousel-wheel-gestures": "^8.0.1",
|
||||||
"framer-motion": "^11.2.3",
|
"framer-motion": "^11.2.3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user