Text Generation
Transformers
Safetensors
designcoder
ui-generation
front-end
html
css
javascript
code-generation
full-sft
Instructions to use xingxm/DesignCoder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use xingxm/DesignCoder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="xingxm/DesignCoder")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("xingxm/DesignCoder", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use xingxm/DesignCoder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "xingxm/DesignCoder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingxm/DesignCoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/xingxm/DesignCoder
- SGLang
How to use xingxm/DesignCoder with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "xingxm/DesignCoder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingxm/DesignCoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "xingxm/DesignCoder" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "xingxm/DesignCoder", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use xingxm/DesignCoder with Docker Model Runner:
docker model run hf.co/xingxm/DesignCoder
Download eval/api_baselines_200/pages/glm-5.1/dashboard-014-developer-first-minimal.html from xingxm/DesignCoder: direct link, hf CLI and curl.
- Browser
- Download file 34.7 kB
-
https://huggingface.co/xingxm/DesignCoder/resolve/main/eval/api_baselines_200/pages/glm-5.1/dashboard-014-developer-first-minimal.html
- Command line
-
hf download hf://xingxm/DesignCoder/eval/api_baselines_200/pages/glm-5.1/dashboard-014-developer-first-minimal.html
-
curl -L -o dashboard-014-developer-first-minimal.html https://huggingface.co/xingxm/DesignCoder/resolve/main/eval/api_baselines_200/pages/glm-5.1/dashboard-014-developer-first-minimal.html
34.7 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Mailrail — Deliverability Console</title> | |
| <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> | |
| <script src="https://registry.npmmirror.com/echarts/5.5.1/files/dist/echarts.min.js"></script> | |
| <script src="https://registry.npmmirror.com/lucide/0.468.0/files/dist/umd/lucide.min.js"></script> | |
| <style> | |
| *,*::before,*::after{box-sizing:border-box;margin:0;padding:0} | |
| :root{ | |
| --bg-0:#0B1020;--bg-1:#0F172A;--bg-2:#1E293B;--bg-3:#334155; | |
| --text-0:#F1F5F9;--text-1:#CBD5E1;--text-2:#94A3B8;--text-3:#64748B; | |
| --accent:#06B6D4;--accent-dim:rgba(6,182,212,.12); | |
| --red:#EF4444;--red-dim:rgba(239,68,68,.12); | |
| --green:#22C55E;--green-dim:rgba(34,197,94,.12); | |
| --amber:#F59E0B;--amber-dim:rgba(245,158,11,.12); | |
| --border:#1E293B;--border-light:#334155; | |
| --mono:'JetBrains Mono','Fira Code','SF Mono',Consolas,monospace; | |
| --sans:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; | |
| } | |
| html{font-size:14px;background:var(--bg-0);color:var(--text-1)} | |
| body{font-family:var(--sans);min-height:100vh;overflow-x:hidden} | |
| .mono{font-family:var(--mono);font-variant-numeric:tabular-nums} | |
| /* Throttle banner */ | |
| #throttle-banner{ | |
| background:linear-gradient(90deg,rgba(239,68,68,.08),rgba(245,158,11,.08),rgba(239,68,68,.08)); | |
| border-bottom:1px solid rgba(239,68,68,.25); | |
| padding:6px 20px;display:flex;align-items:center;gap:10px; | |
| font-family:var(--mono);font-size:12px;color:var(--amber); | |
| position:relative;overflow:hidden; | |
| } | |
| #throttle-banner::before{ | |
| content:'';position:absolute;inset:0; | |
| background:linear-gradient(90deg,transparent 0%,rgba(245,158,11,.04) 50%,transparent 100%); | |
| animation:banner-sweep 3s ease-in-out infinite; | |
| } | |
| @keyframes banner-sweep{0%,100%{transform:translateX(-100%)}50%{transform:translateX(100%)}} | |
| .pulse-dot{ | |
| width:8px;height:8px;border-radius:50%;background:var(--amber); | |
| animation:pulse 1.5s ease-in-out infinite;flex-shrink:0; | |
| } | |
| @keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}} | |
| @media(prefers-reduced-motion:reduce){ | |
| .pulse-dot{animation:none} | |
| #throttle-banner::before{animation:none} | |
| @keyframes banner-sweep{0%,100%{transform:none}} | |
| } | |
| /* Header */ | |
| header{ | |
| display:flex;align-items:center;justify-content:space-between; | |
| padding:10px 20px;border-bottom:1px solid var(--border); | |
| background:var(--bg-1);gap:16px;flex-wrap:wrap; | |
| } | |
| .brand{display:flex;align-items:center;gap:8px;font-weight:700;font-size:15px;color:var(--text-0)} | |
| .brand svg{color:var(--accent)} | |
| .brand span{letter-spacing:-.3px} | |
| .brand .env{font-family:var(--mono*);font-size:10px;background:var(--accent-dim);color:var(--accent);padding:2px 6px;border-radius:3px;font-weight:500;margin-left:4px} | |
| .header-right{display:flex;align-items:center,center);gap:12px;align-items:center} | |
| /* Search */ | |
| .search-wrap{ | |
| position:relative;display:flex;align-items:center; | |
| } | |
| .search-input{ | |
| font-family:var(--mono);font-size:12px; | |
| background:var(--bg-0);border:1px solid var(--border); | |
| color:var(--text-1);padding:5px 10px 5px 26px;border-radius:4px; | |
| width:220px;transition:border-color .15s,width .2s;outline:none; | |
| } | |
| .search-input:focus{border-color:var(--accent);width:300px} | |
| .search-input::placeholder{color:var(--text-3)} | |
| .search-prefix{ | |
| position:absolute;left:8px;color:var(--text-3);font-family:var(--mono);font-size:12px; | |
| pointer-events:none; | |
| } | |
| .search-hint{ | |
| font-family:var(--mono);font-size:10px;color:var(--text-3); | |
| background:var(--bg-2);padding:2px 5px;border-radius:3px; | |
| border:1px solid var(--border-light);margin-left:8px; | |
| } | |
| /* Time chips */ | |
| .time-chips{display:flex;gap:2px;background:var(--bg-0);border-radius:5px;padding:2px;border:1px solid var(--border)} | |
| .time-chip{ | |
| font-family:var(--mono);font-size:11px;font-weight:500; | |
| padding:4px 12px;border-radius:3px;cursor:pointer; | |
| color:var(--text-2);background:transparent;border:none; | |
| transition:all .12s; | |
| } | |
| .time-chip:hover{color:var(--text-1)} | |
| .time-chip.active{background:var(--accent);color:#0B1020} | |
| .time-chip:focus-visible{outline:2px solid var(--accent);outline-offset:1px} | |
| /* Main */ | |
| main{padding:16px 20px 20px} | |
| /* KPI Row */ | |
| .kpi-row{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px} | |
| .kpi-card{ | |
| background:var(--bg-1);border:1px solid var(--border);border-radius:6px; | |
| padding:14px 16px;position:relative;overflow:hidden; | |
| } | |
| .kpi-card::after{ | |
| content:'';position:absolute;top:0;left:0;right:0;height:2px; | |
| } | |
| .kpi-card.kpi-delivered::after{background:var(--green)} | |
| .kpi-card.kpi-bounce::after{background:var(--red)} | |
| .kpi-card.kpi-complaint::after{background:var(--amber)} | |
| .kpi-card.kpi-latency::after{background:var(--accent)} | |
| .kpi-label{font-size:11px;color:var(--text-3);text-transform:uppercase;letter-spacing:.6px;margin-bottom:6px;font-weight:500} | |
| .kpi-value{font-family:var(--mono);font-size:28px;font-weight:700;color:var(--text-0);line-height:1} | |
| .kpi-delta{ | |
| display:inline-flex;align-items:center;gap:3px; | |
| font-family:var(--mono);font-size:11px;font-weight:600; | |
| padding:2px 7px;border-radius:10px;margin-top:8px; | |
| } | |
| .kpi-delta.up-good{background:var(--green-dim);color:var(--green)} | |
| .kpi-delta.down-bad{background:var(--red-dim);color:var(--red)} | |
| .kpi-delta.up-bad{background:var(--red-dim);color:var(--red)} | |
| .kpi-delta.down-good{background:var(--green-dim);color:var(--green)} | |
| .kpi-delta svg{width:12px;height:12px} | |
| /* Charts Row */ | |
| .charts-row{display:grid;grid-template-columns:1fr 340px;gap:12px;margin-bottom:16px} | |
| .chart-card{ | |
| background:var(--bg-1);border:1px solid var(--border);border-radius:6px; | |
| padding:14px 16px;overflow:hidden; | |
| } | |
| .chart-title{font-size:12px;font-weight:600;color:var(--text-2);margin-bottom:10px;letter-spacing:.3px;text-transform:uppercase} | |
| .chart-container{width:100%;height:260px} | |
| .chart-legend{display:flex;gap:16px;margin-top:8px;font-family:var(--mono);font-size:11px;color:var(--text-2)} | |
| .chart-legend-item{display:flex;align-items:center;gap:5px} | |
| .chart-legend-dot{width:8px;height:8px;border-radius:2px} | |
| /* Provider bar extras */ | |
| .provider-stats{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:10px} | |
| .provider-stat{ | |
| display:flex;align-items:center;gap:6px; | |
| font-family:var(--mono);font-size:11px;color:var(--text-2); | |
| padding:4px 8px;background:var(--bg-0);border-radius:4px; | |
| } | |
| .provider-stat .dot{width:6px;height:6px;border-radius:50%;flex-shrink:0} | |
| /* Domain Table */ | |
| .table-section{ | |
| background:var(--bg-1);border:1px solid var(--border);border-radius:6px; | |
| overflow:hidden; | |
| } | |
| .table-header{ | |
| display:flex;align-items:center;justify-content:space-between; | |
| padding:10px 16px;border-bottom:1px solid var(--border); | |
| } | |
| .table-header-left{display:flex;align-items:center;gap:8px} | |
| .table-header h3{font-size:13px;font-weight:600;color:var(--text-1)} | |
| .table-count{font-family:var(--mono);font-size:11px;color:var(--text-3);background:var(--bg-0);padding:2px 8px;border-radius:10px} | |
| .table-head{ | |
| display:grid; | |
| grid-template-columns:220px 52px 52px 60px 80px 72px 120px 48px; | |
| gap:0;padding:8px 16px;font-family:var(--mono);font-size:10px; | |
| color:var(--text-3);text-transform:uppercase;letter-spacing:.6px; | |
| border-bottom:1px solid var(--border);background:var(--bg-0); | |
| position:sticky;top:0;z-index:2; | |
| } | |
| .table-head>div{display:flex;align-items:center} | |
| .table-body{max-height:420px;overflow-y:auto} | |
| .table-body::-webkit-scrollbar{width:6px} | |
| .table-body::-webkit-scrollbar-track{background:var(--bg-1)} | |
| .table-body::-webkit-scrollbar-thumb{background:var(--bg-3);border-radius:3px} | |
| .table-row{ | |
| display:grid; | |
| grid-template-columns:220px 52px 52px 60px 80px 72px 120px 48px; | |
| gap:0;padding:9px 16px;font-family:var(--mono);font-size:12px; | |
| border-bottom:1px solid var(--border);cursor:pointer; | |
| transition:background .1s;color:var(--text-1); | |
| } | |
| .table-row:hover{background:rgba(6,182,212,.04)} | |
| .table-row.selected{background:var(--accent-dim)} | |
| .table-row>div{display:flex;align-items:center} | |
| .domain-name{color:var(--text-0);font-weight:500;gap:6px} | |
| .domain-name .lock{color:var(--text-3);width:12px;height:12px} | |
| /* Status dots */ | |
| .status-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0} | |
| .status-dot.active{background:var(--green)} | |
| .status-dot.throttled{background:var(--amber);animation:pulse 1.5s ease-in-out infinite} | |
| .status-dot.warning{background:var(--amber)} | |
| .status-dot.suspended{background:var(--red)} | |
| .status-dot.unknown{background:var(--text-3)} | |
| /* Check/cross icons */ | |
| .check-icon{color:var(--green);width:14px;height:14px} | |
| .cross-icon{color:var(--red);width:14px;height:14px} | |
| .partial-icon{color:var(--amber);width:14px;height:14px} | |
| /* Identicon */ | |
| .identicon{width:22px;height:22px;border-radius:3px;flex-shrink:0;image-rendering:pixelated} | |
| /* Drill-down */ | |
| .drill-down{ | |
| grid-column:1/-1;padding:0 16px;overflow:hidden; | |
| max-height:0;transition:max-height .25s ease,padding .25s ease; | |
| background:var(--bg-0);border-left:3px solid transparent; | |
| } | |
| .drill-down.open{max-height:200px;padding:12px 16px;border-left-color:var(--accent)} | |
| .drill-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px} | |
| .drill-item label{display:block;font-size:10px;color:var(--text-3);text-transform:uppercase;letter-spacing:.5px;margin-bottom:3px} | |
| .drill-item span{font-family:var(--mono);font-size:12px;color:var(--text-1)} | |
| .drill-actions{display:flex;gap:8px;margin-top:10px} | |
| .drill-btn{ | |
| font-family:var(--mono);font-size:11px;padding:5px 12px;border-radius:4px; | |
| cursor:pointer;border:1px solid var(--border-light);background:var(--bg-2); | |
| color:var(--text-2);transition:all .12s; | |
| } | |
| .drill-btn:hover{border-color:var(--accent);color:var(--accent)} | |
| .drill-btn.danger{border-color:rgba(239,68,68,.3);color:var(--red)} | |
| .drill-btn.danger:hover{background:var(--red-dim);border-color:var(--red)} | |
| /* Bounce color coding */ | |
| .bounce-low{color:var(--green)} | |
| .bounce-mid{color:var(--amber)} | |
| .bounce-high{color:var(--red)} | |
| /* Toast notification */ | |
| .toast{ | |
| position:fixed;bottom:20px;right:20px; | |
| background:var(--bg-2);border:1px solid var(--border-light); | |
| border-radius:6px;padding:10px 16px;font-family:var(--mono);font-size:12px; | |
| color:var(--text-1);display:flex;align-items:center;gap:8px; | |
| transform:translateY(80px);opacity:0;transition:all .2s;z-index:100; | |
| box-shadow:0 8px 24px rgba(0,0,0,.4); | |
| } | |
| .toast.show{transform:translateY(0);opacity:1} | |
| .toast .toast-accent{width:3px;height:20px;border-radius:2px;background:var(--accent);flex-shrink:0} | |
| </style> | |
| </head> | |
| <body> | |
| <!-- Throttle Banner --> | |
| <div id="throttle-banner" role="alert" aria-live="polite"> | |
| <span class="pulse-dot"></span> | |
| <span>RETRYING</span> | |
| <span style="color:var(--text-2)">— Outlook deferred 421 2.1.0 on <span style="color:var(--text-0)">marketing.acmecorp.com</span> — exponential backoff 3/8 — est. clear 14:32 UTC</span> | |
| <span style="margin-left:auto;color:var(--text-3)">last attempt 4s ago</span> | |
| </div> | |
| <!-- Header --> | |
| <header> | |
| <div class="brand"> | |
| <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/></svg> | |
| <span>Mailrail</span> | |
| <span class="env" style="font-family:var(--mono)">PROD</span> | |
| </div> | |
| <div style="display:flex;align-items:center;gap:12px"> | |
| <div class="search-wrap"> | |
| <span class="search-prefix">/</span> | |
| <input id="search-input" class="search-input" type="text" placeholder="search domains…" aria-label="Search domains" autocomplete="off"> | |
| </div> | |
| <span class="search-hint">/</span> | |
| <div class="time-chips" role="radiogroup" aria-label="Time range"> | |
| <button class="time-chip" data-period="1h" role="radio" aria-checked="false" tabindex="0">1h</button> | |
| <button class="time-chip active" data-period="24h" role="radio" aria-checked="true" tabindex="0">24h</button> | |
| <button class="time-chip" data-period="7d" role="radio" aria-checked="false" tabindex="0">7d</button> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Main --> | |
| <main> | |
| <!-- KPI Row --> | |
| <section class="kpi-row" aria-label="Key performance indicators"> | |
| <div class="kpi-card kpi-delivered"> | |
| <div class="kpi-label">Delivered</div> | |
| <div class="kpi-value" id="kpi-delivered">97.4%</div> | |
| <div class="kpi-delta up-good" id="delta-delivered"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 15l-6-6-6 6"/></svg> | |
| +0.3% | |
| </div> | |
| </div> | |
| <div class="kpi-card kpi-bounce"> | |
| <div class="kpi-label">Hard Bounce</div> | |
| <div class="kpi-value" id="kpi-bounce">1.2%</div> | |
| <div class="kpi-delta up-bad" id="delta-bounce"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M6 9l6 6 6-6"/></svg> | |
| +0.4% | |
| </div> | |
| </div> | |
| <div class="kpi-card kpi-complaint"> | |
| <div class="kpi-label">Complaint Rate</div> | |
| <div class="kpi-value" id="kpi-complaint">0.08%</div> | |
| <div class="kpi-delta down-good" id="delta-complaint"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 15l-6-6-6 6"/></svg> | |
| -0.02% | |
| </div> | |
| </div> | |
| <div class="kpi-card kpi-latency"> | |
| <div class="kpi-label">Queue Latency</div> | |
| <div class="kpi-value" id="kpi-latency">142ms</div> | |
| <div class="kpi-delta up-bad" id="delta-latency"> | |
| <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M6 9l6 6 6-6"/></svg> | |
| +28ms | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Charts Row --> | |
| <section class="charts-row" aria-label="Charts"> | |
| <div class="chart-card"> | |
| <div class="chart-title">Accepted vs Deferred Messages</div> | |
| <div class="chart-container" id="chart-timeseries"></div> | |
| <div class="chart-legend"> | |
| <div class="chart-legend-item"><div class="chart-legend-dot" style="background:#06B6D4"></div>Accepted</div> | |
| <div class="chart-legend-item"><div class="chart-legend-dot" style="background:#F59E0B"></div>Deferred</div> | |
| <div class="chart-legend-item"><div class="chart-legend-dot" style="background:#EF4444"></div>Threshold</div> | |
| </div> | |
| </div> | |
| <div class="chart-card"> | |
| <div class="chart-title">Inbox Placement by Provider</div> | |
| <div class="chart-container" id="chart-providers"></div> | |
| <div class="provider-stats"> | |
| <div class="provider-stat"><div class="dot" style="background:#EA4335"></div>Gmail 94.2%</div> | |
| <div class="provider-stat"><div class="dot" style="background:#0078D4"></div>Outlook 88.1%</div> | |
| <div class="provider-stat"><div class="dot" style="background:#6001D2"></div>Yahoo 96.4%</div> | |
| <div class="provider-stat"><div class="dot" style="background:#A2AAAD"></div>Apple 98.7%</div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Domain Table --> | |
| <section class="table-section" aria-label="Sending domains"> | |
| <div class="table-header"> | |
| <div class="table-header-left"> | |
| <h3>Sending Domains</h3> | |
| <span class="table-count" id="table-count">10</span> | |
| </div> | |
| <div style="font-family:var(--mono);font-size:11px;color:var(--text-3)"> | |
| <span id="active-count" style="color:var(--green)">7 active</span> · <span id="throttle-count" style="color:var(--amber)">1 throttled</span> · <span id="suspended-count" style="color:var(--red)">2 suspended</span> | |
| </div> | |
| </div> | |
| <div class="table-head" role="row"> | |
| <div>Domain</div> | |
| <div>SPF</div> | |
| <div>DKIM</div> | |
| <div>DMARC</div> | |
| <div>Volume</div> | |
| <div>Bounce%</div> | |
| <div>Owner</div> | |
| <div>Status</div> | |
| </div> | |
| <div class="table-body" id="table-body" role="rowgroup"></div> | |
| </section> | |
| </main> | |
| <!-- Toast --> | |
| <div class="toast" id="toast"> | |
| <div class="toast-accent"></div> | |
| <span id="toast-msg"></span> | |
| </div> | |
| <script> | |
| // ===== DATA ===== | |
| const periodData = { | |
| '1h': { | |
| delivered: 97.8, deliveredDelta: '+0.7', deliveredDir: 'up-good', | |
| hardBounce: 0.9, hardBounceDelta: '-0.3', hardBounceDir: 'down-good', | |
| complaint: 0.06, complaintDelta: '-0.04', complaintDir: 'down-good', | |
| latency: 114, latencyDelta: '-16', latencyDir: 'down-good', | |
| providers: { gmail: 95.1, outlook: 89.3, yahoo: 97.2, apple: 99.1 } | |
| }, | |
| '24h': { | |
| delivered: 97.4, deliveredDelta: '+0.3', deliveredDir: 'up-good', | |
| hardBounce: 1.2, hardBounceDelta: '+0.4', hardBounceDir: 'up-bad', | |
| complaint: 0.08, complaintDelta: '-0.02', complaintDir: 'down-good', | |
| latency: 142, latencyDelta: '+28', latencyDir: 'up-bad', | |
| providers: { gmail: 94.2, outlook: 88.1, yahoo: 96.4, apple: 98.7 } | |
| }, | |
| '7d': { | |
| delivered: 96.1, deliveredDelta: '-1.3', deliveredDir: 'down-bad', | |
| hardBounce: 1.8, hardBounceDelta: '+0.9', hardBounceDir: 'up-bad', | |
| complaint: 0.11, complaintDelta: '+0.03', complaintDir: 'up-bad', | |
| latency: 186, latencyDelta: '+72', latencyDir: 'up-bad', | |
| providers: { gmail: 91.8, outlook: 84.6, yahoo: 93.7, apple: 97.2 } | |
| } | |
| }; | |
| const domains = [ | |
| { domain:'transactional.mailrail.io', spf:true, dkim:true, dmarc:'pass', volume:842310, bounce:0.8, owner:'Jenny Chen', status:'active', ips:'3', avgLatency:'98ms', lastBounce:'5430s ago', reason:'—' }, | |
| { domain:'marketing.acmecorp.com', spf:true, dkim:true, dmarc:'none', volume:1247820, bounce:2.1, owner:'Marcus Obi', status:'throttled', ips:'5', avgLatency:'340ms', lastBounce:'12s ago', reason:'421 2.1.0 Outlook deferred' }, | |
| { domain:'notifications.sendfast.io', spf:true, dkim:false, dmarc:'pass', volume:456980, bounce:0.4, owner:'Aria Blanc', status:'active', ips:'2', avgLatency:'112ms', lastBounce:'2h ago', reason:'—' }, | |
| { domain:'alerts.bankwell.com', spf:true, dkim:true, dmarc:'pass', volume:89450, bounce:0.1, owner:'Dev Patel', status:'active', ips:'1', avgLatency:'67ms', lastBounce:'18h ago', reason:'—' }, | |
| { domain:'newsletter.readmore.co', spf:false, dkim:true, dmarc:'pass', volume:2103460, bounce:3.4, owner:'Suki Tanaka', status:'suspended', ips:'4', avgLatency:'521ms', lastBounce:'0s ago', reason:'550 5.7.1 SPF fail' }, | |
| { domain:'ops.deployhub.io', spf:true, dkim:true, dmarc:'pass', volume:234120, bounce:0.6, owner:'Jenny Chen', status:'active', ips:'2', avgLatency:'89ms', lastBounce:'6h ago', reason:'—' }, | |
| { domain:'billing.payflow.net', spf:true, dkim:true, dmarc:'pass', volume:567890, bounce:1.0, owner:'Rami Nasser', status:'active', ips:'3', avgLatency:'134ms', lastBounce:'45m ago', reason:'—' }, | |
| { domain:'digest.techbrew.io', spf:true, dkim:true, dmarc:'none', volume:789340, bounce:1.8, owner:'Aria Blanc', status:'warning', ips:'2', avgLatency:'198ms', lastBounce:'8m ago', reason:'DMARC none, p=reject expected' }, | |
| { domain:'updates.socialapp.co', spf:true, dkim:false, dmarc:'none', volume:345670, bounce:5.2, owner:'Marcus Obi', status:'suspended', ips:'6', avgLatency:'780ms', lastBounce:'0s ago', reason:'550 DKIM verification failed' }, | |
| { domain:'welcome.newsite.io', spf:true, dkim:true, dmarc:'pass', volume:123450, bounce:0.3, owner:'Dev Patel', status:'active', ips:'1', avgLatency:'72ms', lastBounce:'12h ago', reason:'—' } | |
| ]; | |
| // ===== IDENTICON GENERATOR ===== | |
| function hashCode(str) { | |
| let hash = 0; | |
| for (let i = 0; i < str.length; i++) { | |
| hash = ((hash << 5) - hash) + str.charCodeAt(i); | |
| hash |= 0; | |
| } | |
| return Math.abs(hash); | |
| } | |
| function generateIdenticon(name, size) { | |
| const hash = hashCode(name); | |
| const color = `hsl(${hash % 360}, 60%, 55%)`; | |
| const grid = 5; | |
| const cellSize = size / grid; | |
| const svgParts = []; | |
| for (let row = 0; row < grid; row++) { | |
| for (let col = 0; col < Math.ceil(grid / 2); col++) { | |
| const idx = row * Math.ceil(grid / 2) + col; | |
| if ((hash >> (idx % 30)) & 1) { | |
| svgParts.push(`<rect x="${col * cellSize}" y="${row * cellSize}" width="${cellSize}" height="${cellSize}" fill="${color}"/>`); | |
| if (col < Math.floor(grid / 2)) { | |
| svgParts.push(`<rect x="${(grid - 1 - col) * cellSize}" y="${row * cellSize}" width="${cellSize}" height="${cellSize}" fill="${color}"/>`); | |
| } | |
| } | |
| } | |
| } | |
| return `<svg class="identicon" width="${size}" height="${size}" viewBox="0 0 ${size} ${size}" xmlns="http://www.w3.org/2000/svg"><rect width="${size}" height="${size}" fill="#1E293B" rx="3"/>${svgParts.join('')}</svg>`; | |
| } | |
| // ===== TIME SERIES DATA ===== | |
| function generateTimeSeriesData(period) { | |
| const now = new Date(); | |
| const data = { accepted: [], deferred: [], times: [] }; | |
| let points, intervalMs; | |
| if (period === '1h') { points = 12; intervalMs = 300000; } | |
| else if (period === '24h') { points = 24; intervalMs = 3600000; } | |
| else { points = 42; intervalMs = 14400000; } | |
| const seed = hashCode(period); | |
| for (let i = 0; i < points; i++) { | |
| const t = new Date(now.getTime() - (points - i) * intervalMs); | |
| data.times.push(t); | |
| const baseA = period === '1h' ? 18000 : period === '24h' ? 42000 : 38000; | |
| const baseD = period === '1h' ? 1200 : period === '24h' ? 3500 : 4200; | |
| const aVariation = Math.sin(i * 0.4 + seed) * 3000 + Math.cos(i * 0.7) * 1500; | |
| const dVariation = Math.sin(i * 0.5 + 1) * 800 + Math.cos(i * 0.9 + seed) * 400; | |
| data.accepted.push(Math.round(Math.max(0, baseA + aVariation))); | |
| data.deferred.push(Math.round(Math.max(0, baseD + dVariation))); | |
| } | |
| return data; | |
| } | |
| // ===== FORMAT HELPERS ===== | |
| function formatVolume(n) { | |
| if (n >= 1e6) return (n / 1e6).toFixed(1) + 'M'; | |
| if (n >= 1e3) return (n / 1e3).toFixed(0) + 'K'; | |
| return n.toString(); | |
| } | |
| function bounceClass(pct) { | |
| if (pct <= 1.0) return 'bounce-low'; | |
| if (pct <= 2.5) return 'bounce-mid'; | |
| return 'bounce-high'; | |
| } | |
| function statusLabel(s) { | |
| const map = { active:'Active', throttled:'Throttled', warning:'Warning', suspended:'Suspended' }; | |
| return map[s] || s; | |
| } | |
| // ===== KPI UPDATE ===== | |
| function updateKPIs(period) { | |
| const d = periodData[period]; | |
| document.getElementById('kpi-delivered').textContent = d.delivered + '%'; | |
| document.getElementById('kpi-bounce').textContent = d.hardBounce + '%'; | |
| document.getElementById('kpi-complaint').textContent = d.complaint + '%'; | |
| document.getElementById('kpi-latency').textContent = d.latency + 'ms'; | |
| setDelta('delta-delivered', d.deliveredDelta, d.deliveredDir); | |
| setDelta('delta-bounce', d.hardBounceDelta, d.hardBounceDir); | |
| setDelta('delta-complaint', d.complaintDelta, d.complaintDir); | |
| setDelta('delta-latency', d.latencyDelta, d.latencyDir); | |
| } | |
| function setDelta(id, val, dir) { | |
| const el = document.getElementById(id); | |
| el.className = 'kpi-delta ' + dir; | |
| const isUp = val.startsWith('+') || (!val.startsWith('-') && parseFloat(val) > 0); | |
| const arrow = isUp | |
| ? '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="12" height="12"><path d="M6 9l6 6 6-6"/></svg>' | |
| : '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" width="12" height="12"><path d="M18 15l-6-6-6 6"/></svg>'; | |
| el.innerHTML = arrow + ' ' + val + (id.includes('latency') ? 'ms' : '%'); | |
| } | |
| // ===== CHARTS ===== | |
| let tsChart, provChart; | |
| let currentPeriod = '24h'; | |
| function initCharts() { | |
| // Time series | |
| tsChart = echarts.init(document.getElementById('chart-timeseries'), null, { renderer: 'canvas' }); | |
| provChart = echarts.init(document.getElementById('chart-providers'), null, { renderer: 'canvas' }); | |
| updateCharts(currentPeriod); | |
| window.addEventListener('resize', () => { tsChart.resize(); provChart.resize(); }); | |
| } | |
| function updateCharts(period) { | |
| const tsData = generateTimeSeriesData(period); | |
| const threshold = period === '1h' ? 2000 : period === '24h' ? 5000 : 6000; | |
| const timeFmt = period === '1h' ? '{HH}:{mm}' : period === '24h' ? '{HH}:{mm}' : '{MM}/{dd}'; | |
| tsChart.setOption({ | |
| animation: !window.matchMedia('(prefers-reduced-motion: reduce)').matches, | |
| grid: { top: 20, right: 16, bottom: 28, left: 52 }, | |
| xAxis: { | |
| type: 'category', | |
| data: tsData.times.map(t => t.getTime()), | |
| axisLine: { lineStyle: { color: '#1E293B' } }, | |
| axisTick: { show: false }, | |
| axisLabel: { color: '#64748B', fontFamily: 'JetBrains Mono', fontSize: 10, formatter: (v) => { const d = new Date(v); return period === '7d' ? (d.getMonth()+1)+'/'+d.getDate() : d.getHours().toString().padStart(2,'0')+':'+d.getMinutes().toString().padStart(2,'0'); } }, | |
| splitLine: { show: false } | |
| }, | |
| yAxis: { | |
| type: 'value', | |
| axisLine: { show: false }, | |
| axisTick: { show: false }, | |
| axisLabel: { color: '#64748B', fontFamily: 'JetBrains Mono', fontSize: 10, formatter: v => v >= 1000 ? (v/1000)+'k' : v }, | |
| splitLine: { lineStyle: { color: '#1E293B', type: 'dashed' } } | |
| }, | |
| tooltip: { | |
| trigger: 'axis', | |
| backgroundColor: '#0F172A', | |
| borderColor: '#334155', | |
| textStyle: { color: '#CBD5E1', fontFamily: 'JetBrains Mono', fontSize: 11 }, | |
| formatter: (params) => { | |
| const t = new Date(params[0].axisValue); | |
| const time = t.getHours().toString().padStart(2,'0')+':'+t.getMinutes().toString().padStart(2,'0'); | |
| return params.map(p => `<span style="color:${p.seriesName==='Accepted'?'#06B6D4':'#F59E0B'}">●</span> ${p.seriesName}: <b>${p.value.toLocaleString()}</b>`).join('<br/>') + `<br/><span style="color:#EF4444">---</span> Threshold: <b>${threshold.toLocaleString()}</b>`; | |
| } | |
| }, | |
| series: [ | |
| { | |
| name: 'Accepted', type: 'line', data: tsData.accepted, | |
| lineStyle: { color: '#06B6D4', width: 2 }, | |
| itemStyle: { color: '#06B6D4' }, | |
| areaStyle: { color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'rgba(6,182,212,0.15)' }, { offset: 1, color: 'rgba(6,182,212,0)' }] } }, | |
| symbol: 'none', smooth: 0.3 | |
| }, | |
| { | |
| name: 'Deferred', type: 'line', data: tsData.deferred, | |
| lineStyle: { color: '#F59E0B', width: 2 }, | |
| itemStyle: { color: '#F59E0B' }, | |
| areaStyle: { color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: 'rgba(245,158,11,0.12)' }, { offset: 1, color: 'rgba(245,158,11,0)' }] } }, | |
| symbol: 'none', smooth: 0.3, | |
| markLine: { | |
| silent: true, symbol: 'none', | |
| lineStyle: { color: '#EF4444', type: 'dashed', width: 1.5 }, | |
| data: [{ yAxis: threshold }], | |
| label: { show: true, position: 'insideEndTop', formatter: 'threshold', color: '#EF4444', fontFamily: 'JetBrains Mono', fontSize: 10 } | |
| } | |
| } | |
| ] | |
| }); | |
| // Provider chart | |
| const pd = periodData[period].providers; | |
| const providerNames = ['Gmail', 'Outlook', 'Yahoo', 'Apple Mail']; | |
| const providerColors = ['#EA4335', '#0078D4', '#6001D2', '#A2AAAD']; | |
| const providerValues = [pd.gmail, pd.outlook, pd.yahoo, pd.apple]; | |
| const providerMarks = ['G', 'O', 'Y', 'A']; | |
| provChart.setOption({ | |
| animation: !window.matchMedia('(prefers-reduced-motion: reduce)').matches, | |
| grid: { top: 12, right: 16, bottom: 28, left: 72 }, | |
| xAxis: { | |
| type: 'value', max: 100, | |
| axisLine: { lineStyle: { color: '#1E293B' } }, | |
| axisTick: { show: false }, | |
| axisLabel: { color: '#64748B', fontFamily: 'JetBrains Mono', fontSize: 10, formatter: v => v + '%' }, | |
| splitLine: { lineStyle: { color: '#1E293B', type: 'dashed' } } | |
| }, | |
| yAxis: { | |
| type: 'category', data: providerNames, | |
| axisLine: { show: false }, | |
| axisTick: { show: false }, | |
| axisLabel: { | |
| color: '#94A3B8', fontFamily: 'JetBrains Mono', fontSize: 11, fontWeight: 500, | |
| formatter: (v, i) => '{mark|' + providerMarks[i] + '} {name|' + v + '}', | |
| rich: { | |
| mark: { color: '#fff', fontSize: 9, fontWeight: 700, backgroundColor: providerColors, padding: [2, 4], borderRadius: 2, fontFamily: 'JetBrains Mono' }, | |
| name: { color: '#94A3B8', fontSize: 11, fontFamily: 'JetBrains Mono' } | |
| } | |
| } | |
| }, | |
| tooltip: { | |
| trigger: 'axis', | |
| backgroundColor: '#0F172A', | |
| borderColor: '#334155', | |
| textStyle: { color: '#CBD5E1', fontFamily: 'JetBrains Mono', fontSize: 11 }, | |
| formatter: (params) => `${params[0].name}: <b>${params[0].value}%</b> inbox placement` | |
| }, | |
| series: [{ | |
| type: 'bar', data: providerValues.map((v, i) => ({ | |
| value: v, | |
| itemStyle: { | |
| color: { type: 'linear', x: 0, y: 0, x2: 1, y2: 0, colorStops: [{ offset: 0, color: providerColors[i] }, { offset: 1, color: providerColors[i] + '88' }] }, | |
| borderRadius: [0, 3, 3, 0] | |
| } | |
| })), | |
| barWidth: 18, | |
| label: { show: true, position: 'right', color: '#CBD5E1', fontFamily: 'JetBrains Mono', fontSize: 11, fontWeight: 600, formatter: '{c}%' } | |
| }] | |
| }); | |
| } | |
| // ===== TABLE ===== | |
| let selectedRow = null; | |
| function renderTable(filter = '') { | |
| const tbody = document.getElementById('table-body'); | |
| tbody.innerHTML = ''; | |
| const filtered = domains.filter(d => d.domain.toLowerCase().includes(filter.toLowerCase())); | |
| document.getElementById('table-count').textContent = filtered.length; | |
| filtered.forEach((d, idx) => { | |
| const row = document.createElement('div'); | |
| row.className = 'table-row' + (selectedRow === d.domain ? ' selected' : ''); | |
| row.setAttribute('role', 'row'); | |
| row.setAttribute('tabindex', '0'); | |
| row.setAttribute('aria-label', d.domain); | |
| const spfIcon = d.spf ? '<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg>' : '<svg class="cross-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 6L6 18M6 6l12 12"/></svg>'; | |
| const dkimIcon = d.dkim ? '<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg>' : '<svg class="cross-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 6L6 18M6 6l12 12"/></svg>'; | |
| let dmarcIcon; | |
| if (d.dmarc === 'pass') dmarcIcon = '<svg class="check-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M20 6L9 17l-5-5"/></svg>'; | |
| else if (d.dmarc === 'none') dmarcIcon = '<svg class="partial-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M12 9v4M12 17h.01"/></svg>'; | |
| else dmarcIcon = '<svg class="cross-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M18 6L6 18M6 6l12 12"/></svg>'; | |
| const identicon = generateIdenticon(d.owner, 22); | |
| row.innerHTML = ` | |
| <div class="domain-name"><svg class="lock" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>${d.domain}</div> | |
| <div>${spfIcon}</div> | |
| <div>${dkimIcon}</div> | |
| <div>${dmarcIcon}</div> | |
| <div class="mono" style="color:var(--text-1)">${formatVolume(d.volume)}</div> | |
| <div class="mono ${bounceClass(d.bounce)}">${d.bounce}%</div> | |
| <div style="gap:6px">${identicon}<span style="font-size:11px;color:var(--text-2)">${d.owner}</span></F2></div> | |
| <div><span class="status-dot ${d.status}"></span></div> | |
| `; | |
| // Drill-down | |
| const drill = document.createElement('div'); | |
| drill.className = 'drill-down' + (selectedRow === d.domain ? ' open' : ''); | |
| drill.id = 'drill-' + d.domain.replace(/\./g, '-'); | |
| drill.innerHTML = ` | |
| <div class="drill-grid"> | |
| <div class="drill-item"><label>Sender IPs</label><span>${d.ips} allocated</span></div> | |
| <div class="drill-item"><label>Avg Latency</label><span>${d.avgLatency}</span></div> | |
| <div class="drill-item"><label>Last Bounce</label><span>${d.lastBounce}</span></div> | |
| <div class="drill-item"><label>Reason</label><span style="color:${d.reason === '—' ? 'var(--text-3)' : 'var(--red)'}">${d.reason}</span></div> | |
| </div> | |
| <div class="drill-actions"> | |
| <button class="drill-btn" onclick="showToast('Copied ${d.domain} config to clipboard')">Copy Config</button> | |
| <button class="drill-btn" onclick="showToast('Viewing bounce log for ${d.domain}')">Bounce Log</button> | |
| ${d.status !== 'active' ? `<button class="drill-btn danger" onclick="showToast('${d.domain} throttle cleared')">Clear Throttle</button>` : `<button class="drill-btn danger" onclick="showToast('${d.domain} throttle engaged')">Engage Throttle</button>`} | |
| </div> | |
| `; | |
| row.addEventListener('click', () => { | |
| if (selectedRow === d.domain) { | |
| selectedRow = null; | |
| } else { | |
| selectedRow = d.domain; | |
| } | |
| renderTable(document.getElementById('search-input').value); | |
| }); | |
| row.addEventListener('keydown', (e) => { | |
| if (e.key === 'Enter' || e.key === ' ') { | |
| e.preventDefault(); | |
| row.click(); | |
| } | |
| }); | |
| tbody.appendChild(row); | |
| tbody.appendChild(drill); | |
| }); | |
| } | |
| // ===== TOAST ===== | |
| function showToast(msg) { | |
| const toast = document.getElementById('toast'); | |
| document.getElementById('toast-msg').textContent = msg; | |
| toast.classList.add('show'); | |
| clearTimeout(toast._timer); | |
| toast._timer = setTimeout(() => toast.classList.remove('show'), 2500); | |
| } | |
| // ===== SEARCH ===== | |
| document.getElementById('search-input').addEventListener('input', (e) => { | |
| renderTable(e.target.value); | |
| }); | |
| // Slash shortcut | |
| document.addEventListener('keydown', (e) => { | |
| if (e.key === '/' && document.activeElement.tagName !== 'INPUT') { | |
| e.preventDefault(); | |
| document.getElementById('search-input').focus(); | |
| } | |
| if (e.key === 'Escape') { | |
| document.getElementById('search-input').blur(); | |
| document.getElementById('search-input').value = ''; | |
| renderTable(''); | |
| } | |
| }); | |
| // ===== TIME CHIPS ===== | |
| document.querySelectorAll('.time-chip').forEach(chip => { | |
| chip.addEventListener('click', () => { | |
| document.querySelectorAll('.time-chip').forEach(c => { | |
| c.classList.remove('active'); | |
| c.setAttribute('aria-checked', 'false'); | |
| }); | |
| chip.classList.add('active'); | |
| chip.setAttribute('aria-checked', 'true'); | |
| currentPeriod = chip.dataset.period; | |
| updateKPIs(currentPeriod); | |
| updateCharts(currentPeriod); | |
| showToast('Switched to ' + currentPeriod + ' window'); | |
| }); | |
| }); | |
| // ===== INIT ===== | |
| document.addEventListener('DOMContentLoaded', () => { | |
| updateKPIs(currentPeriod); | |
| initCharts(); | |
| renderTable(); | |
| }); | |
| // Fallback if DOMContentLoaded already fired | |
| if (document.readyState !== 'loading') { | |
| updateKPIs(currentPeriod); | |
| initCharts(); | |
| renderTable(); | |
| } | |
| </script> | |
| </body> | |
| </html> |