ohmyapi Claude Haiku 4.5 commited on
Commit
d3dfe84
·
1 Parent(s): 67c13e5

fix: mailbox layout - expand to full width, fix height and navigation

Browse files

- Add .mail-active class to remove max-width constraint on mailbox tab
- Fix mb-wrap height calc to account for container padding
- Replace fragile setTimeout in _mb() with proper async account loading
- Add min-height:0 on iframe container to prevent flex overflow
- Fix duplicate </iframe> tag

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. outlook2api/static/admin.html +34 -5
outlook2api/static/admin.html CHANGED
@@ -81,6 +81,7 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;font-size:
81
  .nav svg{width:18px;height:18px;flex-shrink:0}
82
  .side-foot{margin-top:auto;padding-top:.5rem;border-top:1px solid var(--border);display:flex;flex-direction:column}
83
  .main{margin-left:240px;flex:1;padding:2rem 2.5rem;max-width:1000px;width:100%}
 
84
  .main h2{font-size:1.35rem;margin-bottom:1.2rem;font-weight:700;letter-spacing:-.01em}
85
 
86
  /* ---- Mobile ---- */
@@ -92,6 +93,7 @@ button{font-family:inherit;cursor:pointer;border:none;background:none;font-size:
92
  .ov.open{display:block}
93
  .menu-btn{display:block}
94
  .main{margin-left:0;padding:1rem;padding-top:3.5rem}
 
95
  .mb-wrap{flex-direction:column;height:auto!important}
96
  .mb-col1,.mb-col2{width:100%!important;height:200px;border-right:none!important;border-bottom:1px solid var(--border)}
97
  .mb-col3{height:400px}
@@ -152,7 +154,7 @@ tr:hover td{background:var(--brand-bg)}
152
  .m-del{background:var(--err-bg);color:var(--err)}
153
 
154
  /* ---- Mailbox 3-col ---- */
155
- .mb-wrap{display:flex;height:calc(100vh - 10px);border:1px solid var(--border);border-radius:var(--r2);overflow:hidden;background:var(--surface)}
156
  .mb-col1{width:240px;border-right:1px solid var(--border);background:var(--surface);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden}
157
  .mb-col2{width:300px;border-right:1px solid var(--border);background:var(--surface);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden}
158
  .mb-col3{flex:1;background:var(--bg2);display:flex;flex-direction:column;min-width:0;overflow:hidden}
@@ -350,8 +352,8 @@ pre{background:var(--bg);border:1px solid var(--border);border-radius:8px;paddin
350
  <span id="mbLink"></span>
351
  </div>
352
  </div>
353
- <div style="flex:1;padding:1rem;overflow:auto">
354
- <iframe id="mbBody" style="width:100%;height:100%;min-height:400px;border:1px solid var(--border);border-radius:var(--r);background:#fff" sandbox="allow-same-origin"></iframe>
355
  </div>
356
  </div>
357
  <!-- Compose view -->
@@ -528,6 +530,11 @@ var tabs=['dash','acct','imp','mail','docs'];
528
  function loadTab(t){
529
  tabs.forEach(function(id){hide('t-'+id)});
530
  show('t-'+t,'block');
 
 
 
 
 
531
  if(t==='dash')loadDash();
532
  if(t==='acct'){page=1;loadAccts()}
533
  if(t==='mail')loadMbAccts();
@@ -827,8 +834,30 @@ $('sendBtn').onclick=function(){
827
  W._mb=function(id,email){
828
  curTab='mail';
829
  navBtns.forEach(function(b){b.classList.remove('on');if(b.getAttribute('data-t')==='mail')b.classList.add('on')});
830
- loadTab('mail');
831
- setTimeout(function(){selectMbAcct(id,email)},300);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
832
  };
833
 
834
  /* ========== API DOCS ========== */
 
81
  .nav svg{width:18px;height:18px;flex-shrink:0}
82
  .side-foot{margin-top:auto;padding-top:.5rem;border-top:1px solid var(--border);display:flex;flex-direction:column}
83
  .main{margin-left:240px;flex:1;padding:2rem 2.5rem;max-width:1000px;width:100%}
84
+ .main.mail-active{max-width:none;padding:.5rem}
85
  .main h2{font-size:1.35rem;margin-bottom:1.2rem;font-weight:700;letter-spacing:-.01em}
86
 
87
  /* ---- Mobile ---- */
 
93
  .ov.open{display:block}
94
  .menu-btn{display:block}
95
  .main{margin-left:0;padding:1rem;padding-top:3.5rem}
96
+ .main.mail-active{padding:.5rem;padding-top:3.5rem}
97
  .mb-wrap{flex-direction:column;height:auto!important}
98
  .mb-col1,.mb-col2{width:100%!important;height:200px;border-right:none!important;border-bottom:1px solid var(--border)}
99
  .mb-col3{height:400px}
 
154
  .m-del{background:var(--err-bg);color:var(--err)}
155
 
156
  /* ---- Mailbox 3-col ---- */
157
+ .mb-wrap{display:flex;height:calc(100vh - 60px);border:1px solid var(--border);border-radius:var(--r2);overflow:hidden;background:var(--surface)}
158
  .mb-col1{width:240px;border-right:1px solid var(--border);background:var(--surface);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden}
159
  .mb-col2{width:300px;border-right:1px solid var(--border);background:var(--surface);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden}
160
  .mb-col3{flex:1;background:var(--bg2);display:flex;flex-direction:column;min-width:0;overflow:hidden}
 
352
  <span id="mbLink"></span>
353
  </div>
354
  </div>
355
+ <div style="flex:1;padding:1rem;overflow:auto;min-height:0">
356
+ <iframe id="mbBody" style="width:100%;height:100%;min-height:300px;border:1px solid var(--border);border-radius:var(--r);background:#fff" sandbox="allow-same-origin"></iframe>
357
  </div>
358
  </div>
359
  <!-- Compose view -->
 
530
  function loadTab(t){
531
  tabs.forEach(function(id){hide('t-'+id)});
532
  show('t-'+t,'block');
533
+ var mainEl=document.querySelector('.main');
534
+ if(mainEl){
535
+ if(t==='mail'){mainEl.classList.add('mail-active')}
536
+ else{mainEl.classList.remove('mail-active')}
537
+ }
538
  if(t==='dash')loadDash();
539
  if(t==='acct'){page=1;loadAccts()}
540
  if(t==='mail')loadMbAccts();
 
834
  W._mb=function(id,email){
835
  curTab='mail';
836
  navBtns.forEach(function(b){b.classList.remove('on');if(b.getAttribute('data-t')==='mail')b.classList.add('on')});
837
+ tabs.forEach(function(tid){hide('t-'+tid)});
838
+ show('t-mail','block');
839
+ var mainEl=document.querySelector('.main');
840
+ if(mainEl)mainEl.classList.add('mail-active');
841
+ // Load accounts then select the target account
842
+ var list=$('mbAcctList');
843
+ list.innerHTML='<div class="mb-empty">Loading...</div>';
844
+ api('/admin/api/accounts?limit=500').then(function(d){
845
+ mbAccts=d.accounts||[];
846
+ if(!mbAccts.length){list.innerHTML='<div class="mb-empty">No accounts</div>';return}
847
+ list.innerHTML=mbAccts.map(function(a){
848
+ return '<div class="mb-item'+(a.id===id?' on':'')+'" data-id="'+esc(a.id)+'" data-em="'+esc((a.email||'').toLowerCase())+'">'
849
+ +'<div style="font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.83rem">'+esc(a.email||'')+'</div>'
850
+ +'<div style="color:var(--text3);font-size:.73rem;margin-top:.15rem">'
851
+ +'<span class="badge '+(a.is_active!==false?'b-ok':'b-err')+'" style="font-size:.65rem">'+(a.is_active!==false?'Active':'Inactive')+'</span>'
852
+ +' '+esc(a.source||'')+'</div>'
853
+ +'</div>';
854
+ }).join('');
855
+ list.querySelectorAll('.mb-item').forEach(function(el){
856
+ el.onclick=function(){selectMbAcct(el.getAttribute('data-id'),el.getAttribute('data-em'))};
857
+ });
858
+ populateCFrom();
859
+ selectMbAcct(id,email);
860
+ }).catch(function(e){list.innerHTML='<div class="mb-empty">Error loading</div>'});
861
  };
862
 
863
  /* ========== API DOCS ========== */