From 0526a5db1f1cf01c037acc24e683b804f473163d Mon Sep 17 00:00:00 2001 From: Mish Ushakov Date: Fri, 6 Dec 2024 23:31:29 +0100 Subject: [PATCH] UX updates --- .../src/app/(dashboard)/dashboard/page.tsx | 8 ++-- .../components/Dashboard/AccountSelector.tsx | 11 +---- .../src/components/Dashboard/Developer.tsx | 44 ++++++++++++++++--- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/apps/web/src/app/(dashboard)/dashboard/page.tsx b/apps/web/src/app/(dashboard)/dashboard/page.tsx index d11eed9aa..e8abf1e21 100644 --- a/apps/web/src/app/(dashboard)/dashboard/page.tsx +++ b/apps/web/src/app/(dashboard)/dashboard/page.tsx @@ -10,6 +10,7 @@ import { Key, LucideIcon, PackageIcon, + PencilRuler, Settings, Users, } from 'lucide-react' @@ -46,6 +47,7 @@ const menuLabels = [ 'usage', 'billing', 'team', + 'developer', ] as const type MenuLabel = (typeof menuLabels)[number] @@ -189,9 +191,6 @@ const Sidebar = ({ currentTeam={currentTeam} setCurrentTeam={setCurrentTeam} setTeams={setTeams} - openDevSettings={() => { - setSelectedItem('developer') - }} />
@@ -216,6 +215,7 @@ const iconMap: { [key in MenuLabel]: LucideIcon } = { team: Users, templates: FileText, sandboxes: PackageIcon, + developer: PencilRuler, } const MenuItem = ({ @@ -303,7 +303,7 @@ function MainContent({ billingUrl={billingUrlState[0]} /> ) - case 'developer' as string: + case 'developer': return ( { const [isDialogOpen, setIsDialogOpen] = useState(false) const [teamName, setTeamName] = useState('') @@ -93,14 +92,6 @@ export const AccountSelector = ({ Create Team - - - - Developer - diff --git a/apps/web/src/components/Dashboard/Developer.tsx b/apps/web/src/components/Dashboard/Developer.tsx index f23f61e4a..1dbb9ea0a 100644 --- a/apps/web/src/components/Dashboard/Developer.tsx +++ b/apps/web/src/components/Dashboard/Developer.tsx @@ -2,6 +2,9 @@ import { Button } from '../Button' +const defaultAPIUrl = process.env.NEXT_PUBLIC_API_URL || '' +const defaultBillingUrl = process.env.NEXT_PUBLIC_BILLING_API_URL || '' + export const DeveloperContent = ({ apiUrlState, billingUrlState, @@ -12,12 +15,42 @@ export const DeveloperContent = ({ const [apiUrl, setApiUrl] = apiUrlState const [billingUrl, setBillingUrl] = billingUrlState + function isUrl(url: string) { + try { + new URL(url) + return true + } catch (e) { + return false + } + } + return (
-

Developer settings

+

Dashboard settings

API URL + + Customize E2B Cluster API URL. + + + {apiUrl !== defaultAPIUrl && ( +
+

+ Setting custom API URL in the E2B SDK & CLI +

+
+ In your environment variables, set E2B_DOMAIN variable to your + custom domain: +
+ E2B_DOMAIN={isUrl(apiUrl) ? new URL(apiUrl).host : 'Invalid URL'} +
+
+ )} +
Billing URL + + Customize E2B Billing API URL. +