diff --git a/.gitignore b/.gitignore index 491656d..a87a3bf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,9 @@ yarn-error.log* lerna-debug.log* .pnpm-debug.log* +# DBs +*.db + # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json diff --git a/memory-game/mg-backend/Dockerfile b/memory-game/mg-backend/Dockerfile new file mode 100644 index 0000000..d28608c --- /dev/null +++ b/memory-game/mg-backend/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.12 + +WORKDIR /code + +COPY ./requirements.txt /code/requirements.txt + +RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt + +COPY ./app /code/app + +CMD ["fastapi", "run", "app/main.py", "--port", "80"] diff --git a/memory-game/mg-backend/memory_game.db b/memory-game/mg-backend/memory_game.db index df67817..007c994 100644 Binary files a/memory-game/mg-backend/memory_game.db and b/memory-game/mg-backend/memory_game.db differ diff --git a/memory-game/mg-backend/memory_game.db.bak b/memory-game/mg-backend/memory_game.db.bak new file mode 100644 index 0000000..df67817 Binary files /dev/null and b/memory-game/mg-backend/memory_game.db.bak differ diff --git a/memory-game/mg-frontend/Dockerfile b/memory-game/mg-frontend/Dockerfile new file mode 100644 index 0000000..0c6d5bd --- /dev/null +++ b/memory-game/mg-frontend/Dockerfile @@ -0,0 +1,14 @@ +FROM node:18 as build + +WORKDIR /app + +COPY . ./ +RUN npm install +ENV NODE_ENV production +RUN npm app build + + +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 diff --git a/memory-game/mg-frontend/src/App.jsx b/memory-game/mg-frontend/src/App.jsx index f966e3e..b2110fb 100644 --- a/memory-game/mg-frontend/src/App.jsx +++ b/memory-game/mg-frontend/src/App.jsx @@ -4,9 +4,11 @@ import Button from "./components/button"; import GameBoard from "./components/gameboard"; import GameMessages from "./components/gameMessages"; import Scoreboard from "./components/scoreboard"; +import SoundEffects from "./components/soundEffects"; function App() { const [gameStarted, setGameStarted] = useState(false); + const [soundOn, setSoundOn] = useState(true); const [buttonText, setButtonText] = useState("Start Game!"); const [score, setScore] = useState(0); const [highScore, setHighScore] = useState(0); @@ -38,8 +40,7 @@ function App() { setMessage={setMessage} setButtonText={setButtonText} /> - - + ); } diff --git a/memory-game/mg-frontend/src/components/gameboard.jsx b/memory-game/mg-frontend/src/components/gameboard.jsx index e65628f..68ced93 100644 --- a/memory-game/mg-frontend/src/components/gameboard.jsx +++ b/memory-game/mg-frontend/src/components/gameboard.jsx @@ -46,7 +46,7 @@ export default function GameBoard(props) { } async function fetchCards({ setCards }) { - const cards = await fetch("http://localhost:8000/cards"); + const cards = await fetch("/cards"); const jsonCards = await cards.json(); let gameCards = await jsonCards.map((c) => { diff --git a/memory-game/mg-frontend/src/components/soundEffects.jsx b/memory-game/mg-frontend/src/components/soundEffects.jsx new file mode 100644 index 0000000..adf8ad6 --- /dev/null +++ b/memory-game/mg-frontend/src/components/soundEffects.jsx @@ -0,0 +1,12 @@ +export default function SoundEffects({ soundOn }) { + return ( + <> + {soundOn ? ( + <> + + + + ) : null} + + ); +}