Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
fix billing bug + reset passw + loading spinners
ErikKaumk29660686e274
diff --git a/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx b/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsxindex bc5fef55e..ca73cccc4 100644--- a/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx+++ b/apps/docs/src/app/(docs)/docs/pricing/SwitchToProButton.tsx@@ -78,14 +78,6 @@ function SwitchTierButton() {Switch to Pro</Button>)}-- {(user.pricingTier.id === tiers.pro.id && !user.teams[0].team_billing[0].credit_card_added) && (- <Button- onClick={createCheckoutSession}- >- Add Credit Card- </Button>- )}</div>{error && (@@ -95,4 +87,4 @@ function SwitchTierButton() {)}-export default SwitchTierButton+export default SwitchTierButton\ No newline at end of filediff --git a/apps/docs/src/app/(main)/dashboard/page.tsx b/apps/docs/src/app/(main)/dashboard/page.tsxindex af5b979bb..1cbba9f87 100644--- a/apps/docs/src/app/(main)/dashboard/page.tsx+++ b/apps/docs/src/app/(main)/dashboard/page.tsx@@ -1,7 +1,7 @@'use client'import { useEffect, useState } from 'react'-import { BarChart, CreditCard, Key, LucideIcon, Settings, Users } from 'lucide-react'+import { BarChart, CreditCard, Key, LoaderIcon, LucideIcon, Settings, Users } from 'lucide-react'import { BillingContent } from '@/components/Dashboard/Billing'import { TeamContent } from '@/components/Dashboard/Team'@@ -13,7 +13,19 @@ import { UsageContent } from '@/components/Dashboard/Usage'import { AccountSelector } from '@/components/Dashboard/AccountSelector'import { useRouter, useSearchParams } from 'next/navigation'import { PersonalContent } from '@/components/Dashboard/Personal'+import Link from 'next/link'+import { Button } from '@/components/Button'+function redirectToCurrentURL() {+ const url = typeof window !== 'undefined' ? window.location.href : undefined++ if (!url) {+ return ''+ }++ const encodedURL = encodeURIComponent(url)+ return `redirect_to=${encodedURL}`+}// TODO: Sandbox and Templates tab deleted for nowconst menuLabels = ['personal', 'keys', 'usage' ,'billing', 'team',] as const@@ -58,7 +70,12 @@ export default function Dashboard() {return <div>Error: {error.message}</div>}if (isLoading) {- return <div>Loading...</div>+ return (+ <div className='flex flex-col space-y-2 items-center justify-center w-full h-full'>+ <div className="text-xl font-bold">Loading...</div>+ <LoaderIcon className="animate-spin" />+ </div>+ )}if (user && currentTeam) {return (@@ -71,6 +88,15 @@ export default function Dashboard() {</div></div>)+ } else {+ return (+ <div className='flex flex-col space-y-2 items-center justify-center w-full h-full'>+ <h2 className='text-xl font-bold'>You need to be signed in to use this page</h2>+ <Link href={`/sign-in?${redirectToCurrentURL()}`}>+ <Button>Sign In</Button>+ </Link>+ </div>+ )}}diff --git a/apps/docs/src/components/Dashboard/Billing.tsx b/apps/docs/src/components/Dashboard/Billing.tsxindex 31862280d..a94d58483 100644--- a/apps/docs/src/components/Dashboard/Billing.tsx+++ b/apps/docs/src/components/Dashboard/Billing.tsx@@ -32,6 +32,16 @@ export const BillingContent = ({currentApiKey}: {currentApiKey: string | null})'X-Team-API-Key': currentApiKey!,},})+ if (!res.ok) {+ // TODO: add sentry error+ console.log(res)+ return+ }++ //+ // TODO, why does the json serde not work in some cases?+ //+const invoices = await res.json() as Invoice[]setInvoices(invoices)diff --git a/apps/docs/src/components/Dashboard/Personal.tsx b/apps/docs/src/components/Dashboard/Personal.tsxindex d2b25816b..8870095e8 100644--- a/apps/docs/src/components/Dashboard/Personal.tsx+++ b/apps/docs/src/components/Dashboard/Personal.tsx@@ -4,7 +4,7 @@ import { useToast } from '../ui/use-toast'import { Button } from '../Button'import { User } from '@supabase/supabase-js'import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs'-+import Link from 'next/link'export const PersonalContent = ({user}: {user: User}) => {const { toast } = useToast()@@ -24,15 +24,6 @@ export const PersonalContent = ({user}: {user: User}) => {})}- const resetPassword = async() => {- const supabase = createPagesBrowserClient()- await supabase.auth.resetPasswordForEmail('[email protected]', {- redirectTo: 'http://example.com/account/update-password',- })- }-- console.log(user.app_metadata.provider)-return(<div className="flex flex-col w-full h-full"><div className="flex flex-col h-full">@@ -62,7 +53,11 @@ export const PersonalContent = ({user}: {user: User}) => {The action cannot be undone.</span><div className='flex items-center space-x-2 pb-10'>- <Button variant='desctructive' onClick={resetPassword}>Reset password</Button>+ <Link href={'/sign-in?view=forgotten-password'}>+ <Button variant='desctructive'>+ Reset password+ </Button>+ </Link></div></>)}