Skip to content

Commit

Permalink
fix: images not loading in build, missing /play route (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkellyBG authored Dec 18, 2023
1 parent ae7f6aa commit 7f9e244
Show file tree
Hide file tree
Showing 12 changed files with 617 additions and 8,612 deletions.
7,996 changes: 0 additions & 7,996 deletions package-lock.json

This file was deleted.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
15 changes: 1 addition & 14 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,10 @@ import Rules from "./components/Rules";

function App() {
return (
// <div
// style={{
// position: "relative",
// width: "100vw",
// height: "100vh",
// display: "flex",
// flexDirection: "column",
// justifyContent: "center",
// alignItems: "center",
// }}
// >
// <GridBoard />
// </div>

<Routes>
<Route path="/" element={<MainPage />} />
<Route path="/rules" element={<Rules />} />
<Route path="/play" element={<GridBoard />} />
</Routes>
);
}
Expand Down
84 changes: 48 additions & 36 deletions src/components/GridBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,46 +48,58 @@ const GridBoard = () => {
};

return (
<svg
className="grid"
viewBox={"-30 -30 300 300"}
version="1.1"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid"
<div
style={{
position: "absolute",
height: "100%",
width: "100%",
position: "relative",
width: "100vw",
height: "100vh",
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
}}
>
<Layout
size={{ row: 10, col: 10 }}
spacing={1.1}
origin={{ row: 0, col: 0 }}
<svg
className="grid"
viewBox={"-30 -30 300 300"}
version="1.1"
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid"
style={{
position: "absolute",
height: "100%",
width: "100%",
}}
>
{gridHexCoordinates.map((coordinate) => (
<GridHex
row={coordinate.row}
col={coordinate.col}
handleClick={handleGridHexClick}
clickedPiece={clickedPiece}
/>
))}
</Layout>
<Layout
size={{ row: 8, col: 8 }}
spacing={1.375}
origin={{ row: 0, col: 0 }}
>
{pieceCoordinates.map((coordinate) => (
<Piece
row={coordinate.row}
col={coordinate.col}
handleClick={handlePieceClick}
/>
))}
</Layout>
</svg>
<Layout
size={{ row: 10, col: 10 }}
spacing={1.1}
origin={{ row: 0, col: 0 }}
>
{gridHexCoordinates.map((coordinate) => (
<GridHex
row={coordinate.row}
col={coordinate.col}
handleClick={handleGridHexClick}
clickedPiece={clickedPiece}
/>
))}
</Layout>
<Layout
size={{ row: 8, col: 8 }}
spacing={1.375}
origin={{ row: 0, col: 0 }}
>
{pieceCoordinates.map((coordinate) => (
<Piece
row={coordinate.row}
col={coordinate.col}
handleClick={handlePieceClick}
/>
))}
</Layout>
</svg>
</div>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ function MainPage() {
return (
<div className="main-container">
<div className="logo-container">
<img src="src/images/bee.png"></img>
<img src="src/images/hive_logo.png"></img>
<img src="src/images/logo2.png"></img>
<img src="/bee.png"></img>
<img src="/hive_logo.png"></img>
<img src="/logo2.png"></img>
</div>
<div className="btn-container">
<Link to="/play" id="btn-play-link">
Expand Down
4 changes: 2 additions & 2 deletions src/components/Rules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function Rules() {
return (
<div className="rules-container">
<Link to="/" id="btn-rules-link">
<img src="src/images/home.png" alt="home" style={{ width: "50px" }} />
<img src="/home.png" alt="home" style={{ width: "50px" }} />
</Link>
<h1>Hive Game Rules</h1>
<img
Expand All @@ -17,7 +17,7 @@ function Rules() {
right: "10vw",
border: "10px solid black",
}}
src="src/images/circled.png"
src="/circled.png"
></img>
<div className="description-container">
<h2>Components</h2>
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
} /* Specify a set of entries that re-map imports to additional lookup locations. */,
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
"types": [
"vite/client"
] /* Specify type package names to be included without being referenced in a source file. */,
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
Expand Down
Loading

0 comments on commit 7f9e244

Please sign in to comment.