@@ -6,76 +6,59 @@ import { useVariables } from '@gitroom/react/helpers/variable.context';
66import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component' ;
77import { useModals } from '@mantine/modals' ;
88import { LoadingComponent } from '@gitroom/frontend/components/layout/loading' ;
9- import { NeynarAuthButton , NeynarContextProvider , Theme , useNeynarContext } from '@neynar/react' ;
9+ import {
10+ NeynarAuthButton ,
11+ NeynarContextProvider ,
12+ Theme ,
13+ useNeynarContext ,
14+ } from '@neynar/react' ;
1015import { INeynarAuthenticatedUser } from '@neynar/react/dist/types/common' ;
16+ import { ButtonCaster } from '@gitroom/frontend/components/auth/providers/farcaster.provider' ;
1117
1218export const WrapcasterProvider : FC < Web3ProviderInterface > = ( props ) => {
13- const [ id , state ] = props . nonce . split ( '||' ) ;
19+ const [ _ , state ] = props . nonce . split ( '||' ) ;
1420 const modal = useModals ( ) ;
1521 const [ hide , setHide ] = useState ( false ) ;
1622
17- const auth = useCallback ( ( params : { user : INeynarAuthenticatedUser } ) => {
23+ const auth = useCallback ( ( code : string ) => {
1824 setHide ( true ) ;
19- return props . onComplete ( Buffer . from ( JSON . stringify ( params . user ) ) . toString ( 'base64' ) , state ) ;
20- } , [ ] ) ;
25+ return props . onComplete ( code , state ) ;
26+ } , [ state ] ) ;
2127
2228 return (
23- < NeynarContextProvider
24- settings = { {
25- clientId : id || '' ,
26- defaultTheme : Theme . Dark ,
27- // eventsCallbacks: {
28- // onAuthSuccess: (params: { user: INeynarAuthenticatedUser }) => {
29- // auth(params);
30- // },
31- // },
32- } }
33- >
34- < div className = "rounded-[4px] border border-customColor6 bg-sixth px-[16px] pb-[16px] relative w-full" >
35- < TopTitle title = { `Add Wrapcast` } />
36- < button
37- className = "outline-none absolute right-[20px] top-[20px] mantine-UnstyledButton-root mantine-ActionIcon-root hover:bg-tableBorder cursor-pointer mantine-Modal-close mantine-1dcetaa"
38- type = "button"
39- onClick = { ( ) => modal . closeAll ( ) }
29+ < div className = "rounded-[4px] border border-customColor6 bg-sixth px-[16px] pb-[16px] relative w-full" >
30+ < TopTitle title = { `Add Wrapcast` } />
31+ < button
32+ className = "outline-none absolute right-[20px] top-[20px] mantine-UnstyledButton-root mantine-ActionIcon-root hover:bg-tableBorder cursor-pointer mantine-Modal-close mantine-1dcetaa"
33+ type = "button"
34+ onClick = { ( ) => modal . closeAll ( ) }
35+ >
36+ < svg
37+ viewBox = "0 0 15 15"
38+ fill = "none"
39+ xmlns = "http://www.w3.org/2000/svg"
40+ width = "16"
41+ height = "16"
4042 >
41- < svg
42- viewBox = "0 0 15 15"
43- fill = "none"
44- xmlns = "http://www.w3.org/2000/svg"
45- width = "16"
46- height = "16"
47- >
48- < path
49- d = "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z"
50- fill = "currentColor"
51- fillRule = "evenodd"
52- clipRule = "evenodd"
53- > </ path >
54- </ svg >
55- </ button >
56- < div className = "justify-center items-center flex" >
57- { hide ? (
58- < div className = "justify-center items-center flex -mt-[90px]" >
59- < LoadingComponent width = { 100 } height = { 100 } />
60- </ div >
61- ) : (
62- < div className = "justify-center items-center flex py-[20px]" >
63- < Logged onSuccess = { auth } />
64- < NeynarAuthButton className = "right-4 top-4" />
65- </ div >
66- ) }
67- </ div >
43+ < path
44+ d = "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z"
45+ fill = "currentColor"
46+ fillRule = "evenodd"
47+ clipRule = "evenodd"
48+ > </ path >
49+ </ svg >
50+ </ button >
51+ < div className = "justify-center items-center flex" >
52+ { hide ? (
53+ < div className = "justify-center items-center flex -mt-[90px]" >
54+ < LoadingComponent width = { 100 } height = { 100 } />
55+ </ div >
56+ ) : (
57+ < div className = "justify-center items-center py-[20px] flex-col w-[500px]" >
58+ < ButtonCaster login = { auth } />
59+ </ div >
60+ ) }
6861 </ div >
69- </ NeynarContextProvider >
62+ </ div >
7063 ) ;
7164} ;
72-
73- export const Logged : FC < { onSuccess : ( params : { user : INeynarAuthenticatedUser } ) => void } > = ( props ) => {
74- const context = useNeynarContext ( ) ;
75- useEffect ( ( ) => {
76- if ( context . isAuthenticated && context . user ) {
77- props . onSuccess ( { user : context . user } ) ;
78- }
79- } , [ context . isAuthenticated ] ) ;
80- return null ;
81- }
0 commit comments