diff --git a/app/layout.js b/app/layout.js new file mode 100644 index 0000000..2cdc746 --- /dev/null +++ b/app/layout.js @@ -0,0 +1,26 @@ +// app/layout.js +'use client' +import '/style.css'; +import '/tailwind.css'; +import { NextUIProvider } from "@nextui-org/react"; +import PropTypes from 'prop-types' + +function ClientComponent({ children }) { + return ( + + {children} + + ) +} + +export default function RootLayout({ children }) { + return ( + + {children} + + ) +} + +RootLayout.propTypes = { + children: PropTypes.node.isRequired, +} \ No newline at end of file diff --git a/app/ssr.js b/app/ssr.js new file mode 100644 index 0000000..db219e3 --- /dev/null +++ b/app/ssr.js @@ -0,0 +1,6 @@ +// app/ssr.js +export const metadata = { + title: 'My Page Title', + description: 'My Page Description', + // other metadata as needed +}; \ No newline at end of file diff --git a/components/layout.js b/components/layout.js deleted file mode 100644 index 0f757c8..0000000 --- a/components/layout.js +++ /dev/null @@ -1,14 +0,0 @@ -// layout.js -import PropTypes from 'prop-types' - -export default function RootLayout({ children }) { - return ( -
- {children} -
- ) -} - -RootLayout.propTypes = { - children: PropTypes.node.isRequired, -} diff --git a/pages/history/[userId].js b/pages/history/[userId].js index 3d20f6b..4c62c88 100644 --- a/pages/history/[userId].js +++ b/pages/history/[userId].js @@ -4,7 +4,7 @@ import { useRouter } from 'next/router'; import { doc, getDoc, collection, getDocs, query, orderBy } from 'firebase/firestore'; import { getFirebaseFirestore } from '../../app/src/firebase'; import GameHistory from '../../components/GameHistory'; -import RootLayout from '../../components/layout'; +import RootLayout from '../../app/layout'; import NavigationButtons from '../../components/NavigationButtons'; import { format } from 'date-fns'; import { Pagination } from '@nextui-org/react'; diff --git a/pages/results.js b/pages/results.js index 7bc5b55..b28f12e 100644 --- a/pages/results.js +++ b/pages/results.js @@ -1,21 +1,28 @@ // pages/results.js import React from 'react'; +import Head from 'next/head'; import { db } from '../firebaseAdmin'; import ChallengeSection from '../components/ChallengeSection'; import GameHistory from '../components/GameHistory'; import FinalScore from '../components/FinalScore'; -import RootLayout from '../components/layout'; +import RootLayout from '../app/layout'; const ResultsPage = ({ gameData, gameHistory }) => { - const metadata = { - title: `Game Results for ${gameData?.leaderboardName}`, - description: `Check out the game results for ${gameData?.leaderboardName} on DecodeMe!`, - image: '/images/shareimage.jpeg', - url: `https://deocdeme.app/results/${gameData?.id}`, - }; + if (!gameData) { + // Render a loading state or return null if the server-side props are not available + return null; + } return ( - + + + {`Game Results for ${gameData.leaderboardName}`} + + + + + +