update
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch, onMounted, nextTick } from 'vue'
|
import { ref, computed, watch, onMounted } from 'vue'
|
||||||
import { fetchGuides, fetchTopics, createTopic as apiCreateTopic, deleteTopic as apiDeleteTopic, createGuide as apiCreate, deleteGuide, cancelGuide as apiCancel, fetchBausteineStatus, fetchActiveBausteine, createBausteine as apiCreateBausteine, cancelBausteine as apiCancelBausteine, deleteBausteine as apiDeleteBausteine, fetchProviders, fetchStats, fetchTopicFortschritt, fetchGuideLocks, fetchGuideSteps, fetchFolders, updateQuelle as apiUpdateQuelle } from './api.js'
|
import { fetchGuides, fetchTopics, createTopic as apiCreateTopic, deleteTopic as apiDeleteTopic, createGuide as apiCreate, deleteGuide, cancelGuide as apiCancel, fetchBausteineStatus, fetchActiveBausteine, createBausteine as apiCreateBausteine, cancelBausteine as apiCancelBausteine, deleteBausteine as apiDeleteBausteine, fetchProviders, fetchStats, fetchTopicFortschritt, fetchGuideLocks, fetchGuideSteps, fetchFolders, updateQuelle as apiUpdateQuelle } from './api.js'
|
||||||
import { usePolling } from './composables/usePolling.js'
|
import { usePolling } from './composables/usePolling.js'
|
||||||
import TopicSidebar from './components/TopicSidebar.vue'
|
import TopicSidebar from './components/TopicSidebar.vue'
|
||||||
@@ -185,31 +185,17 @@ async function loadBausteine() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const FORMAT_ORDER = ['Guide', 'FullGuide', 'Rest']
|
|
||||||
|
|
||||||
function autoPreview() {
|
|
||||||
const map = doneByFormat.value
|
|
||||||
for (const f of FORMAT_ORDER) {
|
|
||||||
if (map[f]) {
|
|
||||||
previewGuide.value = map[f]
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
previewGuide.value = null
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectTopic(topic) {
|
function selectTopic(topic) {
|
||||||
selectedTopic.value = topic
|
selectedTopic.value = topic
|
||||||
previewGuide.value = null
|
previewGuide.value = null
|
||||||
sidebarSticky.value = false
|
sidebarSticky.value = false
|
||||||
elementsOpen.value = false
|
elementsOpen.value = false
|
||||||
elementsView.value = false
|
elementsView.value = false
|
||||||
bausteineView.value = false
|
bausteineView.value = true // Thema-Klick → Baustein-Übersicht (Guide erst auf Pill-Klick)
|
||||||
elementOpenId.value = null
|
elementOpenId.value = null
|
||||||
ansichtModus.value = localStorage.getItem('ansicht_' + topic) === 'erklärend' ? 'erklärend' : 'kompakt'
|
ansichtModus.value = localStorage.getItem('ansicht_' + topic) === 'erklärend' ? 'erklärend' : 'kompakt'
|
||||||
localStorage.setItem('lastTopic', topic)
|
localStorage.setItem('lastTopic', topic)
|
||||||
loadBausteine()
|
loadBausteine()
|
||||||
nextTick(autoPreview)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Beim Reload dort landen, wo man vorher war (Thema + Format)
|
// Beim Reload dort landen, wo man vorher war (Thema + Format)
|
||||||
@@ -362,12 +348,8 @@ async function handleDeleteTopic(topic) {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await Promise.all([loadGuides(), loadTopics(), loadProviders(), loadFolders()])
|
await Promise.all([loadGuides(), loadTopics(), loadProviders(), loadFolders()])
|
||||||
const savedTopic = localStorage.getItem('lastTopic')
|
const savedTopic = localStorage.getItem('lastTopic')
|
||||||
const savedFormat = localStorage.getItem('lastFormat')
|
|
||||||
if (savedTopic && topics.value.includes(savedTopic)) {
|
if (savedTopic && topics.value.includes(savedTopic)) {
|
||||||
selectTopic(savedTopic)
|
selectTopic(savedTopic) // landet auf der Baustein-Übersicht
|
||||||
await nextTick()
|
|
||||||
const g = doneByFormat.value[savedFormat]
|
|
||||||
if (g) previewGuide.value = g
|
|
||||||
} else if (!selectedTopic.value && topics.value.length) {
|
} else if (!selectedTopic.value && topics.value.length) {
|
||||||
selectTopic(topics.value[0])
|
selectTopic(topics.value[0])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ async function loadContent() {
|
|||||||
try {
|
try {
|
||||||
lernstand.value = (await fetchBausteinLernstand(g.topic)).bausteine || {}
|
lernstand.value = (await fetchBausteinLernstand(g.topic)).bausteine || {}
|
||||||
} catch { /* offline → leer */ }
|
} catch { /* offline → leer */ }
|
||||||
|
// Beim Öffnen zum ersten noch nicht gemeisterten prüfbaren Baustein scrollen.
|
||||||
|
await nextTick()
|
||||||
|
const ziel = bausteine.value.find((s) => istPruefbar(s) && stufeVon(s.title)?.key !== 'meister')
|
||||||
|
if (ziel) scrollEl.value?.querySelector(`[data-num="${ziel.num}"]`)?.scrollIntoView({ block: 'start' })
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Baustein-Lernen: Prüfungs-Stand pro Baustein-Titel (lernstand oben deklariert) ---
|
// --- Baustein-Lernen: Prüfungs-Stand pro Baustein-Titel (lernstand oben deklariert) ---
|
||||||
|
|||||||
Reference in New Issue
Block a user