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
39 changes: 0 additions & 39 deletions client/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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: {},
},
}
237 changes: 122 additions & 115 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { useState, useEffect, useCallback } from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import { Row, Col } from "react-simple-flex-grid";

Check warning on line 3 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Row' is defined but never used

Check warning on line 3 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Col' is defined but never used
import { GameContext } from "./context/game-context";
import Ludo from "./components/Ludo";

Check warning on line 5 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Ludo' is defined but never used
import Dice from "./components/Dice";

Check warning on line 6 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Dice' is defined but never used
import Menu from "./components/Menu";

Check warning on line 7 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Menu' is defined but never used
import Header from "./components/Header";

Check warning on line 8 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Header' is defined but never used
import ColorSettings from "./components/ColorSettings";
import Alert from "./components/Alert";

Check warning on line 10 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Alert' is defined but never used
import Footer from "./components/Footer";

Check warning on line 11 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Footer' is defined but never used
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 Control from "./components/Control";

Check warning on line 18 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'Control' is defined but never used
import { StarknetProvider } from "./starknet-provider";
import { FiAlertTriangle, FiZap } from "react-icons/fi";

Check warning on line 20 in client/src/App.tsx

View workflow job for this annotation

GitHub Actions / node

'FiAlertTriangle' is defined but never used
import { BoardContext, BoardType } from "./context/board-context";
import { DiceProvider } from "./context/dice-context";
import { ColorProvider } from "./context/color-context";
Expand All @@ -33,6 +33,8 @@
import Settings from "./components/Settings";
import ToolboxPage from "./components/Toolbox";
import { AvatarProvider } from "./context/avatar-context";
import GamePlay from "./components/GamePlay";
import { GameProvider } from "./context/game-context-2.";

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

Expand Down Expand Up @@ -85,8 +87,7 @@
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 Down Expand Up @@ -127,123 +128,129 @@
<BoardContext.Provider value={{ board, toggleBoard }}>
<ColorProvider>
<DiceProvider>
<AvatarProvider>
<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} />
</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}
<AvatarProvider>
<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} />
// </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 === "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 === "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 === "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
}
/>
</div>
</div>
</div>
</Col>
</Row>
</div>
</div>
<Footer />
</>
}
/>
</Routes>
</AvatarProvider>
// {activeWindow === "help" && (
// <GameHelp
// onClose={() =>
// setActiveWindow("")
// }
// />
// )}
// <Control
// toggleActiveWindow={
// toggleActiveWindow
// }
// />
// </div>
// </div>
// </div>
// </Col>
// </Row>
// </div>
// </div>
// <Footer />
// </>

<>
<GameProvider>
<GamePlay />
</GameProvider>
</>
}
/>
</Routes>
</AvatarProvider>
</DiceProvider>
</ColorProvider>
</BoardContext.Provider>
Expand Down
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.
Binary file modified client/src/assets/images/board.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 added client/src/assets/images/box1.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 added client/src/assets/images/box2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions client/src/assets/images/close_icon.svg

This file was deleted.

Binary file added client/src/assets/images/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/favicon.png
Binary file not shown.
Binary file added client/src/assets/images/golden.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 added client/src/assets/images/green.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 added client/src/assets/images/pause.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 added client/src/assets/images/player1.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 added client/src/assets/images/player2.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 added client/src/assets/images/player3.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 added client/src/assets/images/player4.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 added client/src/assets/images/red.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 added client/src/assets/images/retro.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 added client/src/assets/images/unique.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 added client/src/assets/images/yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions client/src/components/CenterTile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import Dice from './Dice';
import HighlightedDiv from './HighligtedDiv';

interface CenterTileProps {
color?: string;
width?: string;
height?: string;
}

const CenterTile: React.FC<CenterTileProps> = ({ color, width, height }) => {
return (
<div className="w-40 h-36 flex justify-between">
<div className="flex justify-between w-full border border-[#5cd7f8]">
<div className="border h-full w-1/4 border-[#5cd7f8]">
<div className="border h-1/4 border-[#5cd7f8]"></div>
<HighlightedDiv className="bg-[#545841] border h-2/4 border-[#5cd7f8]" ></HighlightedDiv>
<div className="border h-1/4 border-[#5cd7f8]"></div>
</div>

<div className="border w-2/4 border-[#5cd7f8]">
<HighlightedDiv className="bg-[#626b74] border h-1/4 border-[#5cd7f8]"></HighlightedDiv>
<div
className="border h-[75px] w-[107px] overflow-none bg-white border-[#5cd7f8] flex items-center justify-center relative"

>
<Dice onRoll={function (numbers: number[]): void {
throw new Error('Function not implemented.');
} } />
</div>
<HighlightedDiv className="border h-1/4 bg-[#973d34] border-[#5cd7f8]"></HighlightedDiv>
</div>
<div className="border w-1/4 border-[#5cd7f8]">
<div className="border h-1/4 border-[#5cd7f8]"></div>
<HighlightedDiv className="bg-[#c89252] border h-2/4 border-[#5cd7f8]"></HighlightedDiv>
<div className="border h-1/4 border-[#5cd7f8]"></div>
</div>
</div>
</div>
);
};

export default CenterTile;
2 changes: 1 addition & 1 deletion client/src/components/ColorSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ const СolorSettings = () => {
);
};

export default СolorSettings;
export default СolorSettings;
Loading
Loading