fix(ui): mobile breakpoint layout and peek interactions
Grid forced to single-column at ≤900px for all panel states. Resize handles hidden, transitions killed to prevent slivers. Peek pane gets mobile toolbar (expand/dismiss buttons). Escape dismisses peek at any viewport. Z toggles full-screen peek at mobile instead of no-op zen toggle.
This commit is contained in:
+45
-11
@@ -694,16 +694,21 @@
|
||||
|
||||
pane.classList.add('visible');
|
||||
|
||||
const mobileBar = `<div class="peek-mobile-bar">
|
||||
<button class="peek-mobile-btn" onclick="nibApp.togglePeekFull()">↑</button>
|
||||
<button class="peek-mobile-btn" onclick="nibApp.dismissPeek()">×</button>
|
||||
</div>`;
|
||||
|
||||
if (state.peekMode === 'edit') {
|
||||
pane.innerHTML = renderEditMode(e);
|
||||
pane.innerHTML = mobileBar + renderEditMode(e);
|
||||
} else if (state.view === 'stream' || !e.card_type) {
|
||||
pane.innerHTML = renderStreamPeek(e);
|
||||
pane.innerHTML = mobileBar + renderStreamPeek(e);
|
||||
} else if (state.peekMode === 'run') {
|
||||
pane.innerHTML = renderRunMode(e);
|
||||
pane.innerHTML = mobileBar + renderRunMode(e);
|
||||
} else if (state.peekMode === 'fill') {
|
||||
pane.innerHTML = renderFillMode(e);
|
||||
pane.innerHTML = mobileBar + renderFillMode(e);
|
||||
} else {
|
||||
pane.innerHTML = renderCardPeek(e);
|
||||
pane.innerHTML = mobileBar + renderCardPeek(e);
|
||||
}
|
||||
|
||||
bindPeekEvents(e);
|
||||
@@ -1401,6 +1406,20 @@
|
||||
if (idx >= 0) { state.selectedIndex = idx; renderEntityList(); renderDetailPane(); }
|
||||
showToast(e.pinned ? 'unpinned' : 'pinned');
|
||||
},
|
||||
|
||||
togglePeekFull() {
|
||||
const pane = $('#detail-pane');
|
||||
pane.classList.toggle('peek-full');
|
||||
const btn = pane.querySelector('.peek-mobile-btn');
|
||||
if (btn) btn.textContent = pane.classList.contains('peek-full') ? '↓' : '↑';
|
||||
},
|
||||
|
||||
dismissPeek() {
|
||||
const pane = $('#detail-pane');
|
||||
pane.classList.remove('visible', 'peek-full');
|
||||
state.selectedIndex = -1;
|
||||
renderEntityList();
|
||||
},
|
||||
};
|
||||
|
||||
// ========== Promote modal ==========
|
||||
@@ -1451,12 +1470,18 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.key === 'Escape' && $('main').classList.contains('focus-peek')) {
|
||||
exitFocusPeek();
|
||||
state.selectedIndex = -1;
|
||||
renderEntityList();
|
||||
renderDetailPane();
|
||||
return;
|
||||
if (ev.key === 'Escape') {
|
||||
const pane = $('#detail-pane');
|
||||
if ($('main').classList.contains('focus-peek')) {
|
||||
exitFocusPeek();
|
||||
}
|
||||
if (pane.classList.contains('visible')) {
|
||||
pane.classList.remove('visible', 'peek-full');
|
||||
state.selectedIndex = -1;
|
||||
renderEntityList();
|
||||
renderDetailPane();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const sel = state.entities[state.selectedIndex];
|
||||
@@ -1540,7 +1565,16 @@
|
||||
localStorage.setItem('nib:' + cls, m.classList.contains(cls) ? '1' : '');
|
||||
}
|
||||
|
||||
function isMobileBreakpoint() {
|
||||
return window.matchMedia('(max-width: 900px)').matches;
|
||||
}
|
||||
|
||||
function toggleZen() {
|
||||
if (isMobileBreakpoint()) {
|
||||
if (state.selectedIndex >= 0) nibApp.togglePeekFull();
|
||||
return;
|
||||
}
|
||||
|
||||
const m = $('main');
|
||||
|
||||
if (m.classList.contains('focus-peek')) {
|
||||
|
||||
Reference in New Issue
Block a user