diff --git a/app/components/chat/GitCloneButton.tsx b/app/components/chat/GitCloneButton.tsx index 0f14d75..587867a 100644 --- a/app/components/chat/GitCloneButton.tsx +++ b/app/components/chat/GitCloneButton.tsx @@ -1,10 +1,10 @@ import type { Message } from 'ai'; import ignore from 'ignore'; +import { useState } from 'react'; +import { GitCloneDialog } from '~/components/git/GitCloneDialog'; import WithTooltip from '~/components/ui/Tooltip'; import { IGNORE_PATTERNS } from '~/constants/ignorePatterns'; import { useGit } from '~/lib/hooks/useGit'; -import { useState } from 'react'; -import { GitCloneDialog } from '~/components/git/GitCloneDialog'; const ig = ignore().add(IGNORE_PATTERNS); const generateId = () => Math.random().toString(36).substring(2, 15); @@ -74,11 +74,7 @@ ${textDecoder.decode(content)} - setShowDialog(false)} - onClone={handleClone} - /> + setShowDialog(false)} onClone={handleClone} /> ); } diff --git a/app/components/git/GitCloneDialog.tsx b/app/components/git/GitCloneDialog.tsx index 5d91139..2c94a95 100644 --- a/app/components/git/GitCloneDialog.tsx +++ b/app/components/git/GitCloneDialog.tsx @@ -1,7 +1,6 @@ import { useState } from 'react'; -import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog'; -import { useGit } from '~/lib/hooks/useGit'; import { toast } from 'react-toastify'; +import { Dialog, DialogButton, DialogDescription, DialogRoot, DialogTitle } from '~/components/ui/Dialog'; interface GitCloneDialogProps { isOpen: boolean; @@ -19,15 +18,15 @@ export function GitCloneDialog({ isOpen, onClose, onClone }: GitCloneDialogProps e.preventDefault(); setIsLoading(true); + try { - // If it's a private repo, construct the URL with the token - const cloneUrl = isPrivate - ? repoUrl.replace('https://', `https://${token}@`) - : repoUrl; + // if it's a private repo, construct the URL with the token + const cloneUrl = isPrivate ? repoUrl.replace('https://', `https://${token}@`) : repoUrl; if (onClone) { await onClone(cloneUrl); } + toast.success('Repository cloned successfully!'); onClose(); } catch (error) { @@ -45,21 +44,11 @@ export function GitCloneDialog({ isOpen, onClose, onClone }: GitCloneDialogProps
@@ -107,4 +96,4 @@ export function GitCloneDialog({ isOpen, onClose, onClone }: GitCloneDialogProps ); -} \ No newline at end of file +} diff --git a/app/components/ui/IconButton.tsx b/app/components/ui/IconButton.tsx index f055d48..8bd6087 100644 --- a/app/components/ui/IconButton.tsx +++ b/app/components/ui/IconButton.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import type { ReactElement } from 'react'; +import React from 'react'; import { memo } from 'react'; import { classNames } from '~/utils/classNames'; diff --git a/app/components/ui/PanelHeaderButton.tsx b/app/components/ui/PanelHeaderButton.tsx index a35c79c..35ba9d2 100644 --- a/app/components/ui/PanelHeaderButton.tsx +++ b/app/components/ui/PanelHeaderButton.tsx @@ -1,5 +1,5 @@ -import React from 'react'; import type { ReactElement } from 'react'; +import React from 'react'; import { memo } from 'react'; import { classNames } from '~/utils/classNames'; diff --git a/app/components/ui/Slider.tsx b/app/components/ui/Slider.tsx index bde17fe..996f9e6 100644 --- a/app/components/ui/Slider.tsx +++ b/app/components/ui/Slider.tsx @@ -1,10 +1,10 @@ -import React from 'react'; import { motion } from 'framer-motion'; +import React from 'react'; import { memo } from 'react'; +import type { ReactElement } from 'react'; import { classNames } from '~/utils/classNames'; import { cubicEasingFn } from '~/utils/easings'; import { genericMemo } from '~/utils/react'; -import type { ReactElement } from 'react'; interface SliderOption { value: T; diff --git a/app/lib/runtime/action-runner.ts b/app/lib/runtime/action-runner.ts index a2c308d..c372761 100644 --- a/app/lib/runtime/action-runner.ts +++ b/app/lib/runtime/action-runner.ts @@ -2,10 +2,10 @@ import * as nodePath from 'node:path'; import { WebContainer } from '@webcontainer/api'; import { map, type MapStore } from 'nanostores'; import type { ActionCallbackData } from './message-parser'; +import { workbenchStore } from '~/lib/stores/workbench'; import type { BoltAction } from '~/types/actions'; import { createScopedLogger } from '~/utils/logger'; import { unreachable } from '~/utils/unreachable'; -import { workbenchStore } from '~/lib/stores/workbench'; const logger = createScopedLogger('ActionRunner'); @@ -129,7 +129,7 @@ export class ActionRunner { const webcontainer = await this.#webcontainer; - // Write the command to the Bolt terminal + // write the command to the Bolt terminal workbenchStore.writeToBoltTerminal(`\x1b[1;34m$ ${action.content}\x1b[0m\n`); const process = await webcontainer.spawn('jsh', ['-c', action.content], { @@ -153,7 +153,9 @@ export class ActionRunner { const exitCode = await process.exit; logger.debug(`Process terminated with code ${exitCode}`); - workbenchStore.writeToBoltTerminal(`\x1b[1;${exitCode === 0 ? '32' : '31'}mProcess exited with code ${exitCode}\x1b[0m\n\n`); + workbenchStore.writeToBoltTerminal( + `\x1b[1;${exitCode === 0 ? '32' : '31'}mProcess exited with code ${exitCode}\x1b[0m\n\n`, + ); } async #runFileAction(action: ActionState) { @@ -168,7 +170,7 @@ export class ActionRunner { // remove trailing slashes folder = folder.replace(/\/+$/g, ''); - // Write file creation to Bolt terminal + // write file creation to Bolt terminal workbenchStore.writeToBoltTerminal(`\x1b[1;34mCreating file: ${action.filePath}\x1b[0m\n`); if (folder !== '.') { diff --git a/app/lib/stores/bolt-terminal.ts b/app/lib/stores/bolt-terminal.ts index 486fe1e..a188a88 100644 --- a/app/lib/stores/bolt-terminal.ts +++ b/app/lib/stores/bolt-terminal.ts @@ -42,4 +42,4 @@ export class BoltTerminalStore { this.#terminal.terminal.write(data); } } -} \ No newline at end of file +} diff --git a/app/lib/stores/workbench.ts b/app/lib/stores/workbench.ts index c5e1d31..2c63d4f 100644 --- a/app/lib/stores/workbench.ts +++ b/app/lib/stores/workbench.ts @@ -1,9 +1,9 @@ import { atom, map, type MapStore, type ReadableAtom, type WritableAtom } from 'nanostores'; +import { BoltTerminalStore } from './bolt-terminal'; import { EditorStore } from './editor'; import { FilesStore, type FileMap } from './files'; import { PreviewsStore } from './previews'; import { TerminalStore } from './terminal'; -import { BoltTerminalStore } from './bolt-terminal'; import type { EditorDocument, ScrollPosition } from '~/components/editor/codemirror/CodeMirrorEditor'; import { ActionRunner } from '~/lib/runtime/action-runner'; import type { ActionCallbackData, ArtifactCallbackData } from '~/lib/runtime/message-parser'; diff --git a/app/utils/react.ts b/app/utils/react.ts index 6852bb9..6a96dc0 100644 --- a/app/utils/react.ts +++ b/app/utils/react.ts @@ -1,4 +1,4 @@ -import type { ComponentProps, ComponentType, JSXElementConstructor } from 'react'; +import type { ComponentProps, ComponentType } from 'react'; import { memo } from 'react'; export const genericMemo: >(