← back to Dw Pitch Followup
pitch: email history collapsed by default, lazy-loads on expand (George search only fires when opened)
e592d479f509025ccb7864e04c4fabda4bdc44f8 · 2026-07-15 09:52:22 -0700 · Steve
Files touched
Diff
commit e592d479f509025ccb7864e04c4fabda4bdc44f8
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Jul 15 09:52:22 2026 -0700
pitch: email history collapsed by default, lazy-loads on expand (George search only fires when opened)
---
public/index.html | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/public/index.html b/public/index.html
index 46bfb58..4bd79cd 100644
--- a/public/index.html
+++ b/public/index.html
@@ -42,7 +42,11 @@
.pgallery a{color:var(--gold);text-decoration:none;font-size:13px}
.pgallery a:hover{text-decoration:underline}
.pgallery .pg-name{font-size:13px;color:var(--ink)}
+ .emhdr{cursor:pointer;font-weight:600;user-select:none;display:flex;align-items:center;gap:6px}
+ .emhdr:hover{color:var(--gold)}
+ .emhdr .emcaret{color:var(--mut);font-size:11px}
.emails{margin-top:6px;display:flex;flex-direction:column;gap:7px;max-height:340px;overflow-y:auto}
+ .emails[hidden]{display:none}
.emails .emcount{font-size:11px;color:var(--mut);text-transform:uppercase;letter-spacing:.04em}
.emails .em{border-left:2px solid var(--line);padding:2px 0 3px 9px;font-size:12.5px;line-height:1.4}
.emails .em .emdate{color:var(--mut)}
@@ -390,7 +394,7 @@ function panelContextHTML(list,r){
if(list!=='list3') html+=merchBlock(r);
html+=samplesBlock(r);
html+=`<div class="drow lastcorr" data-lastcorr>📨 Last corresponded: <span data-lc>${(list==='list3')?'—':'click to load…'}</span></div>`;
- if(list!=='list3') html+=`<div class="drow"><b>📧 All emails with this client</b><div class="emails" data-emails>loading…</div></div>`;
+ if(list!=='list3') html+=`<div class="drow emblock"><div class="emhdr" data-emtoggle>📧 All emails with this client <span class="emcaret">▸</span></div><div class="emails" data-emails hidden></div></div>`;
return html;
}
function openPanel(){document.getElementById('panel').classList.add('open');document.body.classList.add('panel-open')}
@@ -419,7 +423,7 @@ function openPanelFor(card,{generate=false}={}){
if(reorder){ document.getElementById('pSubj').innerHTML='<span class="reorder-note">Reorder Samples?? — nothing has shipped yet, so there’s nothing to follow up on.</span>'; }
openPanel();
renderLetterGallery(r);
- if(list!=='list3'){ loadLastCorr(r); loadEmails(r); }
+ if(list!=='list3') loadLastCorr(r); // emails load on demand when the collapsed section is expanded
if(generate && !reorder) composeLetter({});
}
// Small product strip under the letter: thumbnail + link to the DW product page for each
@@ -453,7 +457,8 @@ function paintLastCorr(wrap,span,val){
}
// Full email thread history with this client (both directions), loaded when the drawer opens.
async function loadEmails(r){
- const el=document.querySelector('#pCtx [data-emails]'); if(!el)return;
+ const el=document.querySelector('#pCtx [data-emails]'); if(!el||el.dataset.loaded)return;
+ el.dataset.loaded='1';
const email=(r.email||'').trim(); if(!email){el.textContent='no email on file for this client';return}
el.textContent='loading emails…';
try{
@@ -587,6 +592,14 @@ async function openSentLog(){
document.getElementById('sentBtn').addEventListener('click',openSentLog);
// panel buttons
document.getElementById('pClose').addEventListener('click',()=>{document.body.classList.remove('log-mode');closePanel();});
+// Expand/collapse the client's email history — lazy-load on first expand (collapsed by default).
+document.getElementById('pCtx').addEventListener('click',e=>{
+ const t=e.target.closest('[data-emtoggle]'); if(!t)return;
+ const box=t.parentElement.querySelector('[data-emails]'); if(!box)return;
+ const open=box.hasAttribute('hidden');
+ if(open){ box.removeAttribute('hidden'); t.querySelector('.emcaret').textContent='▾'; if(active&&active.row)loadEmails(active.row); }
+ else { box.setAttribute('hidden',''); t.querySelector('.emcaret').textContent='▸'; }
+});
document.getElementById('pGen').addEventListener('click',()=>composeLetter({}));
document.getElementById('pRegen').addEventListener('click',()=>composeLetter({regenerate:true}));
document.getElementById('pCopy').addEventListener('click',e=>{const ta=document.getElementById('pBody');navigator.clipboard.writeText(`Subject: ${document.getElementById('pSubj').textContent.replace(/^Subject: /,'')}\n\n${ta.value}`);e.target.textContent='Copied ✓';setTimeout(()=>e.target.textContent='Copy',1200)});
← a4bc2e8 pitch: Details drawer shows full email history with each cli
·
back to Dw Pitch Followup
·
pitch: add 3x/day launchd rebuild so the board never goes st 8f32c4b →