This commit is contained in:
Dmitry 2026-01-10 19:16:44 +03:00
parent 6e940aceb0
commit 9acd6a6fa9
5 changed files with 21 additions and 53 deletions

View file

@ -667,7 +667,7 @@ const GameManagementModal = ({
<button
className="mgmt-button start-button"
onClick={onStartGame}
disabled={participants.length < 2}
disabled={questions.length === 0}
>
Начать игру
</button>

View file

@ -1,16 +1,15 @@
import { useEffect, useState } from 'react'
import { useTheme } from '../context/ThemeContext'
const SNOWFLAKE_LIFETIME = 15000 // 15 seconds max lifetime
const TARGET_COUNT = 30 // Target number of snowflakes
const UPDATE_INTERVAL = 500 // Check every 500ms
function createSnowflake(id) {
function createSnowflake(id, isInitial = false) {
return {
id: id || `snowflake-${Date.now()}-${Math.random()}`,
left: Math.random() * 100,
duration: Math.random() * 3 + 7, // 7-10s
delay: Math.random() * 2, // 0-2s delay for initial batch
delay: isInitial ? Math.random() * 2 : 0, // Only delay initial batch
size: Math.random() * 10 + 10, // 10-20px
opacity: Math.random() * 0.5 + 0.5, // 0.5-1
createdAt: Date.now(),
@ -51,7 +50,7 @@ const Snowflakes = ({ roomParticlesEnabled = null }) => {
setSnowflakes([])
return
}
const initial = Array.from({ length: TARGET_COUNT }, (_, i) => createSnowflake(i))
const initial = Array.from({ length: TARGET_COUNT }, (_, i) => createSnowflake(i, true))
setSnowflakes(initial)
}, [particlesEnabled, particleSymbol, currentThemeData])

View file

@ -12,8 +12,6 @@ const CreateRoom = () => {
const [settings, setSettings] = useState({
maxPlayers: 10,
allowSpectators: true,
timerEnabled: false,
timerDuration: 30,
password: '',
});
const [isNameModalOpen, setIsNameModalOpen] = useState(false);
@ -105,34 +103,6 @@ const CreateRoom = () => {
</label>
</div>
<div className="form-group checkbox">
<label>
<input
type="checkbox"
checked={settings.timerEnabled}
onChange={(e) =>
setSettings({ ...settings, timerEnabled: e.target.checked })
}
/>
Включить таймер
</label>
</div>
{settings.timerEnabled && (
<div className="form-group">
<label>Время на ответ (сек):</label>
<input
type="number"
min="10"
max="120"
value={settings.timerDuration}
onChange={(e) =>
setSettings({ ...settings, timerDuration: parseInt(e.target.value) })
}
/>
</div>
)}
<div className="form-group">
<label>Пароль на комнату (необязательно):</label>
<input

View file

@ -363,6 +363,16 @@ const GamePage = () => {
);
};
const handleToggleParticles = (particlesEnabled) => {
if (!gameState.roomId || !user) return;
socketService.toggleParticles(
gameState.roomId,
gameState.roomCode,
user.id,
particlesEnabled
);
};
const handleSelectPlayer = (participantId) => {
if (!gameState.roomId || !user) return;
if (!isHost) return; // Только хост может выбирать игрока

View file

@ -339,28 +339,16 @@ const RoomPage = () => {
</ul>
</div>
<div className="question-pack-section">
<h3>Вопросы:</h3>
<div className="pack-info">
<p>
Вопросов в комнате: <strong>{roomQuestions.length}</strong>
</p>
{isHost && (
<p className="pack-hint">
Вы можете настроить вопросы перед началом игры
</p>
)}
</div>
{isHost && (
<div className="button-group">
<button
onClick={() => setIsQuestionsModalOpen(true)}
className="secondary"
className="primary"
>
Настроить вопросы
🎛 Настроить игру
</button>
)}
</div>
)}
<div className="button-group">
<button
@ -437,6 +425,7 @@ const RoomPage = () => {
onUpdateQuestions={handleUpdateRoomQuestions}
availablePacks={questionPacks}
onChangeParticipantRole={handleChangeParticipantRole}
onStartGame={handleStartGame}
/>
)}
</div>