This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from XcavateBlockchain/connect-game-functions
Connect game functions
- Loading branch information
Showing
12 changed files
with
326 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {}; | ||
const nextConfig = { | ||
eslint: { | ||
ignoreDuringBuilds: true | ||
} | ||
}; | ||
|
||
export default nextConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,63 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { processImages } from '../../actions'; | ||
// import { processImages } from '../../actions'; | ||
import { checkResult } from '../../actions'; | ||
import { playGame } from '@/lib/extrinsic'; | ||
|
||
export default function HomePage() { | ||
const [imageSrcs, setImageSrcs] = useState<string[]>([]); | ||
const [loading, setLoading] = useState(false); | ||
const [error, setError] = useState(''); | ||
const [propertyDisplay, setPropertyDisplay] = useState(null); | ||
|
||
const handleGetImages = async () => { | ||
setLoading(true); | ||
setError(''); | ||
// const handleGetImages = async () => { | ||
// setLoading(true); | ||
// setError(''); | ||
// try { | ||
// // const images = await processImages(); | ||
// await checkResult(); | ||
// // setImageSrcs(images); | ||
// } catch (error) { | ||
// console.log(error); | ||
// setError('Failed to fetch images'); | ||
// } finally { | ||
// setLoading(false); | ||
// } | ||
// }; | ||
|
||
const handlePlayGame = async () => { | ||
console.log('Button clicked'); | ||
try { | ||
const images = await processImages(); | ||
setImageSrcs(images); | ||
await playGame(0, '5FEda1GYvjMYcBiuRE7rb85QbD5bQNHuZajhRvHYTxm4PPz5', data => { | ||
setPropertyDisplay(data); | ||
}); | ||
} catch (error) { | ||
setError('Failed to fetch images'); | ||
} finally { | ||
setLoading(false); | ||
console.log('error: ', error); | ||
} | ||
}; | ||
|
||
return ( | ||
<div> | ||
<h1>Home Page</h1> | ||
<button onClick={handleGetImages} disabled={loading}> | ||
{/* <button onClick={handleGetImages} disabled={loading}> | ||
{loading ? 'Processing...' : 'Get Processed Images'} | ||
</button> | ||
</button> */} | ||
{error && <p>{error}</p>} | ||
<div> | ||
{imageSrcs.map((src, index) => ( | ||
<img key={index} src={src} alt={`Processed Image ${index + 1}`} /> | ||
))} | ||
</div> | ||
|
||
<button onClick={handlePlayGame}>TEST BUTTON</button> | ||
{propertyDisplay && ( | ||
<div> | ||
<h3>Game Details:</h3> | ||
<p>{propertyDisplay}</p>{' '} | ||
{/* Adjust this to display actual data from propertyDisplay */} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.