feat(journey-editor): JourneyEditor frontend — issue #753 #792

Open
marcel wants to merge 82 commits from feat/issue-753-journey-editor into feat/issue-750-lesereisen-data-model
Showing only changes of commit 0130c4fa99 - Show all commits

View File

@@ -41,6 +41,14 @@ let mutationError = $state('');
let liveAnnounce = $state('');
let announceTimer: ReturnType<typeof setTimeout> | null = null;
function scheduleAnnounceReset() {
if (announceTimer) clearTimeout(announceTimer);
announceTimer = setTimeout(() => {
liveAnnounce = '';
announceTimer = null;
}, 500);
}
const titleEmpty = $derived(title.trim().length === 0);
const showTitleError = $derived(titleEmpty && titleTouched);
const isDraft = $derived(status === 'DRAFT');
@@ -93,7 +101,7 @@ async function handleAddDocument(doc: DocumentOption) {
const newItem: JourneyItemView = await res.json();
items = [...items, newItem];
} catch {
items = prev;
items = prev; // prev === items here (add is pessimistic); kept for symmetry with optimistic handlers
mutationError = m.journey_mutation_error_reload();
}
}
@@ -111,7 +119,7 @@ async function handleAddInterlude(text: string) {
const newItem: JourneyItemView = await res.json();
items = [...items, newItem];
} catch {
items = prev;
items = prev; // prev === items here (add is pessimistic); kept for symmetry with optimistic handlers
mutationError = m.journey_mutation_error_reload();
}
}
@@ -152,12 +160,7 @@ async function handleMoveUp(index: number) {
newPosition: index
});
await handleReorder(ids);
// Clear so the live region does not re-announce on unrelated DOM mutations
if (announceTimer) clearTimeout(announceTimer);
announceTimer = setTimeout(() => {
liveAnnounce = '';
announceTimer = null;
}, 500);
scheduleAnnounceReset();
}
async function handleMoveDown(index: number) {
@@ -170,12 +173,7 @@ async function handleMoveDown(index: number) {
newPosition: index + 2
});
await handleReorder(ids);
// Clear so the live region does not re-announce on unrelated DOM mutations
if (announceTimer) clearTimeout(announceTimer);
announceTimer = setTimeout(() => {
liveAnnounce = '';
announceTimer = null;
}, 500);
scheduleAnnounceReset();
}
async function save(nextStatus: 'DRAFT' | 'PUBLISHED') {