forked from stackblitz/bolt.new
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added terminal error capturing and automated fix prompt
- Loading branch information
1 parent
42bde1c
commit d327cfe
Showing
8 changed files
with
475 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "commit": "1e72d52278730f7d22448be9d5cf2daf12559486", "version": "0.0.2" } | ||
{ "commit": "42bde1cae43de887a6bc5a72f6352a63f65677e6" } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import type { ActionAlert } from '~/types/actions'; | ||
import { classNames } from '~/utils/classNames'; | ||
|
||
interface Props { | ||
alert: ActionAlert; | ||
clearAlert: () => void; | ||
postMessage: (message: string) => void; | ||
} | ||
|
||
export default function ChatAlert({ alert, clearAlert, postMessage }: Props) { | ||
const { type, title, description, content } = alert; | ||
|
||
const iconColor = | ||
type === 'error' ? 'text-bolt-elements-button-danger-text' : 'text-bolt-elements-button-primary-text'; | ||
|
||
return ( | ||
<div className={`rounded-lg border border-bolt-elements-borderColor bg-bolt-elements-background-depth-2 p-4`}> | ||
<div className="flex items-start"> | ||
{/* Icon */} | ||
<div className="flex-shrink-0"> | ||
{type === 'error' ? ( | ||
<div className={`i-ph:x text-xl ${iconColor}`}></div> | ||
) : ( | ||
<svg className={`h-5 w-5 ${iconColor}`} viewBox="0 0 20 20" fill="currentColor"> | ||
<path | ||
fillRule="evenodd" | ||
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
)} | ||
</div> | ||
|
||
{/* Content */} | ||
<div className="ml-3 flex-1"> | ||
<h3 className={`text-sm font-medium text-bolt-elements-textPrimary`}>{title}</h3> | ||
<div className={`mt-2 text-sm text-bolt-elements-textSecondary`}> | ||
<p>{description}</p> | ||
{/* {content && ( | ||
<pre className="mt-2 whitespace-pre-wrap font-mono text-xs bg-white bg-opacity-50 p-2 rounded"> | ||
{content} | ||
</pre> | ||
)} */} | ||
</div> | ||
|
||
{/* Actions */} | ||
<div className="mt-4"> | ||
<div className={classNames(' flex gap-2')}> | ||
{type === 'error' && ( | ||
<button | ||
onClick={() => postMessage(`*Fix this error on terminal* \n\`\`\`\n${content}\n\`\`\`\n`)} | ||
className={classNames( | ||
`px-2 py-1.5 rounded-md text-sm font-medium`, | ||
'bg-bolt-elements-button-primary-background', | ||
'hover:bg-bolt-elements-button-primary-backgroundHover', | ||
'focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-bolt-elements-button-danger-background', | ||
'text-bolt-elements-button-primary-text', | ||
)} | ||
> | ||
Fix Issue | ||
</button> | ||
)} | ||
<button | ||
onClick={clearAlert} | ||
className={classNames( | ||
`px-2 py-1.5 rounded-md text-sm font-medium`, | ||
'bg-bolt-elements-button-secondary-background', | ||
'hover:bg-bolt-elements-button-secondary-backgroundHover', | ||
'focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-bolt-elements-button-secondary-background', | ||
'text-bolt-elements-button-secondary-text', | ||
)} | ||
> | ||
Dismiss | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.