Spaces:
Sleeping
Sleeping
Create app.tsx
Browse files
app.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import AgeGate from './components/AgeGate';
|
| 3 |
+
import ChatInterface from './components/ChatInterface';
|
| 4 |
+
|
| 5 |
+
function App() {
|
| 6 |
+
const [isVerified, setIsVerified] = useState<boolean>(false);
|
| 7 |
+
const [denied, setDenied] = useState<boolean>(false);
|
| 8 |
+
|
| 9 |
+
const handleVerification = (verified: boolean) => {
|
| 10 |
+
if (verified) {
|
| 11 |
+
setIsVerified(true);
|
| 12 |
+
} else {
|
| 13 |
+
setDenied(true);
|
| 14 |
+
}
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
if (denied) {
|
| 18 |
+
return (
|
| 19 |
+
<div className="h-screen w-full bg-gray-900 flex flex-col items-center justify-center p-6 text-center text-gray-300">
|
| 20 |
+
<h1 className="text-4xl font-bold text-red-500 mb-4">Access Denied</h1>
|
| 21 |
+
<p className="max-w-md">
|
| 22 |
+
You must be 21 years of age or older to view this content.
|
| 23 |
+
</p>
|
| 24 |
+
<button
|
| 25 |
+
onClick={() => setDenied(false)}
|
| 26 |
+
className="mt-8 text-sm text-gray-500 underline hover:text-gray-300"
|
| 27 |
+
>
|
| 28 |
+
Made a mistake?
|
| 29 |
+
</button>
|
| 30 |
+
</div>
|
| 31 |
+
);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
return (
|
| 35 |
+
<>
|
| 36 |
+
{!isVerified && <AgeGate onVerify={handleVerification} />}
|
| 37 |
+
{isVerified && <ChatInterface />}
|
| 38 |
+
</>
|
| 39 |
+
);
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
export default App;
|