@@ -11,6 +11,7 @@ export default function LoginButton() {
1111 const [ pullRequests , setPullRequests ] = useState ( [ ] ) ;
1212 const [ isLoading , setIsLoading ] = useState ( false ) ;
1313 const [ isSigningIn , setIsSigningIn ] = useState ( false ) ;
14+ const [ isConsentGiven , setConsentGiven ] = useState ( false ) ; // Consent state
1415
1516 useEffect ( ( ) => {
1617 if ( session ?. user ?. email ) {
@@ -28,7 +29,16 @@ export default function LoginButton() {
2829 }
2930 } , [ session ] ) ;
3031
32+ const handleConsentChange = ( ) => {
33+ setConsentGiven ( ! isConsentGiven ) ;
34+ } ;
35+
3136 const handleSignIn = async ( ) => {
37+ if ( ! isConsentGiven ) {
38+ alert ( "You must agree to the Privacy Policy to proceed." ) ;
39+ return ;
40+ }
41+
3242 setIsSigningIn ( true ) ;
3343 try {
3444 await signIn ( "github" ) ;
@@ -39,7 +49,6 @@ export default function LoginButton() {
3949 }
4050 } ;
4151
42-
4352 const size = 200 ;
4453
4554 if ( session ?. user ) {
@@ -130,9 +139,28 @@ export default function LoginButton() {
130139 Sign in with GitHub
131140 </ h2 >
132141 </ div >
142+ < div className = "consent-checkbox" >
143+ < input
144+ type = "checkbox"
145+ id = "consentCheckbox"
146+ checked = { isConsentGiven }
147+ onChange = { handleConsentChange }
148+ />
149+ < label htmlFor = "consentCheckbox" className = "pl-2" >
150+ I agree to the{ " " }
151+ < a
152+ href = "/privacy-policy"
153+ target = "_blank"
154+ rel = "noopener noreferrer"
155+ className = "text-blue-400 hover:underline"
156+ >
157+ Privacy Policy
158+ </ a >
159+ </ label >
160+ </ div >
133161 < button
134162 onClick = { handleSignIn }
135- className = "py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-gray-800 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 inline-flex items-center space-x-2"
163+ className = "py-2 px-4 my-4 border border-transparent text-sm font-medium rounded-md text-white bg-gray-800 hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 inline-flex items-center space-x-2"
136164 >
137165 { isSigningIn ? (
138166 < div className = "spinner" > </ div >
0 commit comments