Added privy
This commit is contained in:
parent
df0391104b
commit
9cf07a4875
0
app/auth.tsx
Normal file
0
app/auth.tsx
Normal file
25
app/page.tsx
25
app/page.tsx
|
|
@ -1,8 +1,8 @@
|
|||
"use client"; // This line marks the file as a client component
|
||||
"use client";
|
||||
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { SunIcon, MoonIcon } from "@heroicons/react/solid";
|
||||
import Image from "next/image";
|
||||
import { PrivyProvider, usePrivy } from "@privy-io/react-auth";
|
||||
|
||||
// Helper functions to generate pseudo data
|
||||
const generateRandomName = () => {
|
||||
|
|
@ -34,7 +34,8 @@ const generateTableData = (rows) => {
|
|||
|
||||
const tableData = generateTableData(10);
|
||||
|
||||
export default function Home() {
|
||||
function Home() {
|
||||
const { login, user, ready, logout } = usePrivy();
|
||||
const [darkMode, setDarkMode] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -58,9 +59,15 @@ export default function Home() {
|
|||
<button onClick={toggleDarkMode} className="bg-gray-700 hover:bg-gray-500 text-white font-bold py-2 px-4 rounded mr-2">
|
||||
{darkMode ? <SunIcon className="h-5 w-5 text-white" /> : <MoonIcon className="h-5 w-5 text-white" />}
|
||||
</button>
|
||||
<button className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||||
Login
|
||||
{ready && user ? (
|
||||
<button onClick={logout} className="bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded">
|
||||
Logout
|
||||
</button>
|
||||
) : (
|
||||
<button onClick={login} className="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||||
Login
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
<div className="flex-grow flex flex-col items-center justify-center w-full p-4">
|
||||
|
|
@ -92,3 +99,11 @@ export default function Home() {
|
|||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<PrivyProvider appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID || 'clxc7nmy906ifhis11rkovoto'}>
|
||||
<Home />
|
||||
</PrivyProvider>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
4704
package-lock.json
generated
4704
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -10,6 +10,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@privy-io/react-auth": "^1.70.0",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.1.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user