Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Allow switching between code for stripe and base agent

Vasek Mlejnskyc91de8448b3a
diff --git a/components/Button.tsx b/components/Button.tsx
index 95ded837c..f8b928a55 100644
--- a/components/Button.tsx
+++ b/components/Button.tsx
@@ -65,7 +65,7 @@ function Button({
{iconPosition === IconPosition.Left && icon}
{text && (
<Text
- size={Text.size.S2}
+ size={Text.size.S3}
text={text}
/>
)}
diff --git a/components/Editor/index.tsx b/components/Editor/index.tsx
index 85baa5efc..b631ce5ff 100644
--- a/components/Editor/index.tsx
+++ b/components/Editor/index.tsx
@@ -12,7 +12,8 @@ import SidebarMenu, { MenuSection } from './SidebarMenu'
import Template from './Template'
import { supportedLanguages } from './languages'
import codeEditorContentStripe from './code-editor-content-stripe-agent.json'
-// import codeEditorContentBase from './code-editor-content-base-agent.json'
+import codeEditorContentBase from './code-editor-content-base-agent.json'
+import Button from 'components/Button'
const gutterHighlightRadius = '8px'
@@ -83,7 +84,10 @@ export interface Props {
}
function Editor({ project }: Props) {
+ console.log('project', project)
const ref = useRef<HTMLDivElement | null>(null)
+ // const editorContent = (project.data as any)?.state.templateID === 'StripeCheckout' ? codeEditorContentStripe.content : codeEditorContentBase.content
+ const [editorContent, setEditorContent] = useState(codeEditorContentBase.content)
const [selectedMenuSection, setSelectedMenuSection] = useState(
MenuSection.Run,
@@ -121,23 +125,45 @@ function Editor({ project }: Props) {
draggerClassName='bg-slate-400'
>
<div className="
- flex-1
- overflow-hidden
- relative
+ flex-1
+ flex
+ flex-col
">
- <CodeEditor
- theme={theme}
- className={`
- absolute
- inset-0
- not-prose
- `}
- content={codeEditorContentStripe.content}
- // content={codeEditorContentBase.content}
- lintGutter={false}
- filename="main.py"
- supportedLanguages={supportedLanguages}
- />
+ <div className="
+ p-1
+ flex
+ space-x-1
+ ">
+ <Button
+ text='StripeAgent.py'
+ onClick={() => setEditorContent(codeEditorContentStripe.content)}
+ />
+ <Button
+ text='BaseAgent.py'
+ onClick={() => setEditorContent(codeEditorContentBase.content)}
+ />
+ </div>
+ <div className="
+ flex-1
+ overflow-hidden
+ relative
+ ">
+
+ <CodeEditor
+ theme={theme}
+ className={`
+ absolute
+ inset-0
+ not-prose
+ `}
+ content={editorContent}
+ // content={codeEditorContentStripe.content}
+ // content={codeEditorContentBase.content}
+ lintGutter={false}
+ filename="main.py"
+ supportedLanguages={supportedLanguages}
+ />
+ </div>
</div>
<Template />
<Sidebar