Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

21.2 KB
Raw Blame
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>Cindy Mobile · 宽屏会话页三条杠 + 任务列表抽屉 预览</title>
<style>
  /* ── 色值 1:1 取自 apps/mobile/src/theme/tokens.ts(代码为真相源) ── */
  :root {
    --surface:#EDEDED; --surface-elevated:#F8F8F8; --surface-chip:#F1F1F1;
    --border:#C6C9CE; --text-primary:#3C3F43; --text-secondary:#8C8E94; --text-tertiary:#686B72;
    --overlay:rgba(38,38,38,.35);
    --chat-header-surface:rgba(246,246,246,.90); --chat-header-divider:#DCDFE3;
    --status-ready:#19D2C1; --status-accent:#EA6B17; --status-awaiting:#19D2C1;
    --status-error:#D91F37; --status-done:#2AAE5B;
    --cta:#3C3F43; --cta-text:#FCFCFC; --list-row:#F6F6F6;
  }
  .dark {
    --surface:#2A2828; --surface-elevated:#312F2F; --surface-chip:#2F2D2D;
    --border:#434343; --text-primary:#D4D4D4; --text-secondary:#6F6F6F; --text-tertiary:#BFC1C4;
    --overlay:rgba(0,0,0,.45);
    --chat-header-surface:rgba(37,35,35,.80); --chat-header-divider:rgba(255,255,255,.05);
    --cta:#EEEEEE; --cta-text:#252222; --list-row:#312F2F;
  }
  * { box-sizing:border-box; margin:0; padding:0; -webkit-font-smoothing:antialiased; }
  html,body { height:100%; }
  body {
    font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Helvetica Neue",sans-serif;
    background:#1a1a1a; display:flex; flex-direction:column; align-items:center;
    overflow:hidden; user-select:none;
  }
  /* ── 顶部控制条(预览工具自身,非 App UI) ── */
  .toolbar {
    display:flex; gap:8px; align-items:center; padding:10px 16px; flex-wrap:wrap;
    justify-content:center; color:#999; font-size:12px;
  }
  .toolbar button {
    background:#2c2c2c; color:#bbb; border:1px solid #3d3d3d; border-radius:999px;
    padding:5px 14px; font-size:12px; cursor:pointer;
  }
  .toolbar button.on { background:#e8e8e8; color:#222; border-color:#e8e8e8; }
  .stage { flex:1; display:flex; align-items:center; justify-content:center; width:100%; }

  /* ── 设备框 ── */
  .device {
    position:relative; background:var(--surface); border-radius:24px; overflow:hidden;
    box-shadow:0 20px 60px rgba(0,0,0,.55); outline:6px solid #0d0d0d;
    transform-origin:center center;
  }
  .screen { position:absolute; inset:0; display:flex; flex-direction:column; }

  /* ── 会话页:顶部 chrome(absolute, blur) ── */
  .chrome {
    position:absolute; left:0; right:0; top:0; z-index:10; overflow:hidden;
    background:var(--chat-header-surface);
    -webkit-backdrop-filter:blur(20px); backdrop-filter:blur(20px);
  }
  .header {  /* sessionHeaderBar: minHeight 50 / padH 8 / padV 4 / gap 4 / hairline */
    display:flex; align-items:center; gap:4px; min-height:50px;
    padding:4px 8px; border-bottom:0.5px solid var(--chat-header-divider);
  }
  .icon-btn { /* SessionHeaderIconButton: 38×38 pill */
    width:38px; height:38px; border-radius:999px; display:flex; align-items:center;
    justify-content:center; flex-shrink:0; cursor:pointer; border:none; background:transparent;
  }
  .icon-btn:active { background:var(--surface-chip); }
  .back-btn { /* ScreenBackButton: 44×44, marginLeft -8 */
    width:44px; height:44px; margin-left:-8px; border-radius:999px; display:none;
    align-items:center; justify-content:center; flex-shrink:0; cursor:pointer; border:none; background:transparent;
  }
  .narrow .back-btn { display:flex; }
  .narrow .menu-btn { display:none; }
  .header-text { flex:1; min-width:0; padding-left:4px; }
  .header-title { /* body16 / semibold600 / lh22 */
    font-size:16px; line-height:22px; font-weight:600; color:var(--text-primary);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .header-notice { font-size:11px; line-height:14px; margin-top:2px; color:var(--text-secondary); }
  .header-actions { display:flex; align-items:center; gap:2px; }
  svg.ic { stroke:var(--text-primary); fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

  /* ── 消息区(示意背景) ── */
  .messages {
    flex:1; overflow:hidden; padding:66px 0 96px;
    display:flex; flex-direction:column; gap:14px; align-items:center;
  }
  .msg-col { width:100%; max-width:760px; padding:0 20px; display:flex; flex-direction:column; gap:14px; }
  .bubble-user {
    align-self:flex-end; max-width:78%; background:var(--surface-chip);
    border:1px solid var(--border); border-radius:12px; padding:10px 14px;
    font-size:16px; line-height:22px; color:var(--text-primary);
  }
  .assistant { font-size:16px; line-height:24px; color:var(--text-primary); }
  .assistant .dim { color:var(--text-tertiary); font-size:13px; line-height:20px; display:block; margin-top:6px; }
  .work-strip {
    display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-tertiary);
  }
  .work-strip .flame { width:8px; height:8px; border-radius:999px; background:var(--status-accent);
    animation:breathe 1.6s ease-in-out infinite; }
  @keyframes breathe { 0%,100%{opacity:.35} 50%{opacity:1} }

  /* ── 底部 composer(示意) ── */
  .composer-layer { position:absolute; left:0; right:0; bottom:0; z-index:10; display:flex; justify-content:center; padding:0 16px 18px; }
  .composer {
    width:100%; max-width:760px; background:var(--surface-elevated); border:1px solid var(--border);
    border-radius:999px; min-height:46px; display:flex; align-items:center; gap:10px; padding:0 8px 0 16px;
  }
  .composer .ph { flex:1; font-size:16px; color:var(--text-tertiary); }
  .composer .send {
    width:34px; height:34px; border-radius:999px; background:var(--cta); display:flex;
    align-items:center; justify-content:center;
  }
  .composer .send svg { stroke:var(--cta-text); }

  /* ── 抽屉 overlay(zIndex 40) ── */
  .drawer-overlay { position:absolute; inset:0; z-index:40; visibility:hidden; }
  .drawer-overlay.mounted { visibility:visible; }
  .scrim { position:absolute; inset:0; background:var(--overlay); opacity:0; }
  .panel {
    position:absolute; left:0; top:0; bottom:0; background:var(--surface);
    border-right:0.5px solid var(--border); display:flex; flex-direction:column;
    padding-top:14px; /* insets.top(示意 6) + spacing.sm 8 */
    transform:translateX(-100%); touch-action:pan-y;
  }
  .panel-header { /* padH 16 / padV 8 */
    display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 16px;
  }
  .panel-title { font-size:20px; line-height:26px; font-weight:500; color:var(--text-primary); }
  .drawer-list { flex:1; overflow-y:auto; padding:0 8px 16px; }
  .section-title { /* caption12 / medium / tertiary */
    font-size:12px; line-height:18px; font-weight:500; color:var(--text-tertiary);
    padding:12px 8px 4px;
  }
  .row { /* radius 12 / padH 8 / padV 10 / gap 2 */
    border-radius:12px; padding:10px 8px; display:flex; flex-direction:column; gap:2px; cursor:pointer;
  }
  .row:active { opacity:.72; }
  .row.active { background:var(--surface-chip); }
  .row-line1 { display:flex; align-items:center; gap:8px; min-width:0; }
  .row-title {
    flex:1; min-width:0; font-size:16px; line-height:22px; font-weight:500; color:var(--text-primary);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .row-time { flex-shrink:0; font-size:12px; line-height:18px; color:var(--text-tertiary); }
  .status-cell { width:18px; height:18px; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
  .dot { width:10px; height:10px; border-radius:999px; }
  .row-preview {
    font-size:12px; line-height:18px; color:var(--text-tertiary);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .spinner { animation:spin 1s linear infinite; display:flex; }
  @keyframes spin { to { transform:rotate(360deg); } }
  .drawer-footer { border-top:0.5px solid var(--border); padding:8px 8px 14px; }
  .footer-row {
    display:flex; align-items:center; gap:8px; border-radius:12px; padding:8px; cursor:pointer;
  }
  .footer-row:active { opacity:.72; }
  .footer-label { font-size:16px; line-height:22px; font-weight:500; color:var(--text-secondary); }
  .footer-row svg { stroke:var(--text-secondary); }
  .hint {
    color:#777; font-size:12px; padding:8px 16px 14px; text-align:center; line-height:1.7;
  }
  .hint b { color:#aaa; font-weight:500; }
</style>
</head>
<body>
  <div class="toolbar">
    <span>设备:</span>
    <button data-dev="ipad-l" class="on">iPad 横屏 1180×820</button>
    <button data-dev="ipad-p">iPad 竖屏 820×1180</button>
    <button data-dev="fold">安卓折叠屏展开 648×672</button>
    <button data-dev="phone-l">安卓手机横屏 852×393</button>
    <button data-dev="phone-p">手机竖屏 393×852(对照:回退返回键)</button>
    <span style="width:12px"></span>
    <button id="modeBtn">☀︎ Light</button>
  </div>

  <div class="stage"><div class="device" id="device">
    <div class="screen" id="screen">
      <!-- 顶部 chrome -->
      <div class="chrome">
        <div class="header">
          <button class="back-btn" title="返回">
            <svg class="ic" width="20" height="20" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>
          </button>
          <button class="icon-btn menu-btn" id="menuBtn" title="打开任务列表">
            <svg class="ic" width="20" height="20" viewBox="0 0 24 24">
              <line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="18" y2="18"/>
            </svg>
          </button>
          <div class="header-text">
            <div class="header-title">移动端横屏与折叠屏适配</div>
            <div class="header-notice">待处理 2</div>
          </div>
          <div class="header-actions">
            <button class="icon-btn" title="文件">
              <svg class="ic" width="20" height="20" viewBox="0 0 24 24"><path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/></svg>
            </button>
            <button class="icon-btn" title="搜索">
              <svg class="ic" width="20" height="20" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
            </button>
            <button class="icon-btn" title="菜单">
              <svg class="ic" width="20" height="20" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>
            </button>
          </div>
        </div>
      </div>

      <!-- 消息区(示意) -->
      <div class="messages"><div class="msg-col">
        <div class="bubble-user">我们做一下移动端横屏和折叠屏适配吧,session 内页左上角改成三条杠,拉出任务列表。</div>
        <div class="assistant">
          好的。宽屏(≥600dp)下左上角改为三条杠,点击从左缘拉出任务列表抽屉;列表复用首页的置顶区、
          排序与状态点口径,选任务原地切换、不压导航栈。
          <span class="dim">已改 10 个文件 · 新增 wideSessionNav.ts / SessionListDrawer.tsx · 测试 57 项全绿</span>
        </div>
        <div class="work-strip"><span class="flame"></span>正在运行 pnpm --filter mobile typecheck…</div>
      </div></div>

      <!-- 底部 composer(示意) -->
      <div class="composer-layer"><div class="composer">
        <span class="ph">输入消息…</span>
        <svg class="ic" width="20" height="20" viewBox="0 0 24 24" style="stroke:var(--text-secondary)"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>
        <div class="send"><svg class="ic" width="16" height="16" viewBox="0 0 24 24"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg></div>
      </div></div>

      <!-- 任务列表抽屉 -->
      <div class="drawer-overlay" id="overlay">
        <div class="scrim" id="scrim" title="关闭任务列表"></div>
        <div class="panel" id="panel">
          <div class="panel-header">
            <div class="panel-title">所有任务</div>
            <button class="icon-btn" id="newBtn" title="新建远程任务">
              <svg class="ic" width="22" height="22" viewBox="0 0 24 24"><path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z"/></svg>
            </button>
          </div>
          <div class="drawer-list">
            <div class="section-title">置顶</div>
            <div class="row">
              <div class="row-line1"><span class="row-title">Cindy 客户端重构主线</span>
                <span class="status-cell"><span class="dot" style="background:var(--status-done)"></span></span></div>
              <div class="row-preview">P2 renderer 收尾:侧栏冷缓存已合并,等回归确认</div>
            </div>
            <div class="row">
              <div class="row-line1"><span class="row-title">周报自动生成</span><span class="row-time">昨天</span></div>
              <div class="row-preview">已生成 7-28 ~ 8-01 财务周报草稿</div>
            </div>
            <div class="section-title" style="padding-top:16px"></div>
            <div class="row active">
              <div class="row-line1"><span class="row-title">移动端横屏与折叠屏适配</span>
                <span class="status-cell"><span class="spinner"><svg class="ic" width="16" height="16" viewBox="0 0 24 24" style="stroke:var(--text-tertiary)"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg></span></span></div>
              <div class="row-preview">正在运行 pnpm --filter mobile typecheck…</div>
            </div>
            <div class="row">
              <div class="row-line1"><span class="row-title">修复登录页冷启动闪退</span>
                <span class="status-cell"><span class="dot" style="background:var(--status-awaiting)"></span></span></div>
              <div class="row-preview">需要你确认:是否允许上报崩溃堆栈?</div>
            </div>
            <div class="row">
              <div class="row-line1"><span class="row-title">数据库迁移脚本 v14</span>
                <span class="status-cell"><span class="dot" style="background:var(--status-error)"></span></span></div>
              <div class="row-preview">migration 校验失败:schema drift 于 sessions 表</div>
            </div>
            <div class="row">
              <div class="row-line1"><span class="row-title">NAS 影视库整理</span><span class="row-time">3 天前</span></div>
              <div class="row-preview">已入库 12 部,2 部字幕待匹配</div>
            </div>
            <div class="row">
              <div class="row-line1"><span class="row-title">接口联调记录</span><span class="row-time">07-26</span></div>
              <div class="row-preview">device-link 隧道 allowlist 增补完成</div>
            </div>
            <div class="row">
              <div class="row-line1"><span class="row-title">竞品 UI 走查</span><span class="row-time">07-22</span></div>
              <div class="row-preview">Kun / OpenCode 供应商预设对比结论已归档</div>
            </div>
          </div>
          <div class="drawer-footer">
            <div class="footer-row" id="homeRow">
              <svg class="ic" width="18" height="18" viewBox="0 0 24 24"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/></svg>
              <span class="footer-label">主页</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div></div>

  <div class="hint">
    点 <b>三条杠</b> 拉出抽屉 · 点 <b>遮罩</b> 或在面板上 <b>向左拖</b>(超 1/3 或快甩)关闭 ·
    点任务行 = 原地切换(高亮行为当前任务) · 色值/尺寸/动效参数与 <b>tokens.ts / SessionListDrawer.tsx</b> 一致 ·
    手机竖屏预设展示窄屏回退的返回键形态<br>
    发布策略按平台分闸:<b>安卓</b>纯宽度闸(折叠屏/平板/横屏大屏机);<b>iOS 仅 iPad</b>,
    iPhone 即使横屏达宽也不启用、保持返回键(见 wideSessionNav.ts)
  </div>

<script>
  // ── 断点与抽屉宽度:与 wideSessionNav.ts 完全同式 ──
  const WIDE_MIN = 600, DRAWER_MIN = 300, DRAWER_MAX = 360, RATIO = 0.4;
  const clamp = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
  const drawerWidth = (w) => clamp(Math.round(w * RATIO), DRAWER_MIN, DRAWER_MAX);

  const DEVICES = {
    'ipad-l':  { w:1180, h:820 },
    'ipad-p':  { w:820,  h:1180 },
    'fold':    { w:648,  h:672 },
    'phone-l': { w:852,  h:393 },
    'phone-p': { w:393,  h:852 },
  };
  const device = document.getElementById('device');
  const screenEl = document.getElementById('screen');
  const overlay = document.getElementById('overlay');
  const scrim = document.getElementById('scrim');
  const panel = document.getElementById('panel');
  let current = DEVICES['ipad-l'];
  let panelW = drawerWidth(current.w);
  let open = false;

  // ── 动效:进 240ms Easing.out(cubic) / 出 200ms Easing.in(cubic) / 拖拽回弹 160ms ──
  const EASE_OUT = 'cubic-bezier(0.33, 1, 0.68, 1)';
  const EASE_IN  = 'cubic-bezier(0.32, 0, 0.67, 0)';

  function applyDevice(key) {
    current = DEVICES[key];
    panelW = drawerWidth(current.w);
    device.style.width = current.w + 'px';
    device.style.height = current.h + 'px';
    panel.style.width = panelW + 'px';
    const wide = current.w >= WIDE_MIN;
    screenEl.classList.toggle('narrow', !wide);
    setOpen(false, true);                     // 切设备 = 重挂载:抽屉收起(窄屏回退与页面 effect 一致)
    // 缩放适配预览窗口
    const stage = document.querySelector('.stage');
    const scale = Math.min(1, (stage.clientWidth - 48) / current.w, (stage.clientHeight - 24) / current.h);
    device.style.transform = `scale(${scale})`;
  }

  function setOpen(next, instant = false) {
    if (next === open && !instant) return;
    open = next;
    if (next) {
      overlay.classList.add('mounted');
      panel.style.transition = `transform 240ms ${EASE_OUT}`;
      scrim.style.transition = `opacity 240ms ${EASE_OUT}`;
      requestAnimationFrame(() => requestAnimationFrame(() => {
        panel.style.transform = 'translateX(0)';
        scrim.style.opacity = '1';
      }));
    } else {
      const ms = instant ? 0 : 200;
      panel.style.transition = `transform ${ms}ms ${EASE_IN}`;
      scrim.style.transition = `opacity ${ms}ms ${EASE_IN}`;
      panel.style.transform = 'translateX(-100%)';
      scrim.style.opacity = '0';
      const unmount = () => { if (!open) overlay.classList.remove('mounted'); };
      instant ? unmount() : setTimeout(unmount, ms);
    }
  }

  document.getElementById('menuBtn').addEventListener('click', () => setOpen(true));
  scrim.addEventListener('click', () => setOpen(false));
  document.getElementById('homeRow').addEventListener('click', () => setOpen(false));
  document.getElementById('newBtn').addEventListener('click', () => setOpen(false));
  // 选任务:原地切换 —— 换高亮行 + 换页头标题,关抽屉
  document.querySelectorAll('.row').forEach((row) => {
    row.addEventListener('click', () => {
      document.querySelectorAll('.row').forEach((r) => r.classList.remove('active'));
      row.classList.add('active');
      document.querySelector('.header-title').textContent = row.querySelector('.row-title').textContent;
      setOpen(false);
    });
  });

  // ── 面板拖拽关闭:dragX ≤ 0,松手 |dx| > 1/3 宽或速度超阈即关(与 Pan 手势同参) ──
  let dragging = false, startX = 0, lastX = 0, lastT = 0, vx = 0;
  panel.addEventListener('pointerdown', (e) => {
    dragging = true; startX = lastX = e.clientX; lastT = performance.now(); vx = 0;
    panel.style.transition = 'none'; scrim.style.transition = 'none';
    panel.setPointerCapture(e.pointerId);
  });
  panel.addEventListener('pointermove', (e) => {
    if (!dragging) return;
    const now = performance.now();
    vx = (e.clientX - lastX) / Math.max(1, now - lastT) * 1000; // px/s
    lastX = e.clientX; lastT = now;
    const dx = Math.min(0, e.clientX - startX);
    panel.style.transform = `translateX(${dx}px)`;
    scrim.style.opacity = String(Math.max(0, Math.min(1, 1 + dx / panelW)));
  });
  const endDrag = (e) => {
    if (!dragging) return; dragging = false;
    const dx = Math.min(0, e.clientX - startX);
    if (dx < -panelW / 3 || vx < -800) { setOpen(false); }
    else { // 回弹 160ms
      panel.style.transition = `transform 160ms ${EASE_OUT}`;
      scrim.style.transition = `opacity 160ms ${EASE_OUT}`;
      panel.style.transform = 'translateX(0)'; scrim.style.opacity = '1';
    }
  };
  panel.addEventListener('pointerup', endDrag);
  panel.addEventListener('pointercancel', endDrag);

  // ── 工具条 ──
  document.querySelectorAll('[data-dev]').forEach((btn) => {
    btn.addEventListener('click', () => {
      document.querySelectorAll('[data-dev]').forEach((b) => b.classList.remove('on'));
      btn.classList.add('on');
      applyDevice(btn.dataset.dev);
    });
  });
  const modeBtn = document.getElementById('modeBtn');
  modeBtn.addEventListener('click', () => {
    const dark = device.classList.toggle('dark');
    modeBtn.textContent = dark ? '☾ Dark' : '☀︎ Light';
  });
  window.addEventListener('resize', () => applyDevice(document.querySelector('[data-dev].on').dataset.dev));
  applyDevice('ipad-l');
</script>
</body>
</html>