-
Notifications
You must be signed in to change notification settings - Fork 13
/
dashboard.tsx
78 lines (76 loc) · 2.2 KB
/
dashboard.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import AuthenticatedPage from '@/components/authenticated-page'
import Section from '@/components/section'
import { usePrivy } from '@privy-io/react-auth'
import { links } from '@/lib/links'
const Dashboard = () => {
// You can also import other linking methods, like linkWallet, linkEmail, linkDiscord, etc.
const { user, linkPhone, linkGoogle, linkApple } = usePrivy()
return (
<AuthenticatedPage>
<Section>
<p className='text-md mt-2 font-bold uppercase text-gray-700'>
Your User Object
</p>
<p className='mt-2 text-sm text-gray-600'>
Inspect your linked accounts, or{' '}
<a
href={links.docs.userObject}
className='underline'
target='_blank'
rel='noreferrer noopener'
>
learn more
</a>
.
</p>
<textarea
value={JSON.stringify(user, null, 2)}
className='mt-4 h-64 w-full rounded-md bg-slate-700 p-4 font-mono text-xs text-slate-50 disabled:bg-slate-700'
rows={JSON.stringify(user, null, 2).split('\n').length}
readOnly
/>
</Section>
<Section>
<p className='text-md mt-8 font-bold uppercase text-gray-700'>
Account Linking
</p>
<p className='mt-2 text-sm text-gray-600'>
Link additional login methods, or{' '}
<a
href={links.docs.linking}
className='underline'
target='_blank'
rel='noreferrer noopener'
>
learn more
</a>
.
</p>
<div className='flex flex-row gap-2'>
<button
className='my-4 w-1/3 rounded-md bg-indigo-600 px-2 py-2.5 text-xs font-semibold text-white shadow-sm disabled:bg-indigo-400'
onClick={linkGoogle}
disabled={!!user?.google}
>
Google
</button>
<button
className='my-4 w-1/3 rounded-md bg-indigo-600 px-2 py-2.5 text-xs font-semibold text-white shadow-sm disabled:bg-indigo-400'
onClick={linkApple}
disabled={!!user?.apple}
>
Apple
</button>
<button
className='my-4 w-1/3 rounded-md bg-indigo-600 px-2 py-2.5 text-xs font-semibold text-white shadow-sm disabled:bg-indigo-400'
onClick={linkPhone}
disabled={!!user?.phone}
>
Phone
</button>
</div>
</Section>
</AuthenticatedPage>
)
}
export default Dashboard