Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Add sign in with github

Vasek Mlejnsky561b0900c2ff
diff --git a/components/AuthForm.tsx b/components/AuthForm.tsx
index 36ecff555..de33cb65a 100644
--- a/components/AuthForm.tsx
+++ b/components/AuthForm.tsx
@@ -2,6 +2,7 @@ import clsx from 'clsx'
import { useEffect, useRef, useState, useCallback } from 'react'
import { useSupabaseClient } from '@supabase/auth-helpers-react'
import { useRouter } from 'next/router'
+import { useUser } from '@supabase/auth-helpers-react'
import Button from 'components/Button'
import Text from 'components/Text'
@@ -23,6 +24,7 @@ function AuthForm({ authType }: Props) {
const [errMessage, setErrMessage] = useState('')
const supabaseClient = useSupabaseClient<Database>()
const router = useRouter()
+ const user = useUser()
const emailRef = useRef<HTMLInputElement>(null)
const passwordRef = useRef<HTMLInputElement>(null)
@@ -78,6 +80,7 @@ function AuthForm({ authType }: Props) {
useEffect(
function autofocusEmailInput() {
+ console.log('user', user)
if (isLoading) return
if (!emailRef.current?.value) {
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 6816f875f..47592b2a5 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -22,8 +22,7 @@ function App({ Component, pageProps }: AppProps<{ initialSession: Session, proje
const router = useRouter()
const [supabaseClient] = useState(() => createBrowserSupabaseClient<Database>(clientCreds))
- const isSignIn = router.pathname === '/sign' && router.query.signup !== 'true'
- const isSignUp = router.pathname === '/sign' && router.query.signup === 'true'
+ const hasHeader = !router.pathname.startsWith('/sign') && !router.pathname.startsWith('/agent')
return (
<main className={clsx(
@@ -40,7 +39,7 @@ function App({ Component, pageProps }: AppProps<{ initialSession: Session, proje
supabaseClient={supabaseClient}
initialSession={pageProps.initialSession}
>
- {!isSignIn && !isSignUp &&
+ {hasHeader &&
<Header project={pageProps.project} />
}
<Component {...pageProps} />
diff --git a/pages/agent/smol-developer.tsx b/pages/agent/smol-developer.tsx
new file mode 100644
index 000000000..41e0b8427
--- /dev/null
+++ b/pages/agent/smol-developer.tsx
@@ -0,0 +1,50 @@
+import { useEffect } from 'react'
+import { useSupabaseClient } from '@supabase/auth-helpers-react'
+import { useUser } from '@supabase/auth-helpers-react'
+
+import Text from 'components/Text'
+import Button from 'components/Button'
+
+function SmolDeveloper() {
+ const supabaseClient = useSupabaseClient()
+ const user = useUser()
+
+ useEffect(function checkUser() {
+ console.log('user', user)
+ }, [user])
+
+ async function signInWithGitHub() {
+ const { data, error } = await supabaseClient.auth.signInWithOAuth({
+ provider: 'github',
+ options: {
+ redirectTo: window.location.href,
+ scopes: 'repo',
+ }
+ })
+ console.log({ data, error })
+ }
+
+ return (
+ <div className="
+ p-8
+ m-auto
+ flex-1
+ flex
+ flex-col
+ justify-start
+ space-y-4
+ ">
+ <Text
+ size={Text.size.S1}
+ text="Smol Developer"
+ />
+
+ <Button
+ text="Sign in with GitHub"
+ onClick={signInWithGitHub}
+ />
+ </div>
+ )
+}
+
+export default SmolDeveloper
\ No newline at end of file