import { Anchor, Button, Separator, Text, View, YStack, XStack, isWeb, useThemeName } from '@my/ui'
import { ArrowLeft } from '@tamagui/lucide-icons'
import { JunwonLogoIcon } from 'app/assets/icon'
import { useThemeSetting } from 'app/provider/theme/UniversalThemeProvider'
import { useSupabase } from 'app/utils/supabase/useSupabase'
import { useUser } from 'app/utils/useUser'
import { useRouter } from 'solito/router'
import { useState, useEffect } from 'react'
function ControlPageOuterButton({ buttonText, href }) {
const buttonStyle = isWeb
? {
fontFamily: 'Spline+Sans',
fontWeight: 500,
}
: { fontFamily: 'SplineSansMedium' }
return (
{buttonText}
)
}
function ControlPageInnerButton({ buttonText, onPress }) {
const buttonStyle = isWeb
? {
fontFamily: 'Spline+Sans',
fontWeight: 500,
}
: { fontFamily: 'SplineSansMedium' }
return (
)
}
export function ControlPage() {
const supabase = useSupabase()
const router = useRouter()
const { user, isLoading } = useUser()
const { set: setTheme } = useThemeSetting()
const themeName = useThemeName()
const [currentTheme, setCurrentTheme] = useState(themeName)
const [isClient, setIsClient] = useState(false)
const displayThemeName = currentTheme.startsWith('dark') ? 'White Page' : 'Black Page'
useEffect(() => {
setCurrentTheme(themeName)
setIsClient(true) // Set to true only on client
}, [themeName])
return (
{!isLoading && user ? (
<>
router.push('/profile/collection')}
/>
router.push('/control/account-control')}
/>
{
supabase.auth.signOut()
router.push('/control')
}}
/>
>
) : (
router.push('/sign-in')}
/>
)}
router.push('/privacy-policy')}
/>
router.push('/terms-of-service')}
/>
{isClient && (
<>
{
setTheme(currentTheme.startsWith('dark') ? 'light' : 'dark')
}}
/>
>
)}
)
}