feat(#32): Add estimate misunderstanding message

This commit is contained in:
Josh Creek
2024-06-20 19:37:13 +01:00
parent 6583e463ec
commit 7127684ee4
+25 -1
View File
@@ -1,5 +1,10 @@
<script lang="ts"> <script lang="ts">
const changesLog = [ const changesLog = [
{
timestamp: '2024-06-20T19:36:00',
message:
'Added message to prompt users to discuss the topic further if estimates are widely varied'
},
{ {
timestamp: '2024-04-04T12:35:00', timestamp: '2024-04-04T12:35:00',
message: 'Added fix to ensure that kicking a user always works' message: 'Added fix to ensure that kicking a user always works'
@@ -43,6 +48,7 @@
import UsersList from '../../../components/UsersList.svelte'; import UsersList from '../../../components/UsersList.svelte';
import EstimateGroupsList from '../../../components/EstimateGroupsList.svelte'; import EstimateGroupsList from '../../../components/EstimateGroupsList.svelte';
import Modal from '../../../components/Modal.svelte'; import Modal from '../../../components/Modal.svelte';
import UserNameModal from '../../../components/UserNameModal.svelte';
import Estimates from '../../../components/Estimates.svelte'; import Estimates from '../../../components/Estimates.svelte';
import Fireworks, { type FireworksOptions } from '@fireworks-js/svelte'; import Fireworks, { type FireworksOptions } from '@fireworks-js/svelte';
@@ -99,6 +105,7 @@
let disableEstimates: boolean = false; let disableEstimates: boolean = false;
let audioElement; let audioElement;
let showFireworks = false; let showFireworks = false;
let showLackOfUnderstandingMessage = false;
let fireworks: Fireworks; let fireworks: Fireworks;
let fireworkOptions: FireworksOptions = { let fireworkOptions: FireworksOptions = {
opacity: 0.5, opacity: 0.5,
@@ -174,6 +181,14 @@
} }
} }
function areEstimatesWidelyVaried(estimateGroups: { [key: number | string]: string[] }): boolean {
const estimates = Object.keys(estimateGroups);
if (estimates.length >= 4) {
return true;
}
}
function onMessageReceived(message) { function onMessageReceived(message) {
if (message.type === 'user-joined') { if (message.type === 'user-joined') {
sendMessage(socket, { type: 'get-user-estimates' }); sendMessage(socket, { type: 'get-user-estimates' });
@@ -204,6 +219,7 @@
showFireworks = false; showFireworks = false;
}, 5000); }, 5000);
} }
showLackOfUnderstandingMessage = areEstimatesWidelyVaried(estimateGroups);
showRestartButton = true; showRestartButton = true;
showEstimates = true; showEstimates = true;
disableEstimates = true; disableEstimates = true;
@@ -244,7 +260,7 @@
</script> </script>
{#if showModal} {#if showModal}
<Modal {closeModal} {joinRoom} /> <UserNameModal {closeModal} {joinRoom} />
{/if} {/if}
<UsersList <UsersList
@@ -289,6 +305,14 @@
</div> </div>
{/if} {/if}
{#if showLackOfUnderstandingMessage}
<Modal
bind:showModal={showLackOfUnderstandingMessage}
heading={'There seems to be a lack of understanding'}
body={'Please discuss the topic further and try estimating again.'}
/>
{/if}
<audio src="/call-to-attention-50-percent-volume.mp3" bind:this={audioElement} /> <audio src="/call-to-attention-50-percent-volume.mp3" bind:this={audioElement} />
{#if showTooltip && newChanges.length > 0} {#if showTooltip && newChanges.length > 0}