Fix navigation: add header to all views, fix back button navigation, add mobile menu to document and editor views

- Document view: Added hamburger menu button and breadcrumb navigation
- Editor view: Added hamburger menu, breadcrumb nav, fixed handleCancel/handleSave
- Editor now navigates to correct parent (project) instead of dashboard
- Mobile menu works on all views (projects, projectView, document, editor)
- Document view back button goes to project (not dashboard)
- Editor cancel/save buttons now go to project or projects list
This commit is contained in:
Hiro
2026-03-28 15:47:09 +00:00
parent 5c54f30b57
commit 98b38ad78a
2 changed files with 85 additions and 7 deletions

View File

@@ -22,6 +22,17 @@ export async function renderDocument(app) {
}
};
// Mobile menu functions
window.toggleDocumentMenu = function() {
const menu = document.getElementById('document-menu');
if (menu) menu.classList.toggle('open');
};
window.closeDocumentMenu = function() {
const menu = document.getElementById('document-menu');
if (menu) menu.classList.remove('open');
};
const appEl = document.getElementById('app');
function render() {
@@ -31,13 +42,31 @@ export async function renderDocument(app) {
appEl.innerHTML = `
<header class="app-header">
<button type="button" class="mobile-nav-btn" onclick="window.toggleDocumentMenu()" title="Menu">☰</button>
<button type="button" class="btn btn-ghost" onclick="backToProject()">← Back</button>
<div class="breadcrumb-nav">
<span class="breadcrumb-link" onclick="window.app.navigate('projects')">Projects</span>
<span class="breadcrumb-sep">/</span>
${projectId ? `<span class="breadcrumb-link" onclick="window.app.navigate('project', {id: '${projectId}'})">Project</span><span class="breadcrumb-sep">/</span>` : ''}
<span class="breadcrumb-current">${escapeHtml(doc.title || 'Document')}</span>
</div>
<div class="header-actions">
<button type="button" class="btn btn-ghost" onclick="window.app.navigate('editor', {id: '${doc.id}'})">✏️ Edit</button>
<button type="button" class="btn btn-ghost" onclick="window.app.navigate('editor', {id: '${doc.id}', projectId: '${projectId || ''}'})">✏️ Edit</button>
<button type="button" class="btn btn-ghost" onclick="exportDoc()">📥 Export</button>
<button type="button" class="btn btn-ghost danger" onclick="deleteDoc()">🗑️ Delete</button>
</div>
</header>
<div class="mobile-menu" id="document-menu">
<div class="mobile-menu-header">
<span>Menu</span>
<button onclick="window.closeDocumentMenu()">✕</button>
</div>
<div class="mobile-menu-content">
<a href="#" onclick="backToProject(); return false;">← Back to ${projectId ? 'Project' : 'Projects'}</a>
<a href="#" onclick="window.app.navigate('editor', {id: '${doc.id}', projectId: '${projectId || ''}'}); window.closeDocumentMenu(); return false;">✏️ Edit Document</a>
<a href="#" onclick="window.app.navigate('projects'); window.closeDocumentMenu(); return false;">📋 All Projects</a>
</div>
</div>
<main class="main-content">
<div class="content-body">
<div class="doc-viewer">