Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Use template component

Jakub Novaka67f04dec6bd
diff --git a/apps/dashboard/components/Feedback/FeedbackButton.tsx b/apps/dashboard/components/Feedback/FeedbackButton.tsx
index e3c8290a2..6938c084c 100644
--- a/apps/dashboard/components/Feedback/FeedbackButton.tsx
+++ b/apps/dashboard/components/Feedback/FeedbackButton.tsx
@@ -18,7 +18,7 @@ function FeedbackButton({
}: Props) {
return (
<button
- className={clsx({ 'border-white/10 text-gray-100': isOpen, 'border-white/5 text-gray-400': !isOpen }, 'group ml-auto flex items-center space-x-1 cursor-pointer py-1 px-2 rounded-md bg-gray-900 border border-white/5 hover:border-white/10 transition-all hover:text-white')}
+ className={clsx({ 'border-white/10 text-gray-100': isOpen, 'border-white/5 text-gray-400': !isOpen }, 'group ml-auto flex items-center space-x-1 cursor-pointer py-1 px-2 rounded-md bg-gray-800 border border-white/5 hover:border-white/10 transition-all hover:text-white')}
onMouseDown={onClick}
>
{isFinished &&
diff --git a/apps/dashboard/components/Feedback/FeedbackModal.tsx b/apps/dashboard/components/Feedback/FeedbackModal.tsx
index 07480a5e1..dd8746c66 100644
--- a/apps/dashboard/components/Feedback/FeedbackModal.tsx
+++ b/apps/dashboard/components/Feedback/FeedbackModal.tsx
@@ -53,7 +53,7 @@ function FeedbackModal({ isOpen, onClose, onSend }: Props) {
mt-1
border
z-50
- bg-gray-900
+ bg-gray-800
border-white/5
w-[400px]
shadow-lg
diff --git a/apps/dashboard/components/Layout.tsx b/apps/dashboard/components/Layout.tsx
index 7e671bc83..4eac29bf7 100644
--- a/apps/dashboard/components/Layout.tsx
+++ b/apps/dashboard/components/Layout.tsx
@@ -136,7 +136,7 @@ function Layout({ children }: PropsWithChildren) {
<div className="flex flex-col flex-1 self-stretch overflow-hidden">
{/* Mobile menu icon */}
- <div className="rounded-md xl:hidden sticky top-0 z-40 flex justify-between h-16 shrink-0 items-center gap-x-6 border border-white/5 bg-gray-900 px-4 shadow-sm sm:px-6 lg:px-8">
+ <div className="rounded-md xl:hidden sticky top-0 z-40 flex justify-between h-16 shrink-0 items-center gap-x-6 border border-white/5 bg-gray-800 px-4 shadow-sm sm:px-6 lg:px-8">
<button
type="button"
className="-m-2.5 p-2.5 text-white xl:hidden"
@@ -153,14 +153,14 @@ function Layout({ children }: PropsWithChildren) {
</div>
{/* Header` */}
- <div className="hidden xl:flex px-4 py-2 border border-white/5 justify-end bg-gray-900 rounded-md">
+ <div className="hidden xl:flex px-4 py-2 border border-white/5 justify-end bg-gray-800 rounded-md">
<div className="flex justify-end space-x-4">
<StarUs />
<Feedback />
</div>
</div>
- <div className="mt-1 flex-1 flex flex-col self-stretch overflow-auto bg-gray-900 rounded-md border border-white/5">
+ <div className="mt-1 flex-1 flex flex-col self-stretch overflow-auto bg-gray-800 rounded-md border border-white/5">
{children}
</div>
</div>
diff --git a/apps/dashboard/components/Settings.tsx b/apps/dashboard/components/Settings.tsx
index fc2ded6ff..889faee6c 100644
--- a/apps/dashboard/components/Settings.tsx
+++ b/apps/dashboard/components/Settings.tsx
@@ -1,24 +1,57 @@
-import APIKey from './Settings/APIKey'
+import { User } from '@supabase/auth-helpers-nextjs'
+import { CopyIcon } from 'lucide-react'
+import {usePostHog} from 'posthog-js/react'
+import Link from 'next/link'
export interface Props {
apiKey: string
+ user: User
}
-function Settings({ apiKey }: Props) {
+export default function Settings({user, apiKey}: Props) {
+ const posthog = usePostHog()
+
+ const onClick = () => {
+ navigator.clipboard.writeText(apiKey)
+ posthog?.capture('copied API key')
+ }
return (
- <main className="overflow-hidden flex flex-col max-h-full flex-1 rounded-md">
- <header className="flex items-center px-4 py-3 border-b border-b-white/5 justify-between">
- <div className="flex items-center space-x-2">
- <h1 className="text-2xl font-semibold text-white">Settings</h1>
- </div>
- </header>
- <div className="space-x-4 overflow-hidden m-4">
- <div className="text-xl font-semibold text-white">API key</div>
- <APIKey apiKey={apiKey} />
+ <>
+ <div className="lg:w-3/4 align-middle lg:mx-12 lg:flex lg:gap-x-4 lg:px-2">
+ <main className=" px-6 lg:flex-auto lg:px-0 lg:py-10">
+ <div className="mx-auto space-y-16 sm:space-y-20 lg:mx-0 lg:max-w-none">
+ <div>
+ <h2 className="text-base font-semibold leading-7 text-white">Profile</h2>
+ <dl className="mt-6 space-y-6 divide-y divide-gray-100 border-t border-gray-200 text-white leading-6">
+ <div className="pt-6 sm:flex">
+ <dt className="font-medium text-white sm:w-64 sm:flex-none sm:pr-6">Email</dt>
+ <dd className="mt-1 mr-2 flex justify-end gap-x-6 sm:mt-0 sm:flex-auto">
+ <div className="text-white">{user.email}</div>
+ </dd>
+ </div>
+ </dl>
+ </div>
+
+ <div>
+ <h2 className="text-base font-semibold leading-7 text-white">API Key</h2>
+ <p className="mt-1 text-sm leading-6 text-gray-300">Use in <Link className="text-indigo-400" href={'https://github.com/e2b-dev/e2b/tree/main/packages/python-sdk'}>e2b SDK</Link>.</p>
+
+ <ul role="list" className="mt-6 divide-y divide-gray-100 border-t border-gray-200 text-sm leading-6">
+ <li className="flex justify-between gap-x-6 px-3 py-6">
+ <div className="font-medium text-white">{apiKey.substring(0,6) + '*'.repeat(8) + apiKey.substring(apiKey.length-8)}</div>
+ <CopyIcon
+ onClick={() => onClick()}
+ className="cursor-pointer text-indigo-400 hover:text-indigo-200"
+ size={18}
+ />
+ </li>
+ </ul>
+
+ </div>
+ </div>
+ </main>
</div>
- </main>
+ </>
)
}
-
-export default Settings
diff --git a/apps/dashboard/components/Settings/APIKey.tsx b/apps/dashboard/components/Settings/APIKey.tsx
deleted file mode 100644
index 439e66936..000000000
--- a/apps/dashboard/components/Settings/APIKey.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import { CopyIcon } from 'lucide-react'
-import {usePostHog} from 'posthog-js/react'
-
-interface Props {
- apiKey: string;
-}
-
-function APIKey({ apiKey }: Props) {
- const posthog = usePostHog()
-
- const onClick = () => {
- navigator.clipboard.writeText(apiKey)
- posthog?.capture('copied API key')
- }
-
- return (
- <div className="my-4 flex align-bottom justify-between w-3/4">
- <div
- className="mr-4 w-full text-center space-x-2 text-gray-200 border-2 rounded-md border-gray-200"
- >
- <span className="p-2 font-semibold">{apiKey}</span>
- </div>
- <CopyIcon
- onClick={() => onClick()}
- className="cursor-pointer place-self-center text-gray-200 hover:text-gray-400"
- size={24}
- />
- </div>
- )
-}
-
-export default APIKey
diff --git a/apps/dashboard/components/Sidebar/DashboardDesktopSidebar.tsx b/apps/dashboard/components/Sidebar/DashboardDesktopSidebar.tsx
index 897575d4c..5bfc6d2b5 100644
--- a/apps/dashboard/components/Sidebar/DashboardDesktopSidebar.tsx
+++ b/apps/dashboard/components/Sidebar/DashboardDesktopSidebar.tsx
@@ -19,7 +19,7 @@ function DashboardDesktopSidebar({
return (
<div className="hidden xl:self-stretch xl:z-50 xl:flex xl:w-[220px] xl:flex-col pr-1">
- <div className="flex grow flex-col gap-y-4 overflow-y-auto bg-gray-900 px-4 border border-white/5 rounded-md">
+ <div className="flex grow flex-col gap-y-4 overflow-y-auto bg-gray-800 px-4 border border-white/5 rounded-md">
{/* Logo */}
<nav className="flex flex-1 flex-col space-y-8 py-4">
<div className="font-bold text-gray-100">
diff --git a/apps/dashboard/components/Sidebar/DashboardMobileSidebar.tsx b/apps/dashboard/components/Sidebar/DashboardMobileSidebar.tsx
index a69c0a631..3d22a98e5 100644
--- a/apps/dashboard/components/Sidebar/DashboardMobileSidebar.tsx
+++ b/apps/dashboard/components/Sidebar/DashboardMobileSidebar.tsx
@@ -36,7 +36,7 @@ function DashboardMobileSidebar({
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
- <div className="fixed inset-0 bg-gray-900/80" />
+ <div className="fixed inset-0 bg-gray-800/80" />
</Transition.Child>
<div className="fixed inset-0 flex">
@@ -67,7 +67,7 @@ function DashboardMobileSidebar({
</div>
</Transition.Child>
{/* Sidebar component, swap this element with another sidebar if you like */}
- <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-gray-900 px-6 ring-1 ring-white/10">
+ <div className="flex grow flex-col gap-y-5 overflow-y-auto bg-gray-800 px-6 ring-1 ring-white/10">
{/* Logo */}
<nav className="flex flex-1 flex-col">
<ul role="list" className="flex flex-1 flex-col gap-y-7">
diff --git a/apps/dashboard/pages/settings.tsx b/apps/dashboard/pages/settings.tsx
index 0533bbcf3..4592abd38 100644
--- a/apps/dashboard/pages/settings.tsx
+++ b/apps/dashboard/pages/settings.tsx
@@ -1,5 +1,5 @@
import type { GetServerSideProps } from 'next'
-import { createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
+import { User, createServerSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { prisma } from 'db/prisma'
import { serverCreds } from 'db/credentials'
@@ -104,6 +104,7 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
return {
props: {
+ user: session.user,
apiKey: apiKey!.api_key,
}
}
@@ -111,10 +112,11 @@ export const getServerSideProps: GetServerSideProps<Props> = async (ctx) => {
interface Props {
apiKey: string
+ user: User
}
-function SettingsPage({ apiKey }: Props) {
- return <Settings apiKey={apiKey} />
+function SettingsPage({ apiKey, user }: Props) {
+ return <Settings apiKey={apiKey} user={user} />
}
export default SettingsPage