This commit is contained in:
Team3
2026-06-07 09:34:46 +02:00
parent 13eedd7753
commit 3f2c966d25
5 changed files with 76 additions and 13 deletions

View File

@@ -128,7 +128,26 @@ function handleFormatClick(format) {
}
}
// Lernschulden-Regel: max. 5 erstellte, aber nicht absolvierte Guides —
// darüber sind nur Neu-Generierungen bereits erstellter Guides erlaubt.
const offeneGuides = computed(() => {
const f = props.stats?.formate || {}
return ['MiniGuide', 'Guide', 'FullGuide'].reduce(
(sum, k) => sum + ((f[k]?.erstellt ?? 0) - (f[k]?.absolviert ?? 0)), 0,
)
})
function playLock(format) {
if (format === 'OnePager') return null
if (!props.bausteine.ready) return 'Erst Bausteine erstellen'
if (offeneGuides.value >= 5 && !props.doneByFormat[format]) {
return `Erst Guides absolvieren — ${offeneGuides.value} offen (max. 5)`
}
return null
}
function handlePlay(format) {
if (playLock(format)) return
emit('formatClick', { format, instructions: '' })
}
@@ -279,8 +298,8 @@ function confirmDeleteProject(name) {
<template v-if="guideStatus(f.key) !== 'generating' && guideStatus(f.key) !== 'queued'">
<button
class="action-btn play"
:title="f.key === 'OnePager' || bausteine.ready ? 'Generieren' : 'Erst Bausteine erstellen'"
:disabled="f.key !== 'OnePager' && !bausteine.ready"
:title="playLock(f.key) || 'Generieren'"
:disabled="!!playLock(f.key)"
@click="handlePlay(f.key)"
></button>
</template>