Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"wrangler": "^4.4.0"
},
"exports": {
".": "./src/index.ts"
".": "./src/index.ts",
"./magic": "./src/magic.ts",
"./memory": "./src/memory.ts"
}
}
2 changes: 1 addition & 1 deletion apps/backend/src/memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class Memory extends RoomMatch<GameState> {
const size = this.state.rules.boardSize;
this.state.board = Array(size)
.fill(null)
.map(() => Array(size).fill(null));
.map(() => Array(size).fill({ status: "free" }));
this.state.round = 0;
this.state.turn = 0;
this.state.winners = null;
Expand Down
7 changes: 6 additions & 1 deletion apps/frontend/app/routes/magic-square/room.$roomId.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/** biome-ignore-all lint/a11y/noStaticElementInteractions: TODO */
/** biome-ignore-all lint/suspicious/noArrayIndexKey: TODO */
/** biome-ignore-all lint/a11y/useKeyWithClickEvents: TODO */
import type { GameState, MessageType, Operation, Rule } from "@apps/backend";
import type {
GameState,
MessageType,
Operation,
Rule,
} from "@apps/backend/magic";
import { useEffect, useRef, useState } from "react";
import {
type ClientLoaderFunctionArgs,
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/app/routes/memory-optimization/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export default function Lobby() {
const roomName =
newRoomName || `room-${Math.floor(Math.random() * 100000)}`;
const res = await client.rooms.create.$post({
json: { name: roomName, gameTitle: "magic-square" },
json: { name: roomName, gameTitle: "memory-optimization" },
});
if (res.ok) {
const newRoom = await res.json();
navigate(`/magic-square/room/${newRoom.id}`);
navigate(`/memory-optimization/room/${newRoom.id}`);
}
};

Expand All @@ -109,7 +109,7 @@ export default function Lobby() {
param: { roomId },
});
if (res.ok) {
navigate(`/magic-square/room/${roomId}`);
navigate(`/memory-optimization/room/${roomId}`);
}
} catch (e) {
console.error(e);
Expand All @@ -125,7 +125,7 @@ export default function Lobby() {
});
if (res.ok) {
const data = await res.json();
navigate(`/magic-square/room/${data.id}`);
navigate(`/memory-optimization/room/${data.id}`);
} else {
setJoinError("Failed to join room");
}
Expand Down
Loading