diff --git a/apps/multiplayer/src/multiplayer.ts b/apps/multiplayer/src/multiplayer.ts
index 95417b65..7d4a2156 100644
--- a/apps/multiplayer/src/multiplayer.ts
+++ b/apps/multiplayer/src/multiplayer.ts
@@ -358,11 +358,19 @@ export class Multiplayer implements DurableObject {
);
if (allPlayersGuessedCorrectly) {
- game.gameState.hasWon = true;
- game.gameState.isActive = false;
- game.gameState.statusMessage = {
- type: 'success',
- message: `Everyone guessed correctly! The word was "${game.gameState.targetWord}"`,
+ game.gameState = {
+ ...game.gameState,
+ hasWon: true,
+ isActive: false,
+ isLobby: true,
+ targetWord: '',
+ timeRemaining: this.GAME_DURATION,
+ currentDrawer: undefined,
+ endTime: undefined,
+ statusMessage: {
+ type: 'success',
+ message: `Everyone guessed correctly! The word was "${game.gameState.targetWord}"`,
+ },
};
if (game.timerInterval) {
@@ -480,10 +488,19 @@ export class Multiplayer implements DurableObject {
game.gameState.endTime &&
Date.now() >= game.gameState.endTime
) {
- game.gameState.isActive = false;
- game.gameState.statusMessage = {
- type: 'failure',
- message: `Time's up! The word was "${game.gameState.targetWord}"`,
+ const oldWord = game.gameState.targetWord;
+ game.gameState = {
+ ...game.gameState,
+ isActive: false,
+ isLobby: true,
+ targetWord: '',
+ timeRemaining: this.GAME_DURATION,
+ currentDrawer: undefined,
+ endTime: undefined,
+ statusMessage: {
+ type: 'failure',
+ message: `Time's up! The word was "${oldWord}"`,
+ },
};
if (game.timerInterval) {
@@ -493,19 +510,12 @@ export class Multiplayer implements DurableObject {
this.broadcast(gameId, {
type: 'gameEnded',
- gameState: {
- ...game.gameState,
- drawingData: undefined,
- },
+ gameState: game.gameState,
users: Array.from(game.users.entries()).map(([id, data]) => ({
id,
...data,
})),
});
-
- if (game.users.size === 0) {
- this.games.delete(gameId);
- }
}
}
diff --git a/apps/web/components/DrawingCanvas/Components/Canvas.tsx b/apps/web/components/DrawingCanvas/Components/Canvas.tsx
index 21f25562..c86405e8 100644
--- a/apps/web/components/DrawingCanvas/Components/Canvas.tsx
+++ b/apps/web/components/DrawingCanvas/Components/Canvas.tsx
@@ -152,9 +152,10 @@ export function Canvas({
ref={canvasRef}
width={800}
height={650}
- className={`bg-[#f9fafb] top-0 left-0 w-full h-full max-h-[650px] border border-gray-200 rounded-lg touch-none ${
+ className={`bg-[#f9fafb] w-full h-auto max-h-[80vh] border border-gray-200 rounded-lg touch-none ${
isReadOnly ? 'cursor-default' : 'cursor-crosshair'
}`}
+ style={{ aspectRatio: '800 / 650' }}
onMouseDown={startDrawing}
onMouseUp={stopDrawing}
onMouseOut={stopDrawing}
diff --git a/apps/web/components/DrawingCanvas/Components/ColorPicker.tsx b/apps/web/components/DrawingCanvas/Components/ColorPicker.tsx
index 402ccc1a..af2c9520 100644
--- a/apps/web/components/DrawingCanvas/Components/ColorPicker.tsx
+++ b/apps/web/components/DrawingCanvas/Components/ColorPicker.tsx
@@ -21,7 +21,7 @@ export function ColorPicker({
/>
Custom Color
-
+
{COLORS.map((color) => (