From 86627c9e99a885d0ed8903b51e63800eec6bb23a Mon Sep 17 00:00:00 2001 From: Matt Culpepper Date: Sat, 17 Aug 2024 13:00:46 -0500 Subject: [PATCH] list games --- .../squares/squares-list-feature.tsx | 52 ++++++++----------- web/components/ui/ui-layout.tsx | 9 ++-- 2 files changed, 27 insertions(+), 34 deletions(-) diff --git a/web/components/squares/squares-list-feature.tsx b/web/components/squares/squares-list-feature.tsx index 0541978..1523efd 100644 --- a/web/components/squares/squares-list-feature.tsx +++ b/web/components/squares/squares-list-feature.tsx @@ -1,48 +1,38 @@ 'use client'; import { useWallet } from '@solana/wallet-adapter-react'; -import { WalletButton } from '../solana/solana-provider'; import { AppHero, ellipsify } from '../ui/ui-layout'; import { ExplorerLink } from '../cluster/cluster-ui'; -import { useSquaresProgram, useAllGames } from './squares-data-access'; +import { useAllGames } from './squares-data-access'; import { SquaresCreate } from './squares-ui'; +import { WalletButton } from '../solana/solana-provider'; export default function SquaresListFeature() { - const { publicKey } = useWallet(); + const { connected } = useWallet(); const gamesData = useAllGames(); - console.log("Games data:", gamesData.games.data); - return (
- {publicKey ? ( - <> - - - -
- {gamesData?.games?.data?.map((game) => ( -
- + + {connected ? : } + +
+ {gamesData?.games?.data?.map((game) => ( + - - ) : ( - - - - )} + ))} +
); } \ No newline at end of file diff --git a/web/components/ui/ui-layout.tsx b/web/components/ui/ui-layout.tsx index d9b2506..9ff1033 100644 --- a/web/components/ui/ui-layout.tsx +++ b/web/components/ui/ui-layout.tsx @@ -16,7 +16,7 @@ import { import toast, { Toaster } from 'react-hot-toast'; const pages: { label: string; path: string }[] = [ - { label: 'Squares', path: '/games' }, + { label: 'Games', path: '/games' }, ]; export function UiLayout({ children }: { children: ReactNode }) { @@ -47,6 +47,9 @@ export function UiLayout({ children }: { children: ReactNode }) {
+ + + New Game +
@@ -69,7 +72,7 @@ export function UiLayout({ children }: { children: ReactNode }) {