💄 (record) hide recycle button when there is no record yet

This commit is contained in:
Julien Calixte
2023-05-08 15:02:12 +02:00
parent 541a3d9c13
commit 2c49f5abf8

View File

@@ -42,12 +42,12 @@ const getNextStepId = () => {
return null return null
} }
const canStart = computed( const hasStarted = computed(
() => () => Object.values(record.value?.stepRecords ?? {}).length > 0
!recordStore.currentStepId &&
Object.values(record.value?.stepRecords ?? {}).length === 0
) )
const canStart = computed(() => !recordStore.currentStepId && !hasStarted.value)
const startRecording = () => { const startRecording = () => {
if (!canStart.value || !task.value) { if (!canStart.value || !task.value) {
return return
@@ -142,7 +142,11 @@ onUnmounted(() => {
</button> </button>
</template> </template>
<button class="button is-warning" @click="recordStore.reset(taskId)"> <button
v-if="hasStarted"
class="button is-warning"
@click="recordStore.reset(taskId)"
>
<img src="/icons/recycle.svg" alt="reset" /> <img src="/icons/recycle.svg" alt="reset" />
</button> </button>
</div> </div>