diff --git a/src/app/(dashboard)/home/_components/game-mode.tsx b/src/app/(dashboard)/home/_components/game-mode.tsx index 7d80228..2e2241d 100644 --- a/src/app/(dashboard)/home/_components/game-mode.tsx +++ b/src/app/(dashboard)/home/_components/game-mode.tsx @@ -29,13 +29,15 @@ import { useSubstrateContext } from '@/context/polkadot-contex'; import { getNextGameID } from '@/lib/queries'; import { submitGameAnswer } from '@/lib/extrinsic'; import Form, { useZodForm } from '@/components/ui/form'; +import { GameData } from '@/types'; interface GameProps { + data: GameData; setDisplay: Dispatch>; close: () => void; } -export default function GameMode({ setDisplay, close }: GameProps) { +export default function GameMode({ data, setDisplay, close }: GameProps) { // const [isPending, startTransition] = useTransition(); const [isLoading, setIsLoading] = useState(false); const [gameId, setGameID] = useState(); @@ -109,8 +111,9 @@ export default function GameMode({ setDisplay, close }: GameProps) { {Array.from({ length: 5 }).map((_, index) => ( - {Array.from({ length: 5 }).map((_, index) => ( + {data.images.map((image, index) => ( ))} - ( */} + + {/* ))} */} + {/* + /> */} @@ -150,22 +156,19 @@ export default function GameMode({ setDisplay, close }: GameProps) {

Property 1

- +

One bed luxury apartment,

- - + +
- - - + + {/* + */}
-

Key features

-

- Private balcony. Communal roof terrace. Residents concierge service. Close - proximity to green spaces. 999 year lease with peppercorn ground rent -

+

Summary

+

{data.summary}

@@ -196,7 +199,7 @@ export default function GameMode({ setDisplay, close }: GameProps) { interface DescriptionProps extends React.HTMLAttributes { title: string; - description?: string; + description?: any; } const DescriptionList = ({ className, title, description }: DescriptionProps) => { diff --git a/src/app/(dashboard)/home/_components/live-game-container.tsx b/src/app/(dashboard)/home/_components/live-game-container.tsx index a45855b..d60ec9c 100644 --- a/src/app/(dashboard)/home/_components/live-game-container.tsx +++ b/src/app/(dashboard)/home/_components/live-game-container.tsx @@ -28,7 +28,7 @@ type GameType = 0 | 1; export default function LiveGamePlay({ type }: { type: GameType }) { const [openGameSheet, setOpenGameSheet] = useState(false); - const [propertyDisplay, setPropertyDisplay] = useState(null); + const [propertyDisplay, setPropertyDisplay] = useState(); const [display, setDisplay] = useState<'start' | 'play' | 'success' | 'fail'>('start'); function closeGameSheet() { @@ -44,7 +44,7 @@ export default function LiveGamePlay({ type }: { type: GameType }) { setPropertyDisplay={setPropertyDisplay} /> ), - play: , + play: , success: , fail: }; @@ -91,10 +91,11 @@ function StartGame({ type, close, setDisplay, setPropertyDisplay }: GameProps) { async function onPlay() { try { setIsLoading(true); - await playGame(type, address, data => { - setPropertyDisplay(data); + await playGame(type, address, async data => { + setPropertyDisplay(await data); setDisplay('play'); }); + setIsLoading(false); } catch (error) { console.log(error); diff --git a/src/app/(dashboard)/home/_components/success-failure.tsx b/src/app/(dashboard)/home/_components/success-failure.tsx index 95f5397..40086cc 100644 --- a/src/app/(dashboard)/home/_components/success-failure.tsx +++ b/src/app/(dashboard)/home/_components/success-failure.tsx @@ -13,7 +13,7 @@ export function GuessPass({ close }: GameProps) { 1500
-
+
1500
-
+
diff --git a/src/app/(dashboard)/home/page.tsx b/src/app/(dashboard)/home/page.tsx index ce0f8e2..1c3ad49 100644 --- a/src/app/(dashboard)/home/page.tsx +++ b/src/app/(dashboard)/home/page.tsx @@ -14,6 +14,7 @@ import { getLeadBoards, getUserData } from '@/lib/queries'; import ProfileHeader from './_components/profile-header'; import { useSubstrateContext } from '@/context/polkadot-contex'; import { useCallback, useEffect, useState } from 'react'; +import { fetchPropertyData } from '@/app/actions'; // type Player = { // Player: 1; @@ -32,6 +33,8 @@ export default function App() { async function fetchData(address: string) { const boardList = await getLeadBoards(); + // const property = await fetchPropertyData(139361966) + // console.log(property) const userData = await getUserData(address); if (userData !== null && boardList !== null) { diff --git a/src/app/(dashboard)/leaderboard/page.tsx b/src/app/(dashboard)/leaderboard/page.tsx index 7177580..5509648 100644 --- a/src/app/(dashboard)/leaderboard/page.tsx +++ b/src/app/(dashboard)/leaderboard/page.tsx @@ -11,7 +11,7 @@ type LeaderProps = { winner?: boolean; }; -export function LeaderBoardCard({ points, winner }: LeaderProps) { +function LeaderBoardCard({ points, winner }: LeaderProps) { return (
@@ -21,7 +21,7 @@ export function LeaderBoardCard({ points, winner }: LeaderProps) { 01 )}
- Rounded avatar + Rounded avatar Victor X
@@ -30,7 +30,8 @@ export function LeaderBoardCard({ points, winner }: LeaderProps) {
); } -async function ChampionCard() { + +function ChampionCard() { return ( <>
@@ -51,14 +52,18 @@ async function ChampionCard() { ); } -export default async function Page() { + +export default function Page() { return (
- Rounded avatar

Deal Real Dev

diff --git a/src/app/(dashboard)/marketplace/page.tsx b/src/app/(dashboard)/marketplace/page.tsx index 7dfc631..4313b0a 100644 --- a/src/app/(dashboard)/marketplace/page.tsx +++ b/src/app/(dashboard)/marketplace/page.tsx @@ -4,6 +4,7 @@ import { Shell } from '@/components/shell'; import { Button } from '@/components/ui/button'; import { siteConfig } from '@/config/site'; import Image from 'next/image'; +import Link from 'next/link'; const collections = ['All', 'Blue', 'Red', 'Pink', 'Orange', 'Purple', 'Teal', 'Coral']; @@ -20,7 +21,7 @@ export default function Page({ return ( -
+
{data.map((nft: any) => ( - {collection} + {collection} ); })} @@ -61,7 +62,7 @@ export default function Page({

Listings

-
+
{siteConfig.nfts.map((nft: any) => (
- + @@ -85,7 +85,7 @@ export default function Tasks() { export const TaskCard = ({ type, title, description }: TaskCardProps) => { return ( -
+
{' '} {title} diff --git a/src/app/(dashboard)/test/page.tsx b/src/app/(dashboard)/test/page.tsx index 38afbef..a2bc413 100644 --- a/src/app/(dashboard)/test/page.tsx +++ b/src/app/(dashboard)/test/page.tsx @@ -29,7 +29,7 @@ export default function HomePage() { const handlePlayGame = async () => { console.log('Button clicked'); try { - await playGame(0, '5FEda1GYvjMYcBiuRE7rb85QbD5bQNHuZajhRvHYTxm4PPz5', data => { + await playGame(0, '5FEda1GYvjMYcBiuRE7rb85QbD5bQNHuZajhRvHYTxm4PPz5', async data => { setPropertyDisplay(data); }); } catch (error) { diff --git a/src/app/(page)/page.tsx b/src/app/(page)/page.tsx index b803e3c..5ff875f 100644 --- a/src/app/(page)/page.tsx +++ b/src/app/(page)/page.tsx @@ -36,7 +36,7 @@ export default function Home() {
-
+
@@ -44,7 +44,7 @@ export default function Home() {

win valuable NFTs

-
+
@@ -52,7 +52,7 @@ export default function Home() {

win valuable NFTs

-
+
@@ -60,7 +60,7 @@ export default function Home() {

win valuable NFTs

-
+
diff --git a/src/app/gameplay/_components/success.tsx b/src/app/gameplay/_components/success.tsx index 5b751f7..344c54c 100644 --- a/src/app/gameplay/_components/success.tsx +++ b/src/app/gameplay/_components/success.tsx @@ -9,7 +9,7 @@ export function SuccessRedirect() {

Points : {points}

-
+
@@ -33,7 +33,7 @@ export function FailRedirect() { Points : {points}x -
+

Sorry wrong guess

You have lost -10 points

diff --git a/src/components/cards/card.tsx b/src/components/cards/card.tsx index 1e318eb..c73918c 100644 --- a/src/components/cards/card.tsx +++ b/src/components/cards/card.tsx @@ -9,7 +9,7 @@ export function Card({ className, title, description, children, ...props }: Card return (
- ); @@ -362,7 +362,7 @@ const CarouselNext = forwardRef - + Next slide ); diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx index e1f1fa0..205e7c8 100644 --- a/src/components/ui/sheet.tsx +++ b/src/components/ui/sheet.tsx @@ -31,7 +31,7 @@ const SheetOverlay = React.forwardRef< SheetOverlay.displayName = SheetPrimitive.Overlay.displayName; const sheetVariants = cva( - 'fixed z-50 gap-4 bg-background p-6 transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', + 'fixed z-50 gap-4 bg-background p-6 transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out', { variants: { side: { diff --git a/src/components/ui/toast.tsx b/src/components/ui/toast.tsx index 12b09ab..cccb43e 100644 --- a/src/components/ui/toast.tsx +++ b/src/components/ui/toast.tsx @@ -83,7 +83,7 @@ const ToastClose = React.forwardRef< toast-close="" {...props} > - + )); ToastClose.displayName = ToastPrimitives.Close.displayName; diff --git a/src/config/site.ts b/src/config/site.ts index f03c340..a9e0e95 100644 --- a/src/config/site.ts +++ b/src/config/site.ts @@ -131,6 +131,7 @@ export const siteConfig = { latitude: 52.625284, longitude: 1.30124 }, + images: [], summary: 'Second floor apartment located a short stroll from the City centre, Good sized lounge, Kitchen/Diner, Two bedrooms, E-Suite & Bathroom, Double glazing & electric heating, Designated Parking Space.' } as GameData diff --git a/src/lib/extrinsic.ts b/src/lib/extrinsic.ts index 9df9f70..dfcbdef 100644 --- a/src/lib/extrinsic.ts +++ b/src/lib/extrinsic.ts @@ -16,7 +16,7 @@ function getPropertyId(gameId: number) {} export async function playGame( gameType: 0 | 1 | 2, address: string, - handlePropertyDisplay: (data: any) => void + handlePropertyDisplay: (data: any) => Promise ) { try { const api = await getApi(); @@ -43,7 +43,8 @@ export async function playGame( console.log('The game info is: ', gameInfo); const propertyDisplay = await fetchPropertyForDisplay(139361966); - handlePropertyDisplay(propertyDisplay); + console.log(propertyDisplay); + await handlePropertyDisplay(propertyDisplay); // console.log(propertyDisplay); @@ -63,7 +64,7 @@ export async function playGame( } } -export async function submitGameAnswer(address: string, guess: any, gameId: number) { +export async function submitGameAnswer(address: string, guess: number, gameId: number) { try { const api = await getApi(); const injected = await web3FromAddress(address); diff --git a/src/types/index.ts b/src/types/index.ts index 9839adb..20dce2f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -13,11 +13,11 @@ export type GameData = { bedrooms: number; bathrooms: number; size: any; - address: string; - post_code: string; - features: string; - images?: string[]; - location?: { + // address: string; + // post_code: string; + // features: string; + images: string[]; + location: { latitude: any; longitude: any; };