Skip to content

armgit / E2B

Public Imported from GitHub
0

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

change function signature

ErikKaumk3caa94bdf209
diff --git a/apps/docs/src/app/(docs)/docs/pricing/SwitchToHobbyButton.tsx b/apps/docs/src/app/(docs)/docs/pricing/SwitchToHobbyButton.tsx
index 72ab1184d..c40554a01 100644
--- a/apps/docs/src/app/(docs)/docs/pricing/SwitchToHobbyButton.tsx
+++ b/apps/docs/src/app/(docs)/docs/pricing/SwitchToHobbyButton.tsx
@@ -9,7 +9,7 @@ import Spinner from '@/components/Spinner'
import { TierActiveTag } from './TierActiveTag'
-function SwitchToHobbyButton(team: Team) {
+function SwitchToHobbyButton({ team }: { team: Team }) {
const { user, isLoading } = useUser()
const [url, setURL] = useState('')
diff --git a/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx b/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx
index bd7465af6..778f8a99b 100644
--- a/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx
+++ b/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx
@@ -23,7 +23,7 @@ function createCheckout(tierID: string, teamID: string) {
})
}
-function SwitchTierButton(team: Team) {
+function SwitchTierButton({ team }: { team: Team }) {
const { user, isLoading } = useUser()
const [error, setError] = useState('')
diff --git a/apps/docs/src/app/(main)/dashboard/page.tsx b/apps/docs/src/app/(main)/dashboard/page.tsx
index eb309c45c..1fa49c017 100644
--- a/apps/docs/src/app/(main)/dashboard/page.tsx
+++ b/apps/docs/src/app/(main)/dashboard/page.tsx
@@ -28,8 +28,8 @@ function redirectToCurrentURL() {
}
// TODO: Sandbox and Templates tab deleted for now
-const menuLabels = ['personal', 'keys', 'usage' ,'billing', 'team',] as const
-type MenuLabel = typeof menuLabels[number]
+const menuLabels = ['personal', 'keys', 'usage', 'billing', 'team',] as const
+type MenuLabel = typeof menuLabels[number]
export default function Dashboard() {
const { user, isLoading, error } = useUser()
@@ -44,7 +44,7 @@ export default function Dashboard() {
const [currentTeam, setCurrentTeam] = useState<Team | null>(null)
const [currentApiKey, setCurrentApiKey] = useState<string | null>(null)
const [teams, setTeams] = useState<Team[]>([])
-
+
useEffect(() => {
if (user) {
if (teamParam) {
@@ -107,7 +107,7 @@ export default function Dashboard() {
<Sidebar selectedItem={selectedItem} setSelectedItem={setSelectedItem} teams={teams} user={user} currentTeam={currentTeam} setCurrentTeam={setCurrentTeam} setTeams={setTeams} />
<div className="flex-1 md:pl-10">
<h2 className='text-2xl mb-2 font-bold'>{selectedItem[0].toUpperCase() + selectedItem.slice(1)}</h2>
- <div className='border border-white/5 w-full h-[1px] mb-10'/>
+ <div className='border border-white/5 w-full h-[1px] mb-10' />
<MainContent selectedItem={selectedItem} user={user} team={currentTeam} currentApiKey={currentApiKey} teams={teams} setTeams={setTeams} setCurrentTeam={setCurrentTeam} />
</div>
</div>
@@ -124,7 +124,7 @@ export default function Dashboard() {
}
}
-const Sidebar = ({ selectedItem, setSelectedItem, teams, user ,currentTeam, setCurrentTeam, setTeams }) => (
+const Sidebar = ({ selectedItem, setSelectedItem, teams, user, currentTeam, setCurrentTeam, setTeams }) => (
<div className="md:h-full md:w-48 space-y-2 pb-10 md:pb-0">
<AccountSelector teams={teams} user={user} currentTeam={currentTeam} setCurrentTeam={setCurrentTeam} setTeams={setTeams} />
@@ -152,20 +152,20 @@ const iconMap: { [key in MenuLabel]: LucideIcon } = {
team: Users,
}
-const MenuItem = ({ icon: Icon, label , selected, onClick }: { icon: LucideIcon; label: MenuLabel; selected: boolean; onClick: () => void }) => (
- <div
- className={`flex w-fit md:w-full hover:bg-[#995100] hover:cursor-pointer rounded-lg items-center p-2 space-x-2 ${selected ? 'bg-[#995100]' : ''}`}
+const MenuItem = ({ icon: Icon, label, selected, onClick }: { icon: LucideIcon; label: MenuLabel; selected: boolean; onClick: () => void }) => (
+ <div
+ className={`flex w-fit md:w-full hover:bg-[#995100] hover:cursor-pointer rounded-lg items-center p-2 space-x-2 ${selected ? 'bg-[#995100]' : ''}`}
onClick={onClick}
>
<Icon width={20} height={20} />
<p className={`${!label || !window.matchMedia('(min-width: 768)').matches ? 'sr-only sm:not-sr-only' : ''}`}>
- {label[0].toUpperCase()+label.slice(1)}
+ {label[0].toUpperCase() + label.slice(1)}
</p>
</div>
)
-const MainContent = ({ selectedItem, user, team, currentApiKey, teams, setTeams, setCurrentTeam }: { selectedItem: MenuLabel, user: User, team: Team, currentApiKey: string | null, teams: Team[], setTeams: (teams: Team[]) => void, setCurrentTeam: (team: Team) => void}) => {
+const MainContent = ({ selectedItem, user, team, currentApiKey, teams, setTeams, setCurrentTeam }: { selectedItem: MenuLabel, user: User, team: Team, currentApiKey: string | null, teams: Team[], setTeams: (teams: Team[]) => void, setCurrentTeam: (team: Team) => void }) => {
switch (selectedItem) {
case 'personal':
return <PersonalContent user={user} />
@@ -174,7 +174,7 @@ const MainContent = ({ selectedItem, user, team, currentApiKey, teams, setTeams,
case 'usage':
return <UsageContent currentApiKey={currentApiKey} />
case 'billing':
- return <BillingContent currentApiKey={currentApiKey} />
+ return <BillingContent currentApiKey={currentApiKey} team={team} />
case 'team':
return <TeamContent team={team} user={user} teams={teams} setTeams={setTeams} setCurrentTeam={setCurrentTeam} />
default:
diff --git a/apps/docs/src/components/Dashboard/Billing.tsx b/apps/docs/src/components/Dashboard/Billing.tsx
index a94d58483..79ea2e04a 100644
--- a/apps/docs/src/components/Dashboard/Billing.tsx
+++ b/apps/docs/src/components/Dashboard/Billing.tsx
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react'
import Link from 'next/link'
-import { useUser } from '@/utils/useUser'
+import { Team, useUser } from '@/utils/useUser'
import { Button } from '../Button'
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table'
import SwitchToHobbyButton from '@/app/(docs)/docs/pricing/SwitchToHobbyButton'
@@ -20,7 +20,7 @@ interface Invoice {
date_created: string
}
-export const BillingContent = ({currentApiKey}: {currentApiKey: string | null}) => {
+export const BillingContent = ({ currentApiKey, team }: { currentApiKey: string | null, team: Team }) => {
const [invoices, setInvoices] = useState<Invoice[]>([])
const [credits, setCredits] = useState<number | null>(null)
@@ -38,10 +38,6 @@ export const BillingContent = ({currentApiKey}: {currentApiKey: string | null})
return
}
- //
- // TODO, why does the json serde not work in some cases?
- //
-
const invoices = await res.json() as Invoice[]
setInvoices(invoices)
@@ -58,8 +54,8 @@ export const BillingContent = ({currentApiKey}: {currentApiKey: string | null})
getInvoices()
}
}
- , [currentApiKey])
-
+ , [currentApiKey])
+
return (
<div className="flex flex-col w-full h-full pb-10">
<div className='flex items-center space-x-4 pb-10'>
@@ -80,11 +76,11 @@ export const BillingContent = ({currentApiKey}: {currentApiKey: string | null})
<div className='flex items-center space-x-4 pb-4'>
<h2 className='font-bold text-xl'>Change tier</h2>
</div>
-
+
<div className='flex flex-col items-start justify-center pb-10'>
<div className='flex items-center space-x-4'>
<h2>Hobby tier</h2>
- <SwitchToHobbyButton/>
+ <SwitchToHobbyButton team={team} />
</div>
<ul className='flex flex-col list-disc list-inside text-neutral-400'>
<li>One-time $100 credits</li>
@@ -97,7 +93,7 @@ export const BillingContent = ({currentApiKey}: {currentApiKey: string | null})
<div className='flex flex-col items-start justify-center pb-10'>
<div className='flex items-center space-x-4'>
<h2>Pro tier</h2>
- <SwitchToProButton/>
+ <SwitchToProButton team={team} />
</div>
<ul className='flex flex-col list-disc list-inside text-neutral-400'>
<li>One-time $100 credits</li>
@@ -112,37 +108,37 @@ export const BillingContent = ({currentApiKey}: {currentApiKey: string | null})
</div>
<Table>
- <TableHeader>
- <TableRow className='hover:bg-inherit dark:hover:bg-inherit border-b border-white/5 '>
- <TableHead>Date</TableHead>
- <TableHead>Cost</TableHead>
- <TableHead>Paid</TableHead>
- <TableHead>Invoice url</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {invoices && invoices.length > 0 ? (
- invoices.map((item, index) => (
- <TableRow
- className='hover:bg-orange-300/10 dark:hover:bg-orange-300/10 border-b border-white/5'
- key={index}
- >
- <TableCell>{new Date(item.date_created).toLocaleDateString()}</TableCell>
- <TableCell>${item.cost.toFixed(2)}</TableCell>
- <TableCell>{item.paid ? 'Paid' : 'Unpaid'}</TableCell>
- <TableCell><a className='hover:cursor-pointer' href={item.url} target="_blank" rel="noreferrer noopener">View invoice</a></TableCell>
+ <TableHeader>
+ <TableRow className='hover:bg-inherit dark:hover:bg-inherit border-b border-white/5 '>
+ <TableHead>Date</TableHead>
+ <TableHead>Cost</TableHead>
+ <TableHead>Paid</TableHead>
+ <TableHead>Invoice url</TableHead>
</TableRow>
- ))
- ) : (
- <TableRow className='border-b border-white/5'>
- <TableCell colSpan={4} className='text-center'>
- No invoices found
- </TableCell>
- </TableRow>
- )}
- </TableBody>
+ </TableHeader>
+ <TableBody>
+ {invoices && invoices.length > 0 ? (
+ invoices.map((item, index) => (
+ <TableRow
+ className='hover:bg-orange-300/10 dark:hover:bg-orange-300/10 border-b border-white/5'
+ key={index}
+ >
+ <TableCell>{new Date(item.date_created).toLocaleDateString()}</TableCell>
+ <TableCell>${item.cost.toFixed(2)}</TableCell>
+ <TableCell>{item.paid ? 'Paid' : 'Unpaid'}</TableCell>
+ <TableCell><a className='hover:cursor-pointer' href={item.url} target="_blank" rel="noreferrer noopener">View invoice</a></TableCell>
+ </TableRow>
+ ))
+ ) : (
+ <TableRow className='border-b border-white/5'>
+ <TableCell colSpan={4} className='text-center'>
+ No invoices found
+ </TableCell>
+ </TableRow>
+ )}
+ </TableBody>
</Table>
-
+
</div>
)
}