Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Gameboard grid implementation #172

Merged
241 changes: 83 additions & 158 deletions client/pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions client/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
280 changes: 136 additions & 144 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import Ludo from "./components/Ludo";
import Dice from "./components/Dice";
import Menu from "./components/Menu";
import Header from "./components/Header";
import ColorSettings from "./components/ColorSettings";

import Alert from "./components/Alert";
import Footer from "./components/Footer";
import { chance } from "./hooks/utils";
import "react-simple-flex-grid/lib/main.css";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import { OptionsProps } from "./types";
import "./App.css";
// import "./App.css";
import Control from "./components/Control";
import { StarknetProvider } from "./starknet-provider";
import { FiAlertTriangle, FiZap } from "react-icons/fi";
Expand All @@ -32,6 +32,9 @@ import { StarkludoSchemaType } from "./dojo/gen/models.gen";
import { SDK } from "@dojoengine/sdk";
import Settings from "./components/Settings";
import ToolboxPage from "./components/Toolbox";
import GamePlay from "./components/GamePlay.js";
import LudoGame from "./components/LudoGame.jsx";
import { GameProvider } from "./context/game-context-2..js";

const App = ({ sdk }: { sdk: SDK<StarkludoSchemaType> }) => {

Expand Down Expand Up @@ -84,8 +87,7 @@ const App = ({ sdk }: { sdk: SDK<StarkludoSchemaType> }) => {
if (options.gameIsOngoing) {
if (options.winners.length === options.playersLength - 1) {
toast(
`The game has ended. Player ${
chance[options.winners[0]]
`The game has ended. Player ${chance[options.winners[0]]
} is the winner`
);
setGameOptions({
Expand All @@ -108,150 +110,140 @@ const App = ({ sdk }: { sdk: SDK<StarkludoSchemaType> }) => {
}, [options, setGameOptions]);

return (
<>
<Router>
{showMobileResponsiveWarning ? (
<MobileResponsiveWarning />
) : (
<>
<StarknetProvider>
<GameContext.Provider
value={{
gameState: gameState,
setGameData: setGameData,
options: options,
setGameOptions: setGameOptions,
}}
>
<BoardContext.Provider value={{ board, toggleBoard }}>
<ColorProvider>
<DiceProvider>
<Routes>
<Route
path="/color-settings"
element={<ColorSettings />}
/>
<Route path="/settings" element={<Settings />} />
<Route path="/toolbox" element={<ToolboxPage />} />
<Route
path="/"
element={
<>
<div className="game-behaviour-warning">
<FiAlertTriangle size={20} />
StarkLudo is still in active development{" "}
<FiZap color="yellow" size={20} />
<Router>
{showMobileResponsiveWarning ? (
<MobileResponsiveWarning />
) : (
<>
<Routes>
{/* Settings Route */}
<Route path="/settings" element={<Settings />} />

{/* Home Page Route */}
<Route
path="/"
element={
<StarknetProvider>
<GameContext.Provider
value={{
gameState: gameState,
setGameData: setGameData,
options: options,
setGameOptions: setGameOptions,
}}
>
{/* <BoardContext.Provider value={{ board, toggleBoard }}>
<ColorProvider>
<DiceProvider>
<div className="game-behaviour-warning">
<FiAlertTriangle size={20} />
StarkLudo is still in active development{" "}
<FiZap color="yellow" size={20} />
</div>
<div className="layout-container">
<div className="layout-stretch-lock">
<div className="mobile-header">
<Header />
</div>
<div className="layout-container">
<div className="layout-stretch-lock">
<div className="mobile-header">
<Header />
</div>
<Row gutter={0}>
<Col xs={12} sm={12} md={7} lg={7}>
<Ludo />
</Col>
<Col xs={12} sm={12} md={5} lg={5}>
<div className="sidebar">
<div>
<div>
<div className="desktop-header">
<Header />
</div>
<Menu />
{/* <RestartGame /> */}
<Alert />
<Dice />
{activeWindow === "account" ? (
<ControlWindowLayout
toggle={() =>
setActiveWindow("")
}
title="PROFILE"
subtitle="Your Profile Information"
>
<GameAccount />
</ControlWindowLayout>
) : null}

{activeWindow === "leaderboard" ? (
<ControlWindowLayout
toggle={() =>
setActiveWindow("")
}
title="LEADERBOARD"
subtitle="Global Player Rankings"
>
<Leaderboard />
</ControlWindowLayout>
) : null}

{activeWindow === "multiplayer" ? (
<ControlWindowLayout
toggle={() =>
setActiveWindow("")
}
title="MULTIPLAYER"
subtitle="Choose An Account To Play With"
>
<Multiplayer />
</ControlWindowLayout>
) : null}

{activeWindow === "toolbox" ? (
<ControlWindowLayout
toggle={() =>
setActiveWindow("")
}
title="TOOLBOX"
subtitle="Get All Your Items And Settings Done"
>
<Toolbox
activeCategory={
activeCategory
}
onCategoryClick={
handleCategoryClick
}
/>
</ControlWindowLayout>
) : null}

{activeWindow === "help" && (
<GameHelp
onClose={() =>
setActiveWindow("")
}
/>
)}
<Control
toggleActiveWindow={
toggleActiveWindow
<Row gutter={0}>
<Col xs={12} sm={12} md={7} lg={7}>
<Ludo />
</Col>
<Col xs={12} sm={12} md={5} lg={5}>
<div className="sidebar">
<div>
<div>
<div className="desktop-header">
<Header />
</div>
<Menu />

<Alert />
<Dice />
{activeWindow === "account" ? (
<ControlWindowLayout
toggle={() => setActiveWindow("")}
title="PROFILE"
subtitle="Your Profile Information"
>
<GameAccount />
</ControlWindowLayout>
) : null}

{activeWindow === "leaderboard" ? (
<ControlWindowLayout
toggle={() => setActiveWindow("")}
title="LEADERBOARD"
subtitle="Global Player Rankings"
>
<Leaderboard />
</ControlWindowLayout>
) : null}

{activeWindow === "multiplayer" ? (
<ControlWindowLayout
toggle={() => setActiveWindow("")}
title="MULTIPLAYER"
subtitle="Choose An Account To Play With"
>
<Multiplayer />
</ControlWindowLayout>
) : null}

{activeWindow === "toolbox" ? (
<ControlWindowLayout
toggle={() => setActiveWindow("")}
title="TOOLBOX"
subtitle="Get All Your Items And Settings Done"
>
<Toolbox
activeCategory={activeCategory}
onCategoryClick={
handleCategoryClick
}
/>
</div>
</div>
</ControlWindowLayout>
) : null}

{activeWindow === "help" ? (
<ControlWindowLayout
toggle={() => setActiveWindow("")}
title="HELP"
subtitle="Get Guides, Tips, And Tricks Needed For A Successful Game"
>
<GameHelp />
</ControlWindowLayout>
) : null}
<Control
toggleActiveWindow={
toggleActiveWindow
}
/>
</div>
</Col>
</Row>
</div>
</div>
<Footer />
</>
}
/>
</Routes>
</DiceProvider>
</ColorProvider>
</BoardContext.Provider>
</GameContext.Provider>
<ToastContainer position="bottom-center" />
</StarknetProvider>
</>
)}
</Router>
</>
</div>
</div>
</Col>
</Row>
</div>
</div>
<Footer />
</DiceProvider>
</ColorProvider>
</BoardContext.Provider> */}
<GameProvider>
<GamePlay />
</GameProvider>
{/* <LudoGame /> */}
</GameContext.Provider>
<ToastContainer position="bottom-center" />
</StarknetProvider>
}
/>
</Routes>
</>
)}
</Router>
);
};

export default App;
export default App;
16 changes: 0 additions & 16 deletions client/src/assets/images/Play.svg

This file was deleted.

16 changes: 0 additions & 16 deletions client/src/assets/images/PlayDown.svg

This file was deleted.

16 changes: 0 additions & 16 deletions client/src/assets/images/PlayLight.svg

This file was deleted.

Binary file added client/src/assets/images/bg-dice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed client/src/assets/images/bg.png
Binary file not shown.
Binary file added client/src/assets/images/blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading