feat: add dynamic page switcher dropdown in editor header and ensure exact page route rendering
All checks were successful
Production Build & Deploy / build-and-deploy (push) Successful in 49s

This commit is contained in:
Daniel S
2026-08-10 00:28:44 +02:00
parent 698716c34e
commit 1939563ef2
2 changed files with 17 additions and 6 deletions

View File

@@ -28,5 +28,5 @@
"sections": []
}
],
"updated_at": "2026-08-09T22:25:49.609Z"
"updated_at": "2026-08-09T22:28:31.200Z"
}

View File

@@ -64,12 +64,17 @@ const previewUrl = `${targetPage?.slug || "/"}?preview=draft`;
></path></svg
>
</button>
<span
class="text-xs font-bold truncate max-w-[170px] text-slate-200"
title={targetPage.title}
<select
id="editor-page-switcher"
class="bg-[#262626] border border-[#333] hover:border-[#38bdf8] text-xs font-bold text-slate-200 rounded px-2 py-1 outline-none transition-colors max-w-[160px] cursor-pointer"
title="Seite im Editor wechseln"
>
{targetPage.title}
</span>
{pages.map((p: any) => (
<option value={p.id} selected={p.id === targetPage.id}>
{p.title} ({p.slug})
</option>
))}
</select>
</div>
<div class="flex items-center gap-1">
<span
@@ -957,6 +962,12 @@ const previewUrl = `${targetPage?.slug || "/"}?preview=draft`;
});
});
// Page Switcher Dropdown Handler
document.getElementById("editor-page-switcher")?.addEventListener("change", (e: any) => {
const selectedPageId = e.target.value;
window.location.href = `/admin/editor/?page_id=${selectedPageId}`;
});
// Page Settings Modal
const modalPage = document.getElementById(
"modal-page-settings",