feat(*): Disable estimates when estimation closed

This commit is contained in:
Josh Creek
2023-07-12 17:23:11 +00:00
parent 5d3b4b8461
commit 27746f534a
2 changed files with 11 additions and 2 deletions
+7 -1
View File
@@ -1,13 +1,15 @@
<script lang="ts"> <script lang="ts">
export let values: number[] = [1, 2, 3, 5, 8, 13, 21]; export let values: number[] = [1, 2, 3, 5, 8, 13, 21];
export let onEstimateClick: (value: number) => void; export let onEstimateClick: (value: number) => void;
export let disableEstimates: boolean = false;
</script> </script>
<div id="estimates-list"> <div id="estimates-list">
<div class="centered-container"> <div class="centered-container">
{#each values as value} {#each values as value}
<button <button
class="estimate-card" disabled={disableEstimates}
class="{disableEstimates ? 'estimate-card disabled' : 'estimate-card'}"
on:click={() => onEstimateClick(value)} on:click={() => onEstimateClick(value)}
on:keydown={(event) => { on:keydown={(event) => {
if (event.key === 'Enter' || event.key === ' ') { if (event.key === 'Enter' || event.key === ' ') {
@@ -41,6 +43,10 @@
cursor: pointer; cursor: pointer;
} }
.disabled {
background-color: grey;
}
.value { .value {
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: bold;
+4 -1
View File
@@ -61,6 +61,7 @@
let estimateGroups: { [key: number]: string[] } = {}; let estimateGroups: { [key: number]: string[] } = {};
let showRestartButton = false; let showRestartButton = false;
let showEstimates = false; let showEstimates = false;
let disableEstimates: boolean = false;
function closeModal() { function closeModal() {
showModal = false; showModal = false;
@@ -125,10 +126,12 @@
estimateGroups = message.groupedEstimates; estimateGroups = message.groupedEstimates;
showRestartButton = true; showRestartButton = true;
showEstimates = true; showEstimates = true;
disableEstimates = true;
} else if (message.type === 'estimation-restarted') { } else if (message.type === 'estimation-restarted') {
estimateGroups = {}; estimateGroups = {};
showRestartButton = false; showRestartButton = false;
showEstimates = false; showEstimates = false;
disableEstimates = false;
sendMessage(socket, { type: 'get-user-estimates' }); sendMessage(socket, { type: 'get-user-estimates' });
} else if (message.type === 'trigger-emoji') { } else if (message.type === 'trigger-emoji') {
if (usersList && typeof usersList.triggerEmoji === 'function') { if (usersList && typeof usersList.triggerEmoji === 'function') {
@@ -184,7 +187,7 @@
>Share Room Link</button >Share Room Link</button
> >
<Estimates onEstimateClick={handleEstimateClick} /> <Estimates {disableEstimates} onEstimateClick={handleEstimateClick} />
{#if Object.keys(estimateGroups).length > 0} {#if Object.keys(estimateGroups).length > 0}
<EstimateGroupsList {estimateGroups} /> <EstimateGroupsList {estimateGroups} />