Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Improve sidebar menu UX [WIP]

Tomas Valenta2cecfeed4847
diff --git a/components/Editor/Sidebar/Agent/Tool/Base.tsx b/components/Editor/Sidebar/Agent/Tool/Base.tsx
index 6b0ed7afd..f9d716315 100644
--- a/components/Editor/Sidebar/Agent/Tool/Base.tsx
+++ b/components/Editor/Sidebar/Agent/Tool/Base.tsx
@@ -53,7 +53,6 @@ function BaseTool({
{body &&
<div className="
py-4
- max-w-full
overflow-x-auto
scroller
">
diff --git a/components/Editor/Sidebar/Agent/index.tsx b/components/Editor/Sidebar/Agent/index.tsx
index 1e3e38086..b0a429db6 100644
--- a/components/Editor/Sidebar/Agent/index.tsx
+++ b/components/Editor/Sidebar/Agent/index.tsx
@@ -70,10 +70,10 @@ function Agent({
return (
<div className="
- max-w-full
flex
flex-col
bg-slate-50
+ flex-1
overflow-hidden
">
<div className="
@@ -109,14 +109,28 @@ function Agent({
deployStatus={deployment?.state}
/>
</div>
- {selectedTab === 0 &&
+ {!deployment &&
+ <div
+ className="
+ self-center
+ flex
+ flex-1
+ "
+ >
+ <Text
+ className="text-slate-400"
+ text="No agent run found"
+ />
+ </div>
+ }
+ {selectedTab === 0 && deployment &&
<LogStream
- logs={deployment?.logs as Log[] | undefined}
+ logs={deployment.logs as unknown as Log[] | undefined}
onAnswer={saveAnswer}
isDeployRequestRunning={isDeployRequestRunning}
/>
}
- {selectedTab === 1 &&
+ {selectedTab === 1 && deployment &&
<LogStream
rawLogs={deployment?.logs_raw}
isDeployRequestRunning={isDeployRequestRunning}
diff --git a/components/Editor/Sidebar/Context.tsx b/components/Editor/Sidebar/Context.tsx
index e33fad2c4..590e8d15f 100644
--- a/components/Editor/Sidebar/Context.tsx
+++ b/components/Editor/Sidebar/Context.tsx
@@ -26,7 +26,6 @@ function Context({
return (
<div className="
- max-w-full
flex
flex-col
overflow-hidden
diff --git a/components/Editor/Sidebar/Deploy.tsx b/components/Editor/Sidebar/Deploy.tsx
new file mode 100644
index 000000000..01e5ea43d
--- /dev/null
+++ b/components/Editor/Sidebar/Deploy.tsx
@@ -0,0 +1,82 @@
+import { deployments } from '@prisma/client'
+import Text from 'components/Text'
+import Link from 'next/link'
+
+export interface Props {
+ deployment?: deployments
+}
+
+function Deploy({
+ deployment,
+}: Props) {
+
+ return (
+ <div className="
+ flex
+ flex-col
+ overflow-hidden
+ ">
+ <div className="
+ flex
+ bg-slate-50
+ items-center
+ justify-between
+ border-b
+ py-3.5
+ pr-4
+ ">
+ <Text
+ text="Deploy"
+ size={Text.size.S2}
+ className="
+ uppercase
+ text-slate-400
+ font-semibold
+ px-4
+ "
+ />
+ </div>
+ <div
+ className="
+ flex
+ flex-1
+ space-y-2
+ p-4
+ flex-col
+ "
+ >
+ <Text
+ text="Latest Deployment"
+ className="
+ font-semibold
+ uppercase
+ text-slate-400
+ "
+ size={Text.size.S3}
+ />
+ {deployment?.url &&
+ <Link
+ href={deployment.url}
+ className="underline"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <Text
+ size={Text.size.S3}
+ text={deployment.url.substring('https://'.length)}
+ />
+ </Link>
+ }
+ {!deployment?.url &&
+ <Text
+ text="No deployment URL found"
+ size={Text.size.S3}
+ className="text-slate-400"
+ />
+ }
+ </div>
+ </div>
+ )
+}
+
+export default Deploy
diff --git a/components/Editor/Sidebar/Envs.tsx b/components/Editor/Sidebar/Envs.tsx
index ec441ef9b..7b19a2d4b 100644
--- a/components/Editor/Sidebar/Envs.tsx
+++ b/components/Editor/Sidebar/Envs.tsx
@@ -30,10 +30,8 @@ function Envs() {
return (
<div className="
- max-w-full
flex
flex-col
- space-y-4
">
<div className="
flex
diff --git a/components/Editor/Sidebar/index.tsx b/components/Editor/Sidebar/index.tsx
index 1fb9a77ef..ff9934372 100644
--- a/components/Editor/Sidebar/index.tsx
+++ b/components/Editor/Sidebar/index.tsx
@@ -1,10 +1,8 @@
-import Link from 'next/link'
import { useEffect, useState } from 'react'
import clsx from 'clsx'
import useSWRMutation from 'swr/mutation'
import { projects } from '@prisma/client'
-import Text from 'components/Text'
import { Route, Block } from 'state/store'
import { useLatestDeployment } from 'hooks/useLatestDeployment'
import { useStateStore } from 'state/StoreProvider'
@@ -13,6 +11,7 @@ import { html2markdown } from 'editor/schema'
import Agent from './Agent'
import Envs from './Envs'
import Context from './Context'
+import Deploy from './Deploy'
export interface Props {
project: projects
@@ -27,8 +26,6 @@ export enum MenuSection {
Deploy = 'Deploy',
}
-
-
const apiHost = process.env.NODE_ENV === 'development'
? 'http://localhost:49155'
: 'https://ai-api-service-7d2cl2hooq-uc.a.run.app'
@@ -118,55 +115,7 @@ function Sidebar({
)}
>
{activeMenuSection === MenuSection.Deploy &&
- <div
- className="
- flex
- px-4
- py-2
- justify-start
- border-b
- flex-col
- "
- >
- <div
- className="
- flex
- flex-1
- items-center
- justify-between
- "
- >
- <Text
- text="Latest Deployment"
- className="
- font-semibold
- uppercase
- text-slate-400
- "
- size={Text.size.S2}
- />
- </div>
- {deployment?.url &&
- <Link
- href={deployment.url}
- className="underline"
- target="_blank"
- rel="noopener noreferrer"
- >
- <Text
- size={Text.size.S3}
- text={deployment.url.substring('https://'.length)}
- />
- </Link>
- }
- {!deployment?.url &&
- <Text
- text="No deployment URL found"
- size={Text.size.S3}
- className="text-slate-400"
- />
- }
- </div>
+ <Deploy />
}
{activeMenuSection === MenuSection.Context &&
<Context />