Fix automatic advance bug
All checks were successful
Publish Docker image / Push Docker image to Docker Hub (push) Successful in 2m3s
All checks were successful
Publish Docker image / Push Docker image to Docker Hub (push) Successful in 2m3s
This commit is contained in:
@ -124,6 +124,12 @@
|
||||
color: $accent
|
||||
font-weight: bold
|
||||
text-align: center
|
||||
|
||||
.host-info
|
||||
margin-top: 0.5rem
|
||||
color: #fff
|
||||
font-style: italic
|
||||
font-size: 0.7rem
|
||||
|
||||
.video-container
|
||||
margin-top: 1rem
|
||||
@ -267,6 +273,16 @@
|
||||
font-family: 'Press Start 2P', monospace
|
||||
font-size: 0.9rem
|
||||
color: $text
|
||||
|
||||
.auto-advance-notice
|
||||
margin: 1rem auto
|
||||
max-width: 400px
|
||||
padding: 0.75rem
|
||||
background-color: rgba($secondary, 0.2)
|
||||
border: 2px solid $secondary
|
||||
text-align: center
|
||||
color: $text-muted
|
||||
font-style: italic
|
||||
|
||||
.votes-count
|
||||
display: flex
|
||||
|
@ -6,7 +6,7 @@ import { faVoteYea, faTrophy, faMusic, faCheck, faMedal, faCrown } from '@fortaw
|
||||
import YouTubeEmbed from './YouTubeEmbed';
|
||||
|
||||
function VotingScreen() {
|
||||
const { lobby, currentPlayer, submitVote } = useGame();
|
||||
const { lobby, currentPlayer, submitVote, isHost } = useGame();
|
||||
const [hasVoted, setHasVoted] = useState(false);
|
||||
const [selectedSong, setSelectedSong] = useState(null);
|
||||
const [countdown, setCountdown] = useState(null);
|
||||
@ -65,11 +65,11 @@ function VotingScreen() {
|
||||
|
||||
// Handle bye round advancement - für automatisches Weiterkommen
|
||||
const handleByeAdvance = async () => {
|
||||
if (processingByeAdvance) return;
|
||||
if (processingByeAdvance || !isHost) return;
|
||||
|
||||
setProcessingByeAdvance(true);
|
||||
try {
|
||||
// Alle Spieler im Bye-Modus "stimmen" automatisch für das einzige Lied
|
||||
// Nur der Host kann im Bye-Modus weiterschaltenNNULL
|
||||
if (battle && battle.song1 && !battle.song2 && battle.song1.id) {
|
||||
await submitVote(battle.song1.id);
|
||||
}
|
||||
@ -122,6 +122,7 @@ function VotingScreen() {
|
||||
<p>{battle.song1.artist}</p>
|
||||
<div className="auto-advance-notice">
|
||||
<p>Dieses Lied kommt automatisch in die nächste Runde!</p>
|
||||
<p className="host-info">{isHost ? 'Du kannst als Host zum nächsten Kampf weitergehen.' : 'Warte auf den Host, um fortzufahren.'}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -139,17 +140,21 @@ function VotingScreen() {
|
||||
</div>
|
||||
|
||||
<div className="voting-status">
|
||||
<button
|
||||
className={`btn primary pixelated full-width ${processingByeAdvance ? 'disabled' : ''}`}
|
||||
onClick={handleByeAdvance}
|
||||
disabled={processingByeAdvance}
|
||||
>
|
||||
{processingByeAdvance ? 'Wird geladen...' : 'Mach weiter'}
|
||||
<span className="pixel-corner tl"></span>
|
||||
<span className="pixel-corner tr"></span>
|
||||
<span className="pixel-corner bl"></span>
|
||||
<span className="pixel-corner br"></span>
|
||||
</button>
|
||||
{isHost ? (
|
||||
<button
|
||||
className={`btn primary pixelated full-width ${processingByeAdvance ? 'disabled' : ''}`}
|
||||
onClick={handleByeAdvance}
|
||||
disabled={processingByeAdvance}
|
||||
>
|
||||
{processingByeAdvance ? 'Wird geladen...' : 'Mach weiter'}
|
||||
<span className="pixel-corner tl"></span>
|
||||
<span className="pixel-corner tr"></span>
|
||||
<span className="pixel-corner bl"></span>
|
||||
<span className="pixel-corner br"></span>
|
||||
</button>
|
||||
) : (
|
||||
<p className="auto-advance-notice">Warte auf den Host, um fortzufahren...</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
Reference in New Issue
Block a user