Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"@heroicons/react": "^2.2.0",
"@hookform/resolvers": "^5.2.2",
"@marsidev/react-turnstile": "^1.4.0",
"@metamask/sdk-react": "^0.33.1",
"@neshca/cache-handler": "^1.9.0",
"@newrelic/next": "^0.10.0",
"@next/bundle-analyzer": "^16.1.1",
Expand Down Expand Up @@ -133,10 +132,6 @@
"@tiptap/starter-kit": "^3.14.0",
"@uptrace/node": "^2.1.0",
"@vercel/og": "^0.8.6",
"@web3-react/core": "8.2.3",
"@web3-react/metamask": "8.2.4",
"@web3-react/network": "8.2.3",
"@web3-react/types": "8.2.3",
"@xstate/react": "^6.0.0",
"blurhash": "^2.0.5",
"body-scroll-lock": "4.0.0-beta.0",
Expand Down
5,246 changes: 120 additions & 5,126 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/app/auth/auth-v2/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import type { Metadata } from 'next'
import Link from 'next/link'
import AuthByAppleButton from '@/components/auth.apple'
import AuthByGithub from '@/components/auth.github'
/* METAMASK DISABLED
import AuthByMetamask from '@/components/auth.metamask'
import MetaMaskProviderWrapper from '@/components/auth/metamask-provider-wrapper'
*/
import CKLogo from '@/components/logo/CKLogo'
import { generateMetadata as authGenerateMetadata } from '@/components/og/og-with-auth'
import { getBackgroundImageServer } from '@/hooks/theme.server'
Expand Down Expand Up @@ -41,9 +43,11 @@ async function AuthV2Page() {
Phone Number
</Link>
<hr className='my-4' />
{/* METAMASK DISABLED
<MetaMaskProviderWrapper>
<AuthByMetamask />
</MetaMaskProviderWrapper>
*/}
<AuthByAppleButton />
<AuthByGithub />

Expand Down
6 changes: 5 additions & 1 deletion src/app/auth/auth-v4/thirdPartEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import AppleStandaloneLoginButton from '@/components/auth/apple-standalone'
import GithubStandaloneLoginButton from '@/components/auth/github-standalone'
/* METAMASK DISABLED
import MetaMaskStandaloneLoginButton from '@/components/auth/metamask-standalone'
*/

function ThirdPartEntry() {
return (
Expand All @@ -16,13 +18,15 @@ function ThirdPartEntry() {
</div>
</div>

{/* METAMASK DISABLED
<MetaMaskStandaloneLoginButton />
*/}
<AppleStandaloneLoginButton />
<GithubStandaloneLoginButton />

<div className='pt-2 text-center'>
<p className='text-xs text-gray-500 dark:text-zinc-500'>
Secure authentication powered by blockchain and OAuth
Secure authentication powered by OAuth
</p>
</div>
</div>
Expand Down
17 changes: 17 additions & 0 deletions src/app/auth/callback/metamask/content.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use client'

/* METAMASK DISABLED - Package removed to prevent hydration errors
import { useCallback, useMemo } from 'react'
import AuthCallbackPageContainer from '@/components/auth/fake-layout'
import { useAuthBy3rdPartSuccessed } from '@/hooks/hooks'
Expand Down Expand Up @@ -57,3 +59,18 @@ function AuthCallbackMetamask(props: AuthCallbackMetamaskProps) {
}

export default AuthCallbackMetamask
*/

type AuthCallbackMetamaskProps = {
address: string
signature: string
text: string
}

// Disabled MetaMask callback - returns null
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function AuthCallbackMetamask(props: AuthCallbackMetamaskProps) {
return null
}

export default AuthCallbackMetamask
24 changes: 24 additions & 0 deletions src/app/auth/callback/metamask/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Metadata } from 'next'
import { generateMetadata as authGenerateMetadata } from '@/components/og/og-with-auth'
/* METAMASK DISABLED
import AuthCallbackMetamask from './content'
*/

export function generateMetadata(): Metadata {
return authGenerateMetadata('auth/callback/metamask')
Expand All @@ -10,11 +12,33 @@ type AppleCallbackPageProps = {
searchParams: Promise<{ a: string; s: string; t: string }>
}

/* METAMASK DISABLED - This page is no longer functional */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function MetamaskPage(props: AppleCallbackPageProps) {
/* METAMASK DISABLED
const { a: address, s: signature, t: text } = await props.searchParams
return (
<AuthCallbackMetamask address={address} signature={signature} text={text} />
)
*/
return (
<div className='flex items-center justify-center min-h-screen'>
<div className='text-center p-8'>
<h1 className='text-2xl font-bold text-gray-800 dark:text-gray-200 mb-4'>
MetaMask Login Disabled
</h1>
<p className='text-gray-600 dark:text-gray-400'>
MetaMask authentication is currently unavailable. Please use another login method.
</p>
<a
href='/auth/auth-v4'
className='mt-4 inline-block px-6 py-2 bg-blue-400 text-white rounded-lg hover:bg-blue-500 transition-colors'
>
Back to Login
</a>
Comment on lines +33 to +38

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better performance and to align with Next.js best practices, it's recommended to use the <Link> component for internal navigation instead of a standard <a> tag. This enables client-side navigation without a full page reload.

You'll need to import it at the top of the file:

import Link from 'next/link'
Suggested change
<a
href='/auth/auth-v4'
className='mt-4 inline-block px-6 py-2 bg-blue-400 text-white rounded-lg hover:bg-blue-500 transition-colors'
>
Back to Login
</a>
<Link
href='/auth/auth-v4'
className='mt-4 inline-block px-6 py-2 bg-blue-400 text-white rounded-lg hover:bg-blue-500 transition-colors'
>
Back to Login
</Link>

</div>
</div>
)
}

export default MetamaskPage
10 changes: 7 additions & 3 deletions src/app/dash/[userid]/newbie/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { useRouter } from 'next/navigation'
import { useEffect, useMemo, useState } from 'react'
import toast from 'react-hot-toast'
import ButtonSimple from '@/components/button/button-simple'
/* METAMASK DISABLED
import MetamaskBindButton from '@/components/externalAccount/metamask.bind'
*/
import FieldInput from '@/components/input'
import ProgressBlock from '@/components/progress/progress-block'
import { useTranslation } from '@/i18n/client'
Expand All @@ -15,7 +17,7 @@ function NewbiePageContent({ uid }: { uid: number }) {
// TODO:
// 1. update name
// 2. update domain
// 3. bind metamask
// 3. bind metamask (DISABLED)
// 4. bind apple
// 5. bind github
// 6. update avatar / select nft ?
Expand Down Expand Up @@ -160,21 +162,23 @@ function NewbiePageContent({ uid }: { uid: number }) {
toastPromiseDefaultOption
)
.then(() => {
setPhase(2)
setPhase(5) // Skip phase 2-4 (MetaMask/Apple/GitHub disabled) - go directly to avatar
})
}}
text='Confirm my domain'
/>
</div>
)}

{/* METAMASK DISABLED - Phase 2 is now skipped automatically
{phase === 2 && (
<MetamaskBindButton
onBound={() => {
setPhase(5)
}}
/>
)}
*/}
{phase === 3 && <div>TODO: bind apple</div>}
{phase === 4 && <div>TODO: bind github</div>}
{phase === 5 && (
Expand Down Expand Up @@ -211,7 +215,7 @@ function NewbiePageContent({ uid }: { uid: number }) {
})
setPhase((p) => p + 1)
toast.success(t('app.profile.editor.updated'), { id: tl })

} catch (e: any) {
toast.error(e.toString(), { id: tl })
}
Expand Down
23 changes: 11 additions & 12 deletions src/components/auth.metamask.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use client'

/* METAMASK DISABLED - Package removed to prevent hydration errors
import { useSDK } from '@metamask/sdk-react'
// import MetamaskLogo from './icons/metamask.logo.svg'
import { useRouter } from 'next/navigation'
Expand Down Expand Up @@ -35,23 +37,12 @@ function AuthByMetamask() {
)
return
}

} catch (err: any) {
toast.error(err.message)
}
}, [doAuth, router, metamaskSDK])

// useEffect(() => {
// // if (!err) {
// // return
// // }
// // toast.error('metamask: ' + err.message)
// void metaMask.connectEagerly().catch((err) => {
// console.debug('Failed to connect eagerly to metamask')
// toast.error('metamask: ' + err.message)
// })
// }, [])

useAuthBy3rdPartSuccessed(
doAuthData.called,
doAuthData.loading,
Expand All @@ -71,3 +62,11 @@ function AuthByMetamask() {
}

export default AuthByMetamask
*/

// Disabled MetaMask component - returns null
function AuthByMetamask() {
return null
}

export default AuthByMetamask
6 changes: 6 additions & 0 deletions src/components/auth/metamask-provider-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use client'

/* METAMASK DISABLED - Package removed to prevent hydration errors
import { MetaMaskProvider } from '@metamask/sdk-react'
*/
import type React from 'react'

interface MetaMaskProviderWrapperProps {
Expand All @@ -10,6 +12,7 @@ interface MetaMaskProviderWrapperProps {
export default function MetaMaskProviderWrapper({
children,
}: MetaMaskProviderWrapperProps) {
/* METAMASK DISABLED
return (
<MetaMaskProvider
sdkOptions={{
Expand All @@ -23,4 +26,7 @@ export default function MetaMaskProviderWrapper({
{children}
</MetaMaskProvider>
)
*/
// Return children directly without MetaMask provider
return <>{children}</>
}
14 changes: 14 additions & 0 deletions src/components/auth/metamask-standalone.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use client'

/* METAMASK DISABLED - Package removed to prevent hydration errors
import { useSDK } from '@metamask/sdk-react'
import * as sentry from '@sentry/react'
import { useRouter } from 'next/navigation'
Expand Down Expand Up @@ -124,3 +126,15 @@ export default function MetaMaskStandaloneLoginButton({
</div>
)
}
*/

interface MetaMaskStandaloneLoginButtonProps {
className?: string
onSuccess?: () => void
}

// Disabled MetaMask component - returns null
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export default function MetaMaskStandaloneLoginButton(props: MetaMaskStandaloneLoginButtonProps) {
return null
}
16 changes: 16 additions & 0 deletions src/components/auth/metamask.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* METAMASK DISABLED - Package removed to prevent hydration errors
import MetamaskLogo from '../icons/metamask.logo.svg'

type MetamaskButtonViewProps = {
Expand Down Expand Up @@ -32,3 +33,18 @@ function MetamaskButtonView(props: MetamaskButtonViewProps) {
}

export default MetamaskButtonView
*/

type MetamaskButtonViewProps = {
loading: boolean
onClick: () => void
disabled: boolean
}

// Disabled MetaMask button - returns null
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function MetamaskButtonView(props: MetamaskButtonViewProps) {
return null
}

export default MetamaskButtonView
8 changes: 8 additions & 0 deletions src/components/externalAccount/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import { useTranslation } from '@/i18n/client'
import { useFetchExternalAccountQuery } from '@/schema/generated'
import IconAppleLogo from '../icons/apple.logo.svg'
import GithubLogo from '../icons/github.logo.svg'
/* METAMASK DISABLED
import MetamaskLogo from '../icons/metamask.logo.svg'
*/
import AccountCard from './account-card'
import AppleLoginBind from './apple.bind'
import GithubBindButton from './github.bind'
/* METAMASK DISABLED
import dynamic from 'next/dynamic'

const MetamaskBindButton = dynamic(() => import('./metamask.bind'), { ssr: false })
*/

type ExternalAccountListProps = {
uid: number
Expand All @@ -22,9 +26,11 @@ function ExternalAccountList(props: ExternalAccountListProps) {
},
})

/* METAMASK DISABLED
const address = useMemo(() => {
return data?.me.externalInfo.address ?? []
}, [data?.me.externalInfo.address])
*/

const appleUnique = useMemo(() => {
return data?.me.externalInfo.appleUnique ?? ''
Expand All @@ -39,13 +45,15 @@ function ExternalAccountList(props: ExternalAccountListProps) {
</h3>

<div className='flex flex-col gap-4'>
{/* METAMASK DISABLED
<AccountCard
icon={<MetamaskLogo size={24} />}
title='Metamask'
isBound={address.length > 0}
accountInfo={address}
bindComponent={<MetamaskBindButton />}
/>
*/}

<AccountCard
icon={<IconAppleLogo size={24} />}
Expand Down
18 changes: 17 additions & 1 deletion src/components/externalAccount/metamask.bind.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
'use client'

/* METAMASK DISABLED - Package removed to prevent hydration errors
import { useApolloClient } from '@apollo/client'
import { useSDK } from '@metamask/sdk-react'
import { useCallback } from 'react'
Expand Down Expand Up @@ -41,7 +44,7 @@ function MetamaskBindButton(props: MetamaskBindButtonProps) {
}
})
})

.catch((err: any) => {
toast.error(err.message)
})
Expand All @@ -61,3 +64,16 @@ function MetamaskBindButton(props: MetamaskBindButtonProps) {
}

export default MetamaskBindButton
*/

type MetamaskBindButtonProps = {
onBound?: (address: string) => void
}

// Disabled MetaMask bind button - returns null
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function MetamaskBindButton(props: MetamaskBindButtonProps) {
return null
}

export default MetamaskBindButton
Loading