fix(webui): fully fixed header/footer (position: fixed) with page padding; snap to bottom on initial tail load; remove faded footer
This commit is contained in:
parent
21a49c18a0
commit
c125d05f26
2 changed files with 9 additions and 7 deletions
|
|
@ -1,17 +1,17 @@
|
|||
html, body { height: 100%; }
|
||||
body { padding: 0; display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }
|
||||
header.nav { position: sticky; top: 0; z-index: 1000; padding: .6rem 1rem; border-bottom: 1px solid var(--muted-border-color); display: flex; justify-content: space-between; align-items: center; background-color: var(--pico-background-color, #fff); }
|
||||
body { padding: 56px 0 44px 0; min-height: 100vh; }
|
||||
header.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; padding: .6rem 1rem; border-bottom: 1px solid var(--muted-border-color); display: flex; justify-content: space-between; align-items: center; background-color: var(--pico-background-color, #fff); }
|
||||
header.nav a.brand { text-decoration: none; font-weight: 600; }
|
||||
/* Dashboard-only grid layout */
|
||||
.dash { display: grid; grid-template-columns: 220px 1fr; gap: 0; height: 100%; min-height: 0; }
|
||||
.dash { display: grid; grid-template-columns: 220px 1fr; gap: 0; }
|
||||
.dash aside.sidebar { border-right: 1px solid var(--muted-border-color); padding: .75rem; overflow-y: auto; }
|
||||
.dash aside.sidebar a { display:block; padding:.25rem .5rem; border-radius:.25rem; text-decoration:none; }
|
||||
.dash aside.sidebar a.active { background: var(--muted-color); color: var(--contrast); }
|
||||
.dash section.chat { padding: .75rem 1rem; display:flex; flex-direction: column; height: 100%; min-height: 0; }
|
||||
#tail { flex: 1; overflow: visible; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; height: auto; }
|
||||
.dash section.chat { padding: .75rem 1rem; display:flex; flex-direction: column; }
|
||||
#tail { flex: 1; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
|
||||
.ts { opacity: .66; }
|
||||
.msg { margin-bottom: .25rem; }
|
||||
footer { position: sticky; bottom: 0; z-index: 1000; text-align: center; font-size: .85rem; padding: .5rem 0; opacity: .7; background-color: var(--pico-background-color, #fff); border-top: 1px solid var(--muted-border-color); }
|
||||
footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; text-align: center; font-size: .85rem; padding: .5rem 0; background-color: var(--pico-background-color, #fff); border-top: 1px solid var(--muted-border-color); }
|
||||
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } .dash aside.sidebar { display:none; } }
|
||||
/* Summarizer output wrapping */
|
||||
#out { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ function processLinks(scope){ const links = scope.querySelectorAll('a[href]:not(
|
|||
async function loadChannels(){ try{ const data = await api('/api/channels'); st.channels = data; renderChannels(); if(data.length>0){ selectChannel(data[0]); } } catch(e){} }
|
||||
function renderChannels(){ const list=document.getElementById('chanlist'); if(!list) return; list.innerHTML=''; st.channels.forEach(c=>{ const a=document.createElement('a'); a.href='#'; a.textContent=c; a.onclick=(ev)=>{ev.preventDefault(); selectChannel(c)}; if(c===st.current) a.className='active'; list.appendChild(a); }); }
|
||||
|
||||
async function selectChannel(ch){ if(st.sse){ st.sse.close(); st.sse=null; } st.current=ch; renderChannels(); const el=document.getElementById('tail'); if(!el) return; el.textContent=''; const data = await api('/api/tail',{query:{channel:ch,limit:50}}); appendBatch(data); el.scrollTop = el.scrollHeight; st.atBottom=true; st.earliest = data.length? data[0].time : null; startStream(); initScrollHandlers(); }
|
||||
async function selectChannel(ch){ if(st.sse){ st.sse.close(); st.sse=null; } st.current=ch; renderChannels(); const el=document.getElementById('tail'); if(!el) return; el.textContent=''; const data = await api('/api/tail',{query:{channel:ch,limit:50}}); appendBatch(data); // snap to bottom after initial load
|
||||
setTimeout(()=>{ window.scrollTo({ top: document.documentElement.scrollHeight, behavior: 'instant' }); st.atBottom=true; }, 0);
|
||||
st.earliest = data.length? data[0].time : null; startStream(); initScrollHandlers(); }
|
||||
function initScrollHandlers(){ const el=document.getElementById('tail'); if(!el) return; const onScroll = async ()=>{ const nearBottom = (window.innerHeight + window.pageYOffset + 16) >= document.documentElement.scrollHeight; st.atBottom = nearBottom; const nearTop = window.pageYOffset <= 4; if(nearTop && st.earliest){ try{ const older = await api('/api/history',{query:{channel:st.current,before:st.earliest,limit:50}}); if(older.length){ prependBatch(older); st.earliest = older[0].time; } } catch(e){} } }; window.removeEventListener('scroll', st._scrollHandler || (()=>{})); st._scrollHandler = onScroll; window.addEventListener('scroll', onScroll, {passive:true}); }
|
||||
|
||||
function startStream(){ const el=document.getElementById('tail'); if(!el) return; const url=new URL('/api/stream', window.location.origin); url.searchParams.set('channel', st.current); const es=new EventSource(url); st.sse=es; es.onmessage=(ev)=>{ try{ const m=JSON.parse(ev.data); appendBatch([m]); }catch(e){} }; es.onerror=()=>{ es.close(); st.sse=null; setTimeout(startStream, 3000); } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue