479 líneas
33 KiB
HTML
479 líneas
33 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="en">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
|
|
<title>BizGaze Connect</title>
|
||
|
|
<style>
|
||
|
|
:root{ --brand:#FFC708; --brand-d:#E0AC00; --blue:#1F3B73; --blue-d:#16294f; --blue-soft:#EAF0FB; --ink:#1f2430; --muted:#6b7280; --bg:#f6f8fb; --card:#fff; --line:#e6e9ef; --green:#16a34a; --red:#b91c1c; }
|
||
|
|
*{box-sizing:border-box;}
|
||
|
|
html,body{height:100%;}
|
||
|
|
body{font-family:'Segoe UI',system-ui,sans-serif;background:var(--bg);color:var(--ink);margin:0;display:flex;flex-direction:column;height:100vh;overflow:hidden;}
|
||
|
|
|
||
|
|
/* ---- Top bar ---- */
|
||
|
|
header{background:var(--blue);padding:.7rem 1.4rem;display:flex;justify-content:space-between;align-items:center;flex:0 0 auto;}
|
||
|
|
.brandrow{display:flex;align-items:center;gap:.6rem;}
|
||
|
|
.logo{width:30px;height:30px;border-radius:8px;background:var(--brand);display:grid;place-items:center;font-weight:800;color:var(--blue);}
|
||
|
|
.brand{font-weight:700;color:#fff;font-size:1.05rem;} .brand span.y{color:var(--brand);font-weight:700;}
|
||
|
|
|
||
|
|
/* ---- Profile dropdown (from console.html) ---- */
|
||
|
|
.profile{position:relative}
|
||
|
|
.profile .pbtn{display:flex;align-items:center;gap:.5rem;background:rgba(255,255,255,.14);color:#fff;border:1px solid #46598c;border-radius:10px;padding:.4rem .85rem .4rem .5rem;font-weight:600;font-size:.88rem;cursor:pointer}
|
||
|
|
.profile .pbtn:hover{background:rgba(255,255,255,.24)}
|
||
|
|
.profile .pbtn .pav{width:28px;height:28px;border-radius:50%;background:var(--brand);color:var(--blue);display:grid;place-items:center;font-weight:800;font-size:.78rem}
|
||
|
|
.profile .pmenu{position:absolute;right:0;top:calc(100% + 6px);background:#fff;border:1px solid #e6e9ef;border-radius:10px;box-shadow:0 10px 28px rgba(0,0,0,.18);min-width:210px;overflow:hidden;z-index:5000;display:none}
|
||
|
|
.profile .pmenu.open{display:block}
|
||
|
|
.profile .pmenu .phead{padding:.7rem .9rem;border-bottom:1px solid #eef1f6}
|
||
|
|
.profile .pmenu .phead .n{font-weight:700;font-size:.9rem}
|
||
|
|
.profile .pmenu .phead .e{color:var(--muted);font-size:.78rem}
|
||
|
|
.profile .pmenu a{display:block;padding:.6rem .9rem;color:#1f2430;text-decoration:none;font-size:.9rem;cursor:pointer}
|
||
|
|
.profile .pmenu a:hover{background:#f1f5f9}
|
||
|
|
.profile .pmenu a.danger{color:#b91c1c;border-top:1px solid #eef1f6}
|
||
|
|
|
||
|
|
/* ---- Shell ---- */
|
||
|
|
.shell{flex:1 1 auto;display:flex;min-height:0;}
|
||
|
|
|
||
|
|
/* ---- Icon rail ---- */
|
||
|
|
.rail{width:74px;flex:0 0 74px;background:var(--card);border-right:1px solid var(--line);display:flex;flex-direction:column;align-items:center;padding:.8rem 0;gap:.4rem;}
|
||
|
|
.railbtn{position:relative;width:50px;height:50px;border:none;background:transparent;border-radius:14px;color:var(--muted);cursor:pointer;display:grid;place-items:center;transition:background .12s,color .12s;}
|
||
|
|
.railbtn:hover{background:var(--blue-soft);color:var(--blue);}
|
||
|
|
.railbtn.active{background:var(--blue);color:#fff;}
|
||
|
|
.railbtn .rdot{position:absolute;top:8px;right:8px;min-width:16px;height:16px;border-radius:99px;background:var(--brand);color:var(--blue);font-size:.62rem;font-weight:800;display:grid;place-items:center;padding:0 .2rem;border:2px solid var(--card);}
|
||
|
|
.railbtn.active .rdot{border-color:var(--blue);}
|
||
|
|
.railbtn .livedot{position:absolute;top:8px;right:8px;width:11px;height:11px;border-radius:50%;background:var(--green);border:2px solid var(--card);display:none;}
|
||
|
|
.railbtn.active .livedot{border-color:var(--blue);}
|
||
|
|
.railbtn.live .livedot{display:block;animation:livePulse 1.4s infinite;}
|
||
|
|
@keyframes livePulse{0%,100%{opacity:1}50%{opacity:.3}}
|
||
|
|
.railbtn .rlabel{font-size:.6rem;margin-top:0;}
|
||
|
|
/* tooltip */
|
||
|
|
.railbtn::after{content:attr(data-tip);position:absolute;left:calc(100% + 12px);top:50%;transform:translateY(-50%);background:var(--blue-d);color:#fff;padding:.35rem .6rem;border-radius:8px;font-size:.78rem;font-weight:600;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .14s;z-index:200;box-shadow:0 6px 16px rgba(0,0,0,.25);}
|
||
|
|
.railbtn::before{content:"";position:absolute;left:calc(100% + 6px);top:50%;transform:translateY(-50%);border:6px solid transparent;border-right-color:var(--blue-d);opacity:0;pointer-events:none;transition:opacity .14s;z-index:200;}
|
||
|
|
.railbtn:hover::after,.railbtn:hover::before{opacity:1;}
|
||
|
|
.rail-spacer{flex:1 1 auto;}
|
||
|
|
.caption{font-size:.58rem;color:var(--muted);text-align:center;line-height:1.2;}
|
||
|
|
|
||
|
|
/* ---- Chat list column ---- */
|
||
|
|
.chatcol{width:312px;flex:0 0 312px;background:var(--card);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0;}
|
||
|
|
.chatcol.hidden{display:none;}
|
||
|
|
.side-head{padding:1rem 1rem .75rem;border-bottom:1px solid var(--line);}
|
||
|
|
.side-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:.7rem;}
|
||
|
|
.side-title h2{font-size:.95rem;margin:0;color:var(--blue);}
|
||
|
|
.newchat{width:30px;height:30px;border-radius:9px;border:none;background:var(--blue-soft);color:var(--blue);font-size:1.2rem;line-height:1;cursor:pointer;font-weight:700;display:grid;place-items:center;padding:0;}
|
||
|
|
.newchat:hover{background:#dbe6fb;}
|
||
|
|
.search{position:relative;}
|
||
|
|
.search svg{position:absolute;left:.65rem;top:50%;transform:translateY(-50%);color:var(--muted);}
|
||
|
|
.search input{width:100%;padding:.55rem .7rem .55rem 2.1rem;border-radius:10px;border:2px solid var(--line);background:#fbfcfe;color:var(--ink);font-size:.9rem;}
|
||
|
|
.search input:focus{outline:none;border-color:var(--brand);}
|
||
|
|
|
||
|
|
.chatlist{overflow-y:auto;flex:1 1 auto;padding:.4rem;}
|
||
|
|
.chat-row{display:flex;gap:.7rem;align-items:center;padding:.6rem .65rem;border-radius:12px;cursor:pointer;position:relative;}
|
||
|
|
.chat-row:hover{background:#f3f6fb;}
|
||
|
|
.chat-row.active{background:var(--blue-soft);}
|
||
|
|
.chat-row.active::before{content:"";position:absolute;left:0;top:.7rem;bottom:.7rem;width:3px;border-radius:3px;background:var(--blue);}
|
||
|
|
.avatar{width:42px;height:42px;flex:0 0 42px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:700;font-size:.92rem;position:relative;}
|
||
|
|
.avatar .dot{position:absolute;right:-1px;bottom:-1px;width:11px;height:11px;border-radius:50%;border:2px solid #fff;background:#cbd2dd;}
|
||
|
|
.avatar .dot.on{background:var(--green);}
|
||
|
|
.chat-main{flex:1 1 auto;min-width:0;}
|
||
|
|
.chat-top{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;}
|
||
|
|
.chat-name{font-weight:600;font-size:.92rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
||
|
|
.chat-time{color:var(--muted);font-size:.72rem;flex:0 0 auto;}
|
||
|
|
.chat-bottom{display:flex;justify-content:space-between;align-items:center;gap:.5rem;margin-top:.15rem;}
|
||
|
|
.chat-prev{color:var(--muted);font-size:.82rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1 1 auto;}
|
||
|
|
.chat-row.unread .chat-prev{color:var(--ink);font-weight:500;}
|
||
|
|
.chat-row.unread .chat-name{font-weight:700;}
|
||
|
|
.badge{flex:0 0 auto;background:var(--blue);color:#fff;font-size:.7rem;font-weight:700;min-width:19px;height:19px;border-radius:99px;padding:0 .35rem;display:grid;place-items:center;}
|
||
|
|
.no-results{padding:2rem 1rem;text-align:center;color:var(--muted);font-size:.85rem;}
|
||
|
|
.demo-note{padding:.5rem 1rem;border-top:1px solid var(--line);color:var(--muted);font-size:.72rem;text-align:center;background:#fbfcfe;}
|
||
|
|
|
||
|
|
/* ---- Main content ---- */
|
||
|
|
.content{flex:1 1 auto;position:relative;min-width:0;min-height:0;background:var(--bg);}
|
||
|
|
.panel{position:absolute;inset:0;display:none;}
|
||
|
|
.panel.active{display:flex;}
|
||
|
|
.panel.center{align-items:center;justify-content:center;padding:2rem;overflow-y:auto;}
|
||
|
|
.panel iframe{width:100%;height:100%;border:0;display:block;background:var(--bg);}
|
||
|
|
|
||
|
|
/* welcome + feature cards */
|
||
|
|
.welcome{text-align:center;max-width:560px;}
|
||
|
|
.welcome .wave{font-size:3rem;line-height:1;margin-bottom:.4rem;}
|
||
|
|
.welcome h1{font-size:1.8rem;color:var(--blue);margin:.2rem 0 .5rem;}
|
||
|
|
.welcome p{color:var(--muted);font-size:1rem;line-height:1.6;margin:0 auto 1.8rem;max-width:440px;}
|
||
|
|
.wcards{display:flex;gap:1rem;flex-wrap:wrap;justify-content:center;}
|
||
|
|
.wcard{flex:1;min-width:150px;max-width:180px;background:var(--card);border:1px solid var(--line);border-radius:14px;padding:1.2rem 1rem;cursor:pointer;transition:transform .12s,box-shadow .12s,border-color .12s;text-align:center;}
|
||
|
|
.wcard:hover{transform:translateY(-3px);box-shadow:0 12px 28px rgba(20,30,60,.1);border-color:var(--brand);}
|
||
|
|
.wcard .wi{width:46px;height:46px;border-radius:12px;display:grid;place-items:center;margin:0 auto .6rem;background:var(--blue-soft);color:var(--blue);}
|
||
|
|
.wcard h3{margin:0 0 .2rem;font-size:.95rem;color:var(--blue);}
|
||
|
|
.wcard p{margin:0;font-size:.78rem;color:var(--muted);line-height:1.4;}
|
||
|
|
|
||
|
|
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:2.2rem;box-shadow:0 6px 18px rgba(20,30,60,.05);text-align:center;max-width:520px;}
|
||
|
|
.feat-icon{width:72px;height:72px;border-radius:20px;display:grid;place-items:center;margin:0 auto 1.2rem;}
|
||
|
|
.feat-icon.yellow{background:#fff6d8;color:var(--brand-d);}
|
||
|
|
.card h1{font-size:1.45rem;margin:0 0 .5rem;color:var(--blue);}
|
||
|
|
.card p{color:var(--muted);font-size:.95rem;line-height:1.55;margin:0 auto 1.6rem;max-width:400px;}
|
||
|
|
.pill-soon{display:inline-block;background:#fff6d8;color:var(--brand-d);font-size:.74rem;font-weight:700;padding:.25rem .7rem;border-radius:99px;letter-spacing:.03em;margin-bottom:1.2rem;}
|
||
|
|
.btn{display:inline-flex;align-items:center;gap:.5rem;text-decoration:none;padding:.8rem 1.6rem;background:var(--brand);color:var(--ink);border:none;border-radius:11px;font-weight:700;font-size:.95rem;cursor:pointer;}
|
||
|
|
.btn:hover{background:var(--brand-d);}
|
||
|
|
.hint{margin-top:1.4rem;font-size:.8rem;color:var(--muted);}
|
||
|
|
|
||
|
|
/* conversation placeholder (selected chat, no backend yet) */
|
||
|
|
.convo{flex-direction:column;display:flex;width:100%;height:100%;}
|
||
|
|
.convo-head{display:flex;align-items:center;gap:.7rem;padding:.9rem 1.2rem;border-bottom:1px solid var(--line);background:var(--card);}
|
||
|
|
.convo-back{border:none;background:var(--blue-soft);color:var(--blue);width:34px;height:34px;border-radius:9px;font-size:1.1rem;cursor:pointer;display:grid;place-items:center;flex:0 0 auto;}
|
||
|
|
.convo-back:hover{background:#dbe6fb;}
|
||
|
|
.convo-head .nm{font-weight:700;color:var(--ink);}
|
||
|
|
.convo-head .st{font-size:.78rem;color:var(--muted);}
|
||
|
|
.convo-body{flex:1;display:grid;place-items:center;text-align:center;color:var(--muted);padding:2rem;}
|
||
|
|
.convo-body .big{font-size:2.4rem;margin-bottom:.4rem;}
|
||
|
|
|
||
|
|
/* ---- Login (shown on /home when logged out) ---- */
|
||
|
|
.authwrap{flex:1 1 auto;display:none;align-items:center;justify-content:center;padding:1.5rem;min-height:0;}
|
||
|
|
.authcard{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:2rem;max-width:400px;width:100%;box-shadow:0 10px 30px rgba(20,30,60,.08);}
|
||
|
|
.authcard h1{font-size:1.3rem;color:var(--blue);margin:0 0 .3rem;text-align:center;}
|
||
|
|
.authcard .sub{color:var(--muted);font-size:.9rem;text-align:center;margin-bottom:1.2rem;}
|
||
|
|
.authtabs{display:flex;gap:.5rem;margin-bottom:1.1rem;}
|
||
|
|
.authtabs button{flex:1;background:#eef1f6;color:var(--muted);font-weight:600;border:none;border-radius:9px;padding:.5rem;cursor:pointer;font-size:.9rem;}
|
||
|
|
.authtabs button.active{background:var(--blue);color:#fff;}
|
||
|
|
.authcard .lbl{display:block;font-size:.74rem;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:.7rem 0 .15rem;}
|
||
|
|
.authcard input{width:100%;padding:.6rem .7rem;border-radius:10px;border:2px solid var(--line);background:#fbfcfe;color:var(--ink);font-size:.92rem;}
|
||
|
|
.authcard input:focus{outline:none;border-color:var(--brand);}
|
||
|
|
.authcard .gobtn{width:100%;margin-top:1rem;padding:.7rem;background:var(--brand);color:var(--ink);border:none;border-radius:10px;font-weight:700;cursor:pointer;font-size:.95rem;}
|
||
|
|
.authcard .gobtn:hover{background:var(--brand-d);}
|
||
|
|
.authcard .pwwrap{position:relative;} .authcard .pwwrap input{padding-right:2.6rem;}
|
||
|
|
.authcard .eye{position:absolute;right:.35rem;top:50%;transform:translateY(-50%);background:none;border:none;padding:.3rem;width:auto;color:var(--muted);display:inline-flex;align-items:center;cursor:pointer;}
|
||
|
|
.authcard .eye:hover{color:var(--blue);}
|
||
|
|
.formerr{color:#b91c1c;font-weight:600;font-size:.88rem;margin:.7rem 0 0;min-height:1em;}
|
||
|
|
.formerr.show{display:flex;align-items:center;gap:.5rem;background:#fee2e2;border:1px solid #fca5a5;border-radius:9px;padding:.6rem .75rem;animation:errShake .35s;}
|
||
|
|
.formerr.show::before{content:"⚠";font-size:1rem;}
|
||
|
|
@keyframes errShake{0%,100%{transform:translateX(0)}20%,60%{transform:translateX(-5px)}40%,80%{transform:translateX(5px)}}
|
||
|
|
.hidden{display:none;}
|
||
|
|
|
||
|
|
/* ---- Loading / toast ---- */
|
||
|
|
.loading{position:fixed;inset:0;display:grid;place-items:center;background:var(--bg);z-index:9000;color:var(--muted);font-size:.9rem;}
|
||
|
|
.toast{position:fixed;left:50%;bottom:1.6rem;transform:translateX(-50%) translateY(1rem);background:var(--blue);color:#fff;padding:.7rem 1.2rem;border-radius:10px;font-size:.88rem;box-shadow:0 10px 28px rgba(0,0,0,.22);opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;z-index:9500;}
|
||
|
|
.toast.show{opacity:1;transform:translateX(-50%) translateY(0);}
|
||
|
|
|
||
|
|
@media (max-width:760px){
|
||
|
|
.chatcol{width:260px;flex:0 0 260px;}
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="loading" id="loading">Loading…</div>
|
||
|
|
|
||
|
|
<header>
|
||
|
|
<div class="brandrow">
|
||
|
|
<img src="/logo.png" alt="" style="height:46px;width:auto;max-width:190px;border-radius:8px;object-fit:contain;background:#fff;padding:5px 12px;image-rendering:-webkit-optimize-contrast" onerror="this.replaceWith(Object.assign(document.createElement('div'),{className:'logo',textContent:'B'}))">
|
||
|
|
<div class="brand">BizGaze <span class="y">Connect</span></div>
|
||
|
|
</div>
|
||
|
|
<div id="hdrRight"></div>
|
||
|
|
</header>
|
||
|
|
|
||
|
|
<div class="shell">
|
||
|
|
<!-- ---------- Icon rail ---------- -->
|
||
|
|
<nav class="rail" id="rail">
|
||
|
|
<button class="railbtn active" data-tab="chat" data-tip="Chat" aria-label="Chat">
|
||
|
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
|
||
|
|
<span class="rdot" id="railUnread" style="display:none">0</span>
|
||
|
|
</button>
|
||
|
|
<button class="railbtn" data-tab="share" data-tip="Share Screen" aria-label="Share Screen">
|
||
|
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>
|
||
|
|
<span class="livedot"></span>
|
||
|
|
</button>
|
||
|
|
<button class="railbtn" data-tab="connect" data-tip="Connect Screen" aria-label="Connect Screen">
|
||
|
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.55a11 11 0 0 1 14.08 0"/><path d="M1.42 9a16 16 0 0 1 21.16 0"/><path d="M8.53 16.11a6 6 0 0 1 6.95 0"/><line x1="12" y1="20" x2="12.01" y2="20"/></svg>
|
||
|
|
<span class="livedot"></span>
|
||
|
|
</button>
|
||
|
|
<button class="railbtn" data-tab="meeting" data-tip="Meeting" aria-label="Meeting">
|
||
|
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>
|
||
|
|
</button>
|
||
|
|
<div class="rail-spacer"></div>
|
||
|
|
</nav>
|
||
|
|
|
||
|
|
<!-- ---------- Chat list (Chat tab only) ---------- -->
|
||
|
|
<aside class="chatcol" id="chatcol">
|
||
|
|
<div class="side-head">
|
||
|
|
<div class="side-title">
|
||
|
|
<h2>Chats</h2>
|
||
|
|
<button class="newchat" id="newChat" title="New chat" aria-label="New chat">+</button>
|
||
|
|
</div>
|
||
|
|
<div class="search">
|
||
|
|
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
||
|
|
<input id="chatSearch" placeholder="Search chats" autocomplete="off">
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="chatlist" id="chatlist"></div>
|
||
|
|
<div class="demo-note">💬 Chat is coming soon — showing sample conversations</div>
|
||
|
|
</aside>
|
||
|
|
|
||
|
|
<!-- ---------- Main content ---------- -->
|
||
|
|
<main class="content">
|
||
|
|
<!-- Chat panel: welcome (no selection) OR conversation placeholder -->
|
||
|
|
<div class="panel center active" data-panel="chat" id="chatPanel"></div>
|
||
|
|
|
||
|
|
<!-- Share -->
|
||
|
|
<div class="panel" data-panel="share" id="sharePanel"></div>
|
||
|
|
|
||
|
|
<!-- Connect -->
|
||
|
|
<div class="panel" data-panel="connect" id="connectPanel"></div>
|
||
|
|
|
||
|
|
<!-- Meeting -->
|
||
|
|
<div class="panel center" data-panel="meeting">
|
||
|
|
<div class="card">
|
||
|
|
<div class="feat-icon yellow">
|
||
|
|
<svg viewBox="0 0 24 24" width="34" height="34" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg>
|
||
|
|
</div>
|
||
|
|
<span class="pill-soon">COMING SOON</span>
|
||
|
|
<h1>Meetings are on the way</h1>
|
||
|
|
<p>Soon you'll be able to host multi-party video meetings with your BizGaze team and customers — right here, no install needed.</p>
|
||
|
|
<button class="btn" id="notifyBtn">🔔 Notify me when it's ready</button>
|
||
|
|
<div class="hint">In the meantime, use <b>Share Screen</b> or <b>Connect Screen</b> from the left.</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</main>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="authwrap" id="authwrap"></div>
|
||
|
|
|
||
|
|
<div class="toast" id="toast"></div>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
// ---------- Helpers ----------
|
||
|
|
function pEsc(s){return String(s==null?'':s).replace(/[&<>"]/g,c=>({'&':'&','<':'<','>':'>','"':'"'}[c]));}
|
||
|
|
function initials(name){const p=String(name||'?').trim().split(/\s+/);return ((p[0]||'?')[0]+(p[1]?p[1][0]:'')).toUpperCase();}
|
||
|
|
function firstName(name){return String(name||'').trim().split(/\s+/)[0]||'there';}
|
||
|
|
const AV_COLORS=['#1F3B73','#2563eb','#0e7490','#7c3aed','#be185d','#b45309','#15803d','#9d174d'];
|
||
|
|
function avColor(name){let h=0;for(const c of String(name))h=(h*31+c.charCodeAt(0))>>>0;return AV_COLORS[h%AV_COLORS.length];}
|
||
|
|
|
||
|
|
let toastTimer=null;
|
||
|
|
function toast(msg){const t=document.getElementById('toast');t.textContent=msg;t.classList.add('show');clearTimeout(toastTimer);toastTimer=setTimeout(()=>t.classList.remove('show'),2600);}
|
||
|
|
|
||
|
|
// ---------- Profile dropdown (mirrors profileHTML()/wireProfile() from console.html) ----------
|
||
|
|
function profileHTML(u){
|
||
|
|
const display=u.name||u.email;
|
||
|
|
return '<div class="profile"><button class="pbtn" id="pbtn">'
|
||
|
|
+ '<span class="pav">'+pEsc(initials(display))+'</span>'
|
||
|
|
+ pEsc(display)+' <span style="font-size:.65rem">▾</span></button>'
|
||
|
|
+ '<div class="pmenu" id="pmenu">'
|
||
|
|
+ '<div class="phead"><div class="n">'+pEsc(display)+'</div><div class="e">'+pEsc(u.email)+(u.role?' · '+pEsc(u.role):'')+'</div></div>'
|
||
|
|
+ '<a href="/dashboard">Dashboard</a>'
|
||
|
|
+ '<a class="danger" id="plogout">Logout</a>'
|
||
|
|
+ '</div></div>';
|
||
|
|
}
|
||
|
|
function wireProfile(){
|
||
|
|
const btn=document.getElementById('pbtn'),menu=document.getElementById('pmenu');
|
||
|
|
if(!btn)return;
|
||
|
|
btn.onclick=(e)=>{e.stopPropagation();menu.classList.toggle('open');};
|
||
|
|
document.addEventListener('click',()=>menu.classList.remove('open'));
|
||
|
|
const lo=document.getElementById('plogout');
|
||
|
|
if(lo)lo.onclick=async()=>{try{await fetch('/api/logout',{method:'POST'});}catch(_){}location.href='/';};
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------- Mock chat data (placeholder — no chat backend yet, see CLAUDE.md) ----------
|
||
|
|
const CHATS=[
|
||
|
|
{name:'Anwi Systems', msg:"Perfect, the screen share worked great. Thanks!", time:'9:42 AM', unread:0, online:true},
|
||
|
|
{name:'Priya Sharma', msg:"Can you connect to my screen at 3pm?", time:'9:15 AM', unread:2, online:true},
|
||
|
|
{name:'GAPL Group', msg:"You: I've shared the 6-digit code with you", time:'Yesterday', unread:0, online:false},
|
||
|
|
{name:'Battery Doctors', msg:"The invoice module is throwing an error again", time:'Yesterday', unread:5, online:true},
|
||
|
|
{name:'Ramesh Marketing', msg:"You: Let me know once you're at your desk", time:'Mon', unread:0, online:false},
|
||
|
|
{name:'STC Support', msg:"Typing…", time:'Mon', unread:1, online:true},
|
||
|
|
{name:'Samruddhi Traders',msg:"Thanks for the help earlier 👍", time:'Sun', unread:0, online:false},
|
||
|
|
{name:'DMS 3.0 Team', msg:"You: Closing the ticket, all resolved", time:'Fri', unread:0, online:false},
|
||
|
|
];
|
||
|
|
let selectedChat=null; // index into CHATS, or null = welcome
|
||
|
|
|
||
|
|
const listEl=document.getElementById('chatlist');
|
||
|
|
function chatRowHTML(c,i){
|
||
|
|
const cls=['chat-row'];
|
||
|
|
if(selectedChat===i)cls.push('active');
|
||
|
|
if(c.unread>0)cls.push('unread');
|
||
|
|
return '<div class="'+cls.join(' ')+'" data-i="'+i+'">'
|
||
|
|
+ '<div class="avatar" style="background:'+avColor(c.name)+'">'+pEsc(initials(c.name))
|
||
|
|
+ '<span class="dot'+(c.online?' on':'')+'"></span></div>'
|
||
|
|
+ '<div class="chat-main">'
|
||
|
|
+ '<div class="chat-top"><span class="chat-name">'+pEsc(c.name)+'</span><span class="chat-time">'+pEsc(c.time)+'</span></div>'
|
||
|
|
+ '<div class="chat-bottom"><span class="chat-prev">'+pEsc(c.msg)+'</span>'
|
||
|
|
+ (c.unread>0?'<span class="badge">'+c.unread+'</span>':'')+'</div>'
|
||
|
|
+ '</div></div>';
|
||
|
|
}
|
||
|
|
function renderChats(filter){
|
||
|
|
const q=(filter||'').trim().toLowerCase();
|
||
|
|
const rows=CHATS.map((c,i)=>({c,i})).filter(({c})=>!q||c.name.toLowerCase().includes(q)||c.msg.toLowerCase().includes(q));
|
||
|
|
listEl.innerHTML = rows.length
|
||
|
|
? rows.map(({c,i})=>chatRowHTML(c,i)).join('')
|
||
|
|
: '<div class="no-results">No chats match “'+pEsc(filter)+'”.</div>';
|
||
|
|
listEl.querySelectorAll('.chat-row').forEach(row=>{
|
||
|
|
row.onclick=()=>{
|
||
|
|
selectedChat=+row.dataset.i;
|
||
|
|
CHATS[selectedChat].unread=0;
|
||
|
|
renderChats(document.getElementById('chatSearch').value);
|
||
|
|
renderChatPanel();
|
||
|
|
updateRailUnread();
|
||
|
|
};
|
||
|
|
});
|
||
|
|
}
|
||
|
|
function updateRailUnread(){
|
||
|
|
const total=CHATS.reduce((a,c)=>a+(c.unread||0),0);
|
||
|
|
const d=document.getElementById('railUnread');
|
||
|
|
if(total>0){ d.textContent=total>99?'99+':total; d.style.display='grid'; }
|
||
|
|
else d.style.display='none';
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------- Chat main panel: welcome OR conversation placeholder ----------
|
||
|
|
let ME={};
|
||
|
|
function welcomeHTML(){
|
||
|
|
return '<div class="welcome">'
|
||
|
|
+ '<div class="wave">👋</div>'
|
||
|
|
+ '<h1>Hi, '+pEsc(firstName(ME.name||ME.email))+'! Welcome to BizGaze Connect</h1>'
|
||
|
|
+ '<p>Pick a conversation on the left to start chatting, or jump straight into a session from the sidebar.</p>'
|
||
|
|
+ '<div class="wcards">'
|
||
|
|
+ '<div class="wcard" data-go="share"><div class="wi"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg></div><h3>Share Screen</h3><p>Show your screen with a 6-digit code</p></div>'
|
||
|
|
+ '<div class="wcard" data-go="connect"><div class="wi"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.55a11 11 0 0 1 14.08 0"/><path d="M1.42 9a16 16 0 0 1 21.16 0"/><path d="M8.53 16.11a6 6 0 0 1 6.95 0"/><line x1="12" y1="20" x2="12.01" y2="20"/></svg></div><h3>Connect Screen</h3><p>Enter a customer\'s code to help</p></div>'
|
||
|
|
+ '<div class="wcard" data-go="meeting"><div class="wi"><svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/></svg></div><h3>Meeting</h3><p>Multi-party video — coming soon</p></div>'
|
||
|
|
+ '</div></div>';
|
||
|
|
}
|
||
|
|
function convoHTML(c){
|
||
|
|
return '<div class="convo">'
|
||
|
|
+ '<div class="convo-head">'
|
||
|
|
+ '<button class="convo-back" id="convoBack" title="Back to home (Esc)" aria-label="Back to home">←</button>'
|
||
|
|
+ '<div class="avatar" style="width:38px;height:38px;flex:0 0 38px;background:'+avColor(c.name)+'">'+pEsc(initials(c.name))+'<span class="dot'+(c.online?' on':'')+'"></span></div>'
|
||
|
|
+ '<div><div class="nm">'+pEsc(c.name)+'</div><div class="st">'+(c.online?'Online':'Offline')+'</div></div>'
|
||
|
|
+ '</div>'
|
||
|
|
+ '<div class="convo-body"><div><div class="big">💬</div><div style="font-weight:600;color:var(--ink);margin-bottom:.3rem">Messaging is coming soon</div><div>Persistent 1:1 chat with '+pEsc(c.name)+' will live here.<br>For now, start a screen session from the left.</div></div></div>'
|
||
|
|
+ '</div>';
|
||
|
|
}
|
||
|
|
function renderChatPanel(){
|
||
|
|
const el=document.getElementById('chatPanel');
|
||
|
|
if(selectedChat==null){ el.classList.add('center'); el.innerHTML=welcomeHTML(); wireWelcome(); }
|
||
|
|
else { el.classList.remove('center'); el.innerHTML=convoHTML(CHATS[selectedChat]); const b=document.getElementById('convoBack'); if(b) b.onclick=showWelcome; }
|
||
|
|
}
|
||
|
|
function wireWelcome(){
|
||
|
|
document.querySelectorAll('#chatPanel .wcard').forEach(card=>{
|
||
|
|
card.onclick=()=>switchTab(card.dataset.go);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------- Tabs (icon rail) ----------
|
||
|
|
// Chat and Meeting are in-shell panels; Share and Connect load in the center panel via
|
||
|
|
// a single, same-origin, lazily-loaded iframe (cheap isolation, no page navigation).
|
||
|
|
const railBtns=document.querySelectorAll('.railbtn');
|
||
|
|
const panels=document.querySelectorAll('.panel');
|
||
|
|
const chatcol=document.getElementById('chatcol');
|
||
|
|
let loaded={share:false,connect:false};
|
||
|
|
function currentTab(){ const b=document.querySelector('.railbtn.active'); return b?b.dataset.tab:'chat'; }
|
||
|
|
function switchTab(tab){
|
||
|
|
railBtns.forEach(b=>b.classList.toggle('active',b.dataset.tab===tab));
|
||
|
|
panels.forEach(p=>p.classList.toggle('active',p.dataset.panel===tab));
|
||
|
|
chatcol.classList.toggle('hidden', tab!=='chat');
|
||
|
|
// Lazy-load the embedded flows on first open; keep them mounted afterwards so a
|
||
|
|
// live session survives tab switches.
|
||
|
|
if(tab==='share' && !loaded.share){ document.getElementById('sharePanel').innerHTML='<iframe src="/share?embed=1" allow="camera; microphone; display-capture; clipboard-read; clipboard-write"></iframe>'; loaded.share=true; }
|
||
|
|
if(tab==='connect' && !loaded.connect){ document.getElementById('connectPanel').innerHTML='<iframe src="/connect?embed=1" allow="camera; microphone; display-capture; clipboard-read; clipboard-write"></iframe>'; loaded.connect=true; }
|
||
|
|
}
|
||
|
|
function showWelcome(){ selectedChat=null; renderChats(document.getElementById('chatSearch').value); renderChatPanel(); updateRailUnread(); }
|
||
|
|
railBtns.forEach(btn=>{ btn.onclick=()=>{
|
||
|
|
const tab=btn.dataset.tab;
|
||
|
|
// Re-clicking Chat (while already on it) returns to the welcome screen.
|
||
|
|
if(tab==='chat' && currentTab()==='chat' && selectedChat!=null){ showWelcome(); }
|
||
|
|
switchTab(tab);
|
||
|
|
}; });
|
||
|
|
// Esc clears the open conversation and brings back the welcome screen.
|
||
|
|
document.addEventListener('keydown',(e)=>{ if(e.key==='Escape' && currentTab()==='chat' && selectedChat!=null){ showWelcome(); } });
|
||
|
|
|
||
|
|
// Embedded Share/Connect flows report session start/stop so the rail can show a "live"
|
||
|
|
// dot — that's how you know a session is still running after switching to Chat.
|
||
|
|
window.addEventListener('message',(e)=>{
|
||
|
|
if(e.origin!==location.origin) return;
|
||
|
|
const d=e.data;
|
||
|
|
if(!d||d.type!=='bzc-session'||(d.flow!=='share'&&d.flow!=='connect')) return;
|
||
|
|
const btn=document.querySelector('.railbtn[data-tab="'+d.flow+'"]');
|
||
|
|
if(!btn) return;
|
||
|
|
btn.classList.toggle('live', !!d.active);
|
||
|
|
if(d.active && currentTab()!==d.flow){
|
||
|
|
toast((d.flow==='share'?'Screen share':'Connection')+' is live — tap the highlighted icon to return');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// Sidebar + misc wiring
|
||
|
|
document.getElementById('chatSearch').addEventListener('input',e=>renderChats(e.target.value));
|
||
|
|
document.getElementById('newChat').onclick=()=>toast('New chat is coming soon');
|
||
|
|
document.getElementById('notifyBtn').onclick=()=>toast("Thanks! We'll let you know when Meetings launches.");
|
||
|
|
|
||
|
|
// ---------- Login (shown here on /home when logged out) ----------
|
||
|
|
const EYE_OFF='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>';
|
||
|
|
const EYE_ON='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>';
|
||
|
|
function pwField(id,ph){return '<div class="pwwrap"><input id="'+id+'" type="password" placeholder="'+ph+'"><button type="button" class="eye" data-for="'+id+'" aria-label="Show password"></button></div>';}
|
||
|
|
function wireEyes(){document.querySelectorAll('.eye').forEach(b=>{if(b._w)return;b._w=1;b.innerHTML=EYE_OFF;b.onclick=()=>{const inp=document.getElementById(b.getAttribute('data-for'));if(!inp)return;const show=inp.type==='password';inp.type=show?'text':'password';b.innerHTML=show?EYE_ON:EYE_OFF;};});}
|
||
|
|
function onEnter(ids,fn){ids.forEach(id=>{const el=document.getElementById(id);if(el)el.addEventListener('keydown',e=>{if(e.key==='Enter'){e.preventDefault();fn();}});});}
|
||
|
|
function showErr(id,msg){const el=document.getElementById(id);el.textContent=msg;el.classList.add('show');}
|
||
|
|
function clearErr(id){const el=document.getElementById(id);el.textContent='';el.classList.remove('show');}
|
||
|
|
async function postJSON(path,body){const r=await fetch(path,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)});const d=await r.json().catch(()=>({}));if(!r.ok)throw new Error(d.error||'request failed');return d;}
|
||
|
|
async function renderLogin(){
|
||
|
|
document.querySelector('.shell').style.display='none';
|
||
|
|
const aw=document.getElementById('authwrap'); aw.style.display='flex';
|
||
|
|
let regOpen=false; try{ regOpen=(await (await fetch('/api/setup-state')).json()).registrationOpen; }catch(_){}
|
||
|
|
aw.innerHTML=`<div class="authcard">
|
||
|
|
<h1>Welcome to BizGaze Connect</h1>
|
||
|
|
<div class="sub">Sign in to access chats, screen share and connect.</div>
|
||
|
|
${regOpen?`<div class="authtabs">
|
||
|
|
<button id="tabLogin" class="active">Sign in</button>
|
||
|
|
<button id="tabReg">Register team</button>
|
||
|
|
</div>`:''}
|
||
|
|
<div id="loginForm">
|
||
|
|
<span class="lbl">Email</span><input id="li_email" type="email" placeholder="you@bizgaze.com">
|
||
|
|
<span class="lbl">Password</span>${pwField('li_pw','password')}
|
||
|
|
<label style="display:flex;align-items:center;gap:.5rem;margin:.7rem 0;color:var(--ink);font-size:.9rem;cursor:pointer"><input type="checkbox" id="li_remember" style="width:18px;height:18px;accent-color:var(--blue);margin:0"> Remember me on this device</label>
|
||
|
|
<button class="gobtn" id="li_btn">Sign in</button>
|
||
|
|
<p id="li_err" class="formerr"></p>
|
||
|
|
</div>
|
||
|
|
${regOpen?`<div id="regForm" class="hidden">
|
||
|
|
<span class="lbl">Team name</span><input id="rg_team" placeholder="e.g. BizGaze Support">
|
||
|
|
<span class="lbl">Email</span><input id="rg_email" type="email" placeholder="you@bizgaze.com">
|
||
|
|
<span class="lbl">Password</span>${pwField('rg_pw','min 8 characters')}
|
||
|
|
<button class="gobtn" id="rg_btn">Create team</button>
|
||
|
|
<p id="rg_err" class="formerr"></p>
|
||
|
|
</div>`:''}
|
||
|
|
</div>`;
|
||
|
|
document.getElementById('li_btn').onclick=doLogin;
|
||
|
|
wireEyes();
|
||
|
|
onEnter(['li_email','li_pw'],doLogin);
|
||
|
|
if(regOpen){
|
||
|
|
const lf=document.getElementById('loginForm'), rf=document.getElementById('regForm');
|
||
|
|
const tl=document.getElementById('tabLogin'), tr=document.getElementById('tabReg');
|
||
|
|
tl.onclick=()=>{lf.classList.remove('hidden');rf.classList.add('hidden');tl.classList.add('active');tr.classList.remove('active');};
|
||
|
|
tr.onclick=()=>{rf.classList.remove('hidden');lf.classList.add('hidden');tr.classList.add('active');tl.classList.remove('active');};
|
||
|
|
document.getElementById('rg_btn').onclick=doRegister;
|
||
|
|
onEnter(['rg_team','rg_email','rg_pw'],doRegister);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
async function doLogin(){
|
||
|
|
clearErr('li_err');
|
||
|
|
try{
|
||
|
|
await postJSON('/api/login',{email:document.getElementById('li_email').value,password:document.getElementById('li_pw').value,remember:document.getElementById('li_remember').checked});
|
||
|
|
location.reload();
|
||
|
|
}catch(e){ showErr('li_err', /invalid credentials/i.test(e.message)?'Incorrect email or password. Please try again.':e.message); }
|
||
|
|
}
|
||
|
|
async function doRegister(){
|
||
|
|
clearErr('rg_err');
|
||
|
|
try{
|
||
|
|
await postJSON('/api/register',{email:document.getElementById('rg_email').value,password:document.getElementById('rg_pw').value,teamName:document.getElementById('rg_team').value});
|
||
|
|
await postJSON('/api/login',{email:document.getElementById('rg_email').value,password:document.getElementById('rg_pw').value});
|
||
|
|
location.reload();
|
||
|
|
}catch(e){ showErr('rg_err', e.message); }
|
||
|
|
}
|
||
|
|
|
||
|
|
// ---------- Boot: show the app if signed in, otherwise the login ----------
|
||
|
|
(async function(){
|
||
|
|
let me=null;
|
||
|
|
try{ const r=await fetch('/api/me'); if(r.ok) me=await r.json(); }catch(_){}
|
||
|
|
if(!me){ await renderLogin(); document.getElementById('loading').style.display='none'; return; }
|
||
|
|
ME=me;
|
||
|
|
document.getElementById('hdrRight').innerHTML=profileHTML(me);
|
||
|
|
wireProfile();
|
||
|
|
renderChats('');
|
||
|
|
renderChatPanel();
|
||
|
|
updateRailUnread();
|
||
|
|
document.getElementById('loading').style.display='none';
|
||
|
|
})();
|
||
|
|
</script>
|
||
|
|
</body>
|
||
|
|
</html>
|