feat: download icon on webapp cards for auto-install

This commit is contained in:
2026-08-17 20:18:39 +08:00
parent a1b65ad4c6
commit 0194a57734
2 changed files with 40 additions and 0 deletions
+27
View File
@@ -483,6 +483,33 @@ body {
color: var(--text-dim); color: var(--text-dim);
} }
/* 下载离线包图标(右下角,云端有离线包时显示) */
/* Download-offline-package icon (bottom-right, shown when cloud has a package) */
.wcell-dl {
position: absolute;
bottom: 6px;
right: 6px;
width: 26px;
height: 26px;
border-radius: 999px;
background: var(--glass-bg);
border: 1px solid var(--glass-border);
color: var(--accent);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
}
.wcell-dl svg {
width: 14px;
height: 14px;
}
.wcell-dl:active {
opacity: 0.6;
}
/* webAPP 顶栏:浮层玻璃条 + 标签面板 */ /* webAPP 顶栏:浮层玻璃条 + 标签面板 */
/* webapp topbar: floating glass bar + tab panel */ /* webapp topbar: floating glass bar + tab panel */
/* 前台有 webapp 时隐藏 webapp 列表内容,避免半透明顶栏透出列表控件 */ /* 前台有 webapp 时隐藏 webapp 列表内容,避免半透明顶栏透出列表控件 */
@@ -29,6 +29,19 @@ window.loadWebAppList = async function () {
tag.className = 'tag'; tag.className = 'tag';
tag.textContent = a.offline ? '离线' : '在线'; tag.textContent = a.offline ? '离线' : '在线';
btn.append(img, lbl, tag); btn.append(img, lbl, tag);
// 云端有离线包 → 加下载图标(点击自动拉取安装)
// Cloud has an offline package -> add a download icon (tap to auto-install)
if (a.offline) {
const dl = document.createElement('span');
dl.className = 'wcell-dl';
dl.title = '下载离线包';
dl.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v12"/><path d="M7 10l5 5 5-5"/><path d="M5 21h14"/></svg>';
dl.onclick = (e) => {
e.stopPropagation();
bridge.call('updateOfflinePackage', a.id).then(() => refreshList()).catch(() => {});
};
btn.appendChild(dl);
}
btn.onclick = () => bridge.call('openWebApp', btn.dataset.id); btn.onclick = () => bridge.call('openWebApp', btn.dataset.id);
setupLongPress(btn, a); setupLongPress(btn, a);
grid.appendChild(btn); grid.appendChild(btn);