mirror of
https://github.com/ericasch6/scrum-poker-internal.git
synced 2026-10-13 21:52:08 +00:00
Merge pull request #4 from ericasch6/codex/remove-moderator-throw-throttle
removed throttle for mod
This commit is contained in:
@@ -21,6 +21,7 @@ const { activePaperBalls, hitPlayerIds, throwingAtPlayerId, throwPaperBall } =
|
||||
usePaperBallToss({
|
||||
roomId: () => props.room.id,
|
||||
currentPlayerId: () => props.currentPlayer.id,
|
||||
currentPlayerIsModerator: () => props.currentPlayer.is_moderator,
|
||||
board: gameBoard,
|
||||
});
|
||||
|
||||
@@ -115,7 +116,9 @@ const voteCount = computed(
|
||||
:revealed="room.revealed"
|
||||
:presenter-mode="presenterMode"
|
||||
:is-paper-ball-hit="hitPlayerIds.includes(player.id)"
|
||||
:throw-disabled="throwingAtPlayerId !== null"
|
||||
:throw-disabled="
|
||||
!currentPlayer.is_moderator && throwingAtPlayerId !== null
|
||||
"
|
||||
@throw-paper-ball="throwPaperBall"
|
||||
/>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ const THROW_BUTTON_COOLDOWN = 550;
|
||||
export function usePaperBallToss({
|
||||
roomId,
|
||||
currentPlayerId,
|
||||
currentPlayerIsModerator,
|
||||
board,
|
||||
}: PaperBallTossOptions) {
|
||||
const activePaperBalls = ref<PaperBallFlight[]>([]);
|
||||
@@ -35,9 +36,11 @@ export function usePaperBallToss({
|
||||
}
|
||||
|
||||
async function throwPaperBall(targetPlayerId: number): Promise<void> {
|
||||
const shouldApplyCooldown = !currentPlayerIsModerator();
|
||||
|
||||
if (
|
||||
targetPlayerId === currentPlayerId() ||
|
||||
throwingAtPlayerId.value !== null
|
||||
(shouldApplyCooldown && throwingAtPlayerId.value !== null)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@@ -52,7 +55,9 @@ export function usePaperBallToss({
|
||||
return;
|
||||
}
|
||||
|
||||
throwingAtPlayerId.value = targetPlayerId;
|
||||
if (shouldApplyCooldown) {
|
||||
throwingAtPlayerId.value = targetPlayerId;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(throwPaperBallRoute(roomId()).url, {
|
||||
@@ -91,11 +96,13 @@ export function usePaperBallToss({
|
||||
} catch {
|
||||
toast.error('Der Papierknäuel konnte nicht geworfen werden.');
|
||||
} finally {
|
||||
schedule(() => {
|
||||
if (throwingAtPlayerId.value === targetPlayerId) {
|
||||
throwingAtPlayerId.value = null;
|
||||
}
|
||||
}, THROW_BUTTON_COOLDOWN);
|
||||
if (shouldApplyCooldown) {
|
||||
schedule(() => {
|
||||
if (throwingAtPlayerId.value === targetPlayerId) {
|
||||
throwingAtPlayerId.value = null;
|
||||
}
|
||||
}, THROW_BUTTON_COOLDOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ export type PaperBallFlight = {
|
||||
export type PaperBallTossOptions = {
|
||||
roomId: () => string;
|
||||
currentPlayerId: () => number;
|
||||
currentPlayerIsModerator: () => boolean;
|
||||
board: Ref<HTMLElement | null>;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user