// AGENTS.md §21 multi-server card. // // Phase 7 C5: V1 只支持单 active server,§21 描述的多 server UI(添加/ // 编辑/删除/启用/禁用)还没实现。原来的 ServerCard 有 enabled 切换 // + Edit / Remove 按钮,但 settings-page.slint 只是占位填写硬编码 // 的 "Home" / "NAS",回调也没接 —— 用户看到的 "点不动" 按钮是纯 UI // 壳子,对应 "很多都没反应" 的反馈。 // // 修法:把 ServerCard 简化成纯展示卡(name + url + 状态点),由 // settings-page.slint 从 AppConfig.active_server 实时填进去。无服务 // 器时整个 section 走空态。等 V2 真做多 server UI 再加回 toggle / // Edit / Remove / Add。 export component ServerCard inherits Rectangle { in property server-name: "(未配置服务器)"; in property server-url: ""; in property enabled: true; in property is-current: false; in property bg-color: #28292d; in property card-border: #3a3b40; in property text-primary-color: #e6e6e6; in property text-secondary-color: #a0a0a0; in property accent-color: #4ea1ff; in property success-color: #4caf50; width: 100%; height: 64px; border-radius: 8px; background: bg-color; border-color: card-border; border-width: 1px; HorizontalLayout { padding-top: 12px; padding-bottom: 12px; padding-left: 16px; padding-right: 16px; spacing: 12px; alignment: center; // 状态点:已连接 → 绿,配置但未连 → 蓝,未配置 → 灰。 Rectangle { width: 10px; height: 10px; border-radius: 5px; background: enabled ? success-color : text-secondary-color; y: parent.height / 2 - self.height / 2; } VerticalLayout { horizontal-stretch: 1; spacing: 2px; HorizontalLayout { spacing: 8px; Text { text: server-name; color: text-primary-color; font-size: 13px; font-weight: 600; } if is-current: Text { text: "• 当前"; color: accent-color; font-size: 11px; } } Text { text: server-url != "" ? server-url : "(暂无 URL — 在 Settings → Connection 里填)"; color: text-secondary-color; font-size: 11px; overflow: elide; } } } }