3.3
This commit is contained in:
@@ -923,6 +923,7 @@ def api_create_usecase():
|
|||||||
"id": uid,
|
"id": uid,
|
||||||
"name": name,
|
"name": name,
|
||||||
"color": data.get("color", "#4f8ef7"),
|
"color": data.get("color", "#4f8ef7"),
|
||||||
|
"group": data.get("group", "").strip(),
|
||||||
"blocks": data.get("blocks", ["notifications"]),
|
"blocks": data.get("blocks", ["notifications"]),
|
||||||
"min_interval": int(data.get("min_interval", 10)),
|
"min_interval": int(data.get("min_interval", 10)),
|
||||||
"max_interval": int(data.get("max_interval", 30)),
|
"max_interval": int(data.get("max_interval", 30)),
|
||||||
@@ -1130,6 +1131,7 @@ def pwa_app_name():
|
|||||||
with _usecases_lock:
|
with _usecases_lock:
|
||||||
usecases_for_pwa = [
|
usecases_for_pwa = [
|
||||||
{"id": u["id"], "name": u["name"], "color": u.get("color","#4f8ef7"),
|
{"id": u["id"], "name": u["name"], "color": u.get("color","#4f8ef7"),
|
||||||
|
"group": u.get("group", ""),
|
||||||
"blocks": u.get("blocks", []), "min_interval": u.get("min_interval",10),
|
"blocks": u.get("blocks", []), "min_interval": u.get("min_interval",10),
|
||||||
"max_interval": u.get("max_interval",30)}
|
"max_interval": u.get("max_interval",30)}
|
||||||
for u in _usecases
|
for u in _usecases
|
||||||
@@ -1294,4 +1296,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
398
pwa/index.html
398
pwa/index.html
@@ -28,6 +28,7 @@
|
|||||||
--yellow: #f59e0b;
|
--yellow: #f59e0b;
|
||||||
--text: #e2e2e8;
|
--text: #e2e2e8;
|
||||||
--muted: #6b6b7b;
|
--muted: #6b6b7b;
|
||||||
|
--mono: 'Space Mono', monospace;
|
||||||
--safe-t: env(safe-area-inset-top, 0px);
|
--safe-t: env(safe-area-inset-top, 0px);
|
||||||
--safe-b: env(safe-area-inset-bottom, 0px);
|
--safe-b: env(safe-area-inset-bottom, 0px);
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── SHARED BACKGROUND (main.png, persists across screens) ── */
|
/* ── SHARED BACKGROUND ── */
|
||||||
#shared-bg {
|
#shared-bg {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -84,8 +85,6 @@
|
|||||||
#shared-bg.loaded {
|
#shared-bg.loaded {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overlay darkening — heavier on selector, lighter on splash */
|
|
||||||
#shared-bg-overlay {
|
#shared-bg-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
@@ -174,7 +173,7 @@
|
|||||||
.sel-header {
|
.sel-header {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: calc(var(--safe-t) + 22px) 20px 16px;
|
padding: calc(var(--safe-t) + 22px) 20px 14px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
@@ -193,79 +192,196 @@
|
|||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── TREE VIEW ── */
|
||||||
.uc-list {
|
.uc-list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
padding: 14px 16px calc(var(--safe-b) + 16px);
|
padding: 12px 14px calc(var(--safe-b) + 16px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 2px;
|
||||||
}
|
}
|
||||||
.uc-item {
|
|
||||||
background: rgba(17, 17, 21, 0.75);
|
.tree-root {
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
width: 100%;
|
||||||
border-radius: 14px;
|
display: flex;
|
||||||
padding: 15px 17px;
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Folder row */
|
||||||
|
.tree-folder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.tree-folder-hdr {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 13px;
|
gap: 0;
|
||||||
|
padding: 8px 10px 8px 6px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: 0.2s;
|
border-radius: 10px;
|
||||||
position: relative;
|
user-select: none;
|
||||||
overflow: hidden;
|
transition: background 0.12s;
|
||||||
backdrop-filter: blur(6px);
|
background: rgba(17, 17, 21, 0.5);
|
||||||
-webkit-backdrop-filter: blur(6px);
|
border: 1px solid rgba(255, 255, 255, 0.07);
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
-webkit-backdrop-filter: blur(4px);
|
||||||
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
.uc-item::before {
|
.tree-folder-hdr:active {
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indent guides */
|
||||||
|
.tree-indent {
|
||||||
|
display: flex;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.tree-guide {
|
||||||
|
width: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.tree-guide::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
width: 1px;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
.tree-guide.last::before {
|
||||||
|
bottom: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Arrow + icon */
|
||||||
|
.tree-arrow {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 0.6rem;
|
||||||
|
color: var(--muted);
|
||||||
|
transition: transform 0.18s;
|
||||||
|
}
|
||||||
|
.tree-arrow.open {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
.tree-folder-icon {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
margin-right: 8px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
.tree-folder-label {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.tree-folder-count {
|
||||||
|
font-size: 0.6rem;
|
||||||
|
color: var(--muted);
|
||||||
|
font-family: var(--mono);
|
||||||
|
background: rgba(0,0,0,0.3);
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
|
border-radius: 999px;
|
||||||
|
padding: 1px 7px;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
.tree-children {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
padding-left: 10px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.tree-children.collapsed {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Leaf = usecase item */
|
||||||
|
.tree-leaf {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 10px;
|
||||||
|
transition: background 0.12s;
|
||||||
|
background: rgba(17, 17, 21, 0.6);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
-webkit-backdrop-filter: blur(4px);
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.tree-leaf::before {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 4px;
|
width: 3px;
|
||||||
background: var(--uc-color, var(--accent));
|
background: var(--uc-color, var(--accent));
|
||||||
border-radius: 14px 0 0 14px;
|
|
||||||
}
|
}
|
||||||
.uc-item:active {
|
.tree-leaf:active {
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
|
background: rgba(255, 255, 255, 0.07);
|
||||||
}
|
}
|
||||||
.uc-item.active {
|
.tree-leaf.active-uc {
|
||||||
border-color: rgba(255, 255, 255, 0.2);
|
border-color: rgba(255, 255, 255, 0.18);
|
||||||
background: rgba(79, 142, 247, 0.12);
|
background: rgba(79, 142, 247, 0.1);
|
||||||
}
|
}
|
||||||
.uc-dot {
|
.tree-leaf-inner {
|
||||||
width: 38px;
|
flex: 1;
|
||||||
height: 38px;
|
|
||||||
border-radius: 11px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
background: var(--uc-color, var(--accent));
|
|
||||||
opacity: 0.25;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
gap: 10px;
|
||||||
font-size: 1.1rem;
|
padding: 10px 12px 10px 10px;
|
||||||
}
|
|
||||||
.uc-item.active .uc-dot {
|
|
||||||
opacity: 0.45;
|
|
||||||
}
|
|
||||||
.uc-info {
|
|
||||||
flex: 1;
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
.uc-name-big {
|
.tree-leaf-color {
|
||||||
font-size: 0.92rem;
|
width: 9px;
|
||||||
|
height: 9px;
|
||||||
|
border-radius: 50%;
|
||||||
|
flex-shrink: 0;
|
||||||
|
background: var(--uc-color, var(--accent));
|
||||||
|
box-shadow: 0 0 6px var(--uc-color, var(--accent));
|
||||||
|
}
|
||||||
|
.tree-leaf-name {
|
||||||
|
font-size: 0.88rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: rgba(255, 255, 255, 0.9);
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.uc-blocks-sm {
|
.tree-leaf-chips {
|
||||||
font-size: 0.63rem;
|
display: flex;
|
||||||
color: rgba(255, 255, 255, 0.4);
|
flex-wrap: wrap;
|
||||||
margin-top: 3px;
|
gap: 3px;
|
||||||
font-family: 'Space Mono', monospace;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.uc-active-tag {
|
.tree-leaf-chip {
|
||||||
|
padding: 1px 6px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.6rem;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-weight: 600;
|
||||||
|
background: rgba(79, 142, 247, 0.1);
|
||||||
|
color: var(--accent);
|
||||||
|
border: 1px solid rgba(79, 142, 247, 0.2);
|
||||||
|
}
|
||||||
|
.tree-leaf-active-tag {
|
||||||
font-size: 0.58rem;
|
font-size: 0.58rem;
|
||||||
font-family: 'Space Mono', monospace;
|
font-family: 'Space Mono', monospace;
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
@@ -277,10 +393,11 @@
|
|||||||
letter-spacing: 0.08em;
|
letter-spacing: 0.08em;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.uc-arrow {
|
.tree-leaf-arrow {
|
||||||
color: rgba(255, 255, 255, 0.25);
|
color: rgba(255, 255, 255, 0.2);
|
||||||
font-size: 0.9rem;
|
font-size: 0.85rem;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
padding-right: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── APP ── */
|
/* ── APP ── */
|
||||||
@@ -378,15 +495,9 @@
|
|||||||
font-size: 0.92rem;
|
font-size: 0.92rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
.sv.green {
|
.sv.green { color: var(--green); }
|
||||||
color: var(--green);
|
.sv.yellow { color: var(--yellow); }
|
||||||
}
|
.sv.accent { color: var(--accent); }
|
||||||
.sv.yellow {
|
|
||||||
color: var(--yellow);
|
|
||||||
}
|
|
||||||
.sv.accent {
|
|
||||||
color: var(--accent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cards */
|
/* Cards */
|
||||||
.c {
|
.c {
|
||||||
@@ -476,25 +587,19 @@
|
|||||||
background: var(--accent);
|
background: var(--accent);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.btn-accent:active {
|
.btn-accent:active { filter: brightness(0.9); }
|
||||||
filter: brightness(0.9);
|
|
||||||
}
|
|
||||||
.btn-ghost {
|
.btn-ghost {
|
||||||
background: rgba(255, 255, 255, 0.07);
|
background: rgba(255, 255, 255, 0.07);
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
.btn-ghost:active {
|
.btn-ghost:active { background: rgba(255, 255, 255, 0.12); }
|
||||||
background: rgba(255, 255, 255, 0.12);
|
|
||||||
}
|
|
||||||
.btn-green {
|
.btn-green {
|
||||||
background: rgba(34, 197, 94, 0.1);
|
background: rgba(34, 197, 94, 0.1);
|
||||||
color: var(--green);
|
color: var(--green);
|
||||||
border: 1px solid rgba(34, 197, 94, 0.2);
|
border: 1px solid rgba(34, 197, 94, 0.2);
|
||||||
}
|
}
|
||||||
.btn-green:active {
|
.btn-green:active { background: rgba(34, 197, 94, 0.2); }
|
||||||
background: rgba(34, 197, 94, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Usecase chip at top of app */
|
/* Usecase chip at top of app */
|
||||||
.uc-chip {
|
.uc-chip {
|
||||||
@@ -837,7 +942,6 @@
|
|||||||
|
|
||||||
// ── Screen transitions ─────────────────────────────────────
|
// ── Screen transitions ─────────────────────────────────────
|
||||||
function show(id) {
|
function show(id) {
|
||||||
// Update background overlay style
|
|
||||||
const overlay = document.getElementById('shared-bg-overlay');
|
const overlay = document.getElementById('shared-bg-overlay');
|
||||||
overlay.className =
|
overlay.className =
|
||||||
'for-' +
|
'for-' +
|
||||||
@@ -866,7 +970,6 @@
|
|||||||
|
|
||||||
// ── Init ──────────────────────────────────────────────────
|
// ── Init ──────────────────────────────────────────────────
|
||||||
async function init() {
|
async function init() {
|
||||||
// Load splash image and keep it as shared background
|
|
||||||
const splashR = await fetchJSON('/api/pwa/splash_image').catch(
|
const splashR = await fetchJSON('/api/pwa/splash_image').catch(
|
||||||
() => null,
|
() => null,
|
||||||
);
|
);
|
||||||
@@ -879,7 +982,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load app info
|
|
||||||
const info = await fetchJSON('/api/pwa/app_name').catch(() => null);
|
const info = await fetchJSON('/api/pwa/app_name').catch(() => null);
|
||||||
if (info) {
|
if (info) {
|
||||||
appInfo = info;
|
appInfo = info;
|
||||||
@@ -893,7 +995,6 @@
|
|||||||
settingsName.toUpperCase();
|
settingsName.toUpperCase();
|
||||||
document.getElementById('splashSub').textContent =
|
document.getElementById('splashSub').textContent =
|
||||||
`${(info.usecases || []).length} USECASE(S)`;
|
`${(info.usecases || []).length} USECASE(S)`;
|
||||||
// Apply saved background appearance
|
|
||||||
applyBgSettings(
|
applyBgSettings(
|
||||||
info.pwa_bg_blur !== undefined ? info.pwa_bg_blur : 18,
|
info.pwa_bg_blur !== undefined ? info.pwa_bg_blur : 18,
|
||||||
info.pwa_bg_opacity !== undefined ? info.pwa_bg_opacity : 0.72,
|
info.pwa_bg_opacity !== undefined ? info.pwa_bg_opacity : 0.72,
|
||||||
@@ -904,7 +1005,93 @@
|
|||||||
startOverlayPoll();
|
startOverlayPoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Selector list ─────────────────────────────────────────
|
// ── Tree builder ──────────────────────────────────────────
|
||||||
|
const SEP = /\s*(?:\/|>|\u203a)\s*/;
|
||||||
|
let _treeGid = 0;
|
||||||
|
|
||||||
|
function insertIntoTree(node, parts, uc) {
|
||||||
|
if (!parts.length) {
|
||||||
|
node._items.push(uc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const k = parts[0];
|
||||||
|
if (!node[k]) node[k] = { _items: [] };
|
||||||
|
insertIntoTree(node[k], parts.slice(1), uc);
|
||||||
|
}
|
||||||
|
|
||||||
|
function countLeaves(node) {
|
||||||
|
let n = (node._items || []).length;
|
||||||
|
Object.keys(node)
|
||||||
|
.filter((k) => k !== '_items')
|
||||||
|
.forEach((k) => (n += countLeaves(node[k])));
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
function leafHtml(uc, depth) {
|
||||||
|
const indent = Array.from(
|
||||||
|
{ length: depth },
|
||||||
|
() => '<span class="tree-guide"></span>',
|
||||||
|
).join('');
|
||||||
|
const chips = (uc.blocks || [])
|
||||||
|
.slice(0, 3)
|
||||||
|
.map((bid) => {
|
||||||
|
const b = allBlocks.find((x) => x.id === bid);
|
||||||
|
return b ? `<span class="tree-leaf-chip">${b.icon} ${b.name}</span>` : '';
|
||||||
|
})
|
||||||
|
.join('');
|
||||||
|
const isActive = uc.id === activeUCId;
|
||||||
|
const rightEl = isActive
|
||||||
|
? '<span class="tree-leaf-active-tag">Active</span>'
|
||||||
|
: '<span class="tree-leaf-arrow">›</span>';
|
||||||
|
return `<div class="tree-leaf${isActive ? ' active-uc' : ''}" style="--uc-color:${uc.color}" onclick="pickUC('${uc.id}','${uc.color}')">
|
||||||
|
<div class="tree-indent">${indent}</div>
|
||||||
|
<div class="tree-leaf-inner">
|
||||||
|
<div class="tree-leaf-color"></div>
|
||||||
|
<span class="tree-leaf-name">${escHtml(uc.name)}</span>
|
||||||
|
<div class="tree-leaf-chips">${chips}</div>
|
||||||
|
${rightEl}
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderNode(node, depth) {
|
||||||
|
let html = '';
|
||||||
|
(node._items || []).forEach((uc) => {
|
||||||
|
html += leafHtml(uc, depth);
|
||||||
|
});
|
||||||
|
Object.keys(node)
|
||||||
|
.filter((k) => k !== '_items')
|
||||||
|
.forEach((key) => {
|
||||||
|
const child = node[key];
|
||||||
|
const id = 'tg-' + ++_treeGid;
|
||||||
|
const count = countLeaves(child);
|
||||||
|
const indent = Array.from(
|
||||||
|
{ length: depth },
|
||||||
|
() => '<span class="tree-guide"></span>',
|
||||||
|
).join('');
|
||||||
|
html += `<div class="tree-folder">
|
||||||
|
<div class="tree-folder-hdr" onclick="toggleGroup('${id}')">
|
||||||
|
<div class="tree-indent">${indent}</div>
|
||||||
|
<span class="tree-arrow open" id="arr-${id}">▶</span>
|
||||||
|
<span class="tree-folder-icon">📁</span>
|
||||||
|
<span class="tree-folder-label">${escHtml(key)}</span>
|
||||||
|
<span class="tree-folder-count">${count}</span>
|
||||||
|
</div>
|
||||||
|
<div class="tree-children" id="${id}">${renderNode(child, depth + 1)}</div>
|
||||||
|
</div>`;
|
||||||
|
});
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleGroup(id) {
|
||||||
|
const body = document.getElementById(id);
|
||||||
|
const arr = document.getElementById('arr-' + id);
|
||||||
|
if (!body) return;
|
||||||
|
const collapsed = body.classList.toggle('collapsed');
|
||||||
|
if (arr) arr.classList.toggle('open', !collapsed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Selector list (tree view) ─────────────────────────────
|
||||||
async function loadSelectorList() {
|
async function loadSelectorList() {
|
||||||
const r = await fetchJSON('/api/pwa/app_name').catch(() => null);
|
const r = await fetchJSON('/api/pwa/app_name').catch(() => null);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
@@ -921,31 +1108,29 @@
|
|||||||
allBlocks = r.blocks || [];
|
allBlocks = r.blocks || [];
|
||||||
const usecases = r.usecases || [];
|
const usecases = r.usecases || [];
|
||||||
|
|
||||||
document.getElementById('ucList').innerHTML = usecases.length
|
if (!usecases.length) {
|
||||||
? usecases
|
document.getElementById('ucList').innerHTML =
|
||||||
.map((uc) => {
|
'<p style="color:rgba(255,255,255,.3);padding:20px;text-align:center">No usecases yet.<br>Create them in the desktop UI.</p>';
|
||||||
const isActive = uc.id === activeUCId;
|
return;
|
||||||
const blockIcons = (uc.blocks || [])
|
}
|
||||||
.map((bid) => {
|
|
||||||
const b = allBlocks.find((x) => x.id === bid);
|
// Build tree
|
||||||
return b ? b.icon : '';
|
_treeGid = 0;
|
||||||
})
|
const tree = { _items: [] };
|
||||||
.join(' ');
|
usecases.forEach((uc) => {
|
||||||
return `<div class="uc-item ${isActive ? 'active' : ''}" style="--uc-color:${uc.color}" onclick="pickUC('${uc.id}','${uc.color}')">
|
const path = (uc.group || '').trim();
|
||||||
<div class="uc-dot" style="background:${uc.color}">${uc.name[0]}</div>
|
if (!path) {
|
||||||
<div class="uc-info">
|
tree._items.push(uc);
|
||||||
<div class="uc-name-big">${escHtml(uc.name)}</div>
|
return;
|
||||||
<div class="uc-blocks-sm">${blockIcons}</div>
|
}
|
||||||
</div>
|
insertIntoTree(tree, path.split(SEP).filter(Boolean), uc);
|
||||||
${isActive ? '<span class="uc-active-tag">Active</span>' : '<span class="uc-arrow">›</span>'}
|
});
|
||||||
</div>`;
|
|
||||||
})
|
document.getElementById('ucList').innerHTML =
|
||||||
.join('')
|
`<div class="tree-root">${renderNode(tree, 0)}</div>`;
|
||||||
: '<p style="color:rgba(255,255,255,.3);padding:20px;text-align:center">No usecases yet.<br>Create them in the desktop UI.</p>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function pickUC(id, color) {
|
async function pickUC(id, color) {
|
||||||
// Activate on server
|
|
||||||
await postJSON('/api/pwa/activate_usecase', { usecase_id: id }).catch(
|
await postJSON('/api/pwa/activate_usecase', { usecase_id: id }).catch(
|
||||||
() => null,
|
() => null,
|
||||||
);
|
);
|
||||||
@@ -992,7 +1177,6 @@
|
|||||||
: 0;
|
: 0;
|
||||||
document.getElementById('a-next').textContent =
|
document.getElementById('a-next').textContent =
|
||||||
next > 0 ? `${Math.floor(next / 60)}m ${next % 60}s` : '—';
|
next > 0 ? `${Math.floor(next / 60)}m ${next % 60}s` : '—';
|
||||||
// Overlay must vanish immediately when paused
|
|
||||||
if (paused && _overlayActive) hideOverlay();
|
if (paused && _overlayActive) hideOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,7 +1311,6 @@
|
|||||||
el.classList.add('visible');
|
el.classList.add('visible');
|
||||||
_overlayActive = true;
|
_overlayActive = true;
|
||||||
}
|
}
|
||||||
// Auto-dismiss after remaining_ms (keep in sync with desktop)
|
|
||||||
clearTimeout(_overlayDismissTimer);
|
clearTimeout(_overlayDismissTimer);
|
||||||
if (r.remaining_ms > 0) {
|
if (r.remaining_ms > 0) {
|
||||||
_overlayDismissTimer = setTimeout(hideOverlay, r.remaining_ms);
|
_overlayDismissTimer = setTimeout(hideOverlay, r.remaining_ms);
|
||||||
@@ -1142,7 +1325,6 @@
|
|||||||
_overlayActive = false;
|
_overlayActive = false;
|
||||||
const el = document.getElementById('pwa-overlay');
|
const el = document.getElementById('pwa-overlay');
|
||||||
el.classList.remove('visible');
|
el.classList.remove('visible');
|
||||||
// Clear src after transition so old image doesn't flash
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!_overlayActive)
|
if (!_overlayActive)
|
||||||
document.getElementById('pwa-overlay-img').src = '';
|
document.getElementById('pwa-overlay-img').src = '';
|
||||||
@@ -1156,7 +1338,6 @@
|
|||||||
function applyBgSettings(blur, opac) {
|
function applyBgSettings(blur, opac) {
|
||||||
_bgBlur = blur;
|
_bgBlur = blur;
|
||||||
_bgOpac = opac;
|
_bgOpac = opac;
|
||||||
// Rebuild the dynamic CSS classes for selector and app
|
|
||||||
let styleEl = document.getElementById('bg-dynamic-style');
|
let styleEl = document.getElementById('bg-dynamic-style');
|
||||||
if (!styleEl) {
|
if (!styleEl) {
|
||||||
styleEl = document.createElement('style');
|
styleEl = document.createElement('style');
|
||||||
@@ -1164,16 +1345,15 @@
|
|||||||
document.head.appendChild(styleEl);
|
document.head.appendChild(styleEl);
|
||||||
}
|
}
|
||||||
styleEl.textContent = `
|
styleEl.textContent = `
|
||||||
#shared-bg-overlay.for-selector {
|
#shared-bg-overlay.for-selector {
|
||||||
background: rgba(8,8,10,${opac}) !important;
|
background: rgba(8,8,10,${opac}) !important;
|
||||||
backdrop-filter: blur(${blur}px) saturate(.7) !important;
|
backdrop-filter: blur(${blur}px) saturate(.7) !important;
|
||||||
-webkit-backdrop-filter: blur(${blur}px) saturate(.7) !important;
|
-webkit-backdrop-filter: blur(${blur}px) saturate(.7) !important;
|
||||||
}
|
}
|
||||||
#shared-bg-overlay.for-app {
|
#shared-bg-overlay.for-app {
|
||||||
background: rgba(8,8,10,${Math.min(opac + 0.16, 0.97)}) !important;
|
background: rgba(8,8,10,${Math.min(opac + 0.16, 0.97)}) !important;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
// Sync slider UI
|
|
||||||
document.getElementById('blurSlider').value = blur;
|
document.getElementById('blurSlider').value = blur;
|
||||||
document.getElementById('opacSlider').value = Math.round(opac * 100);
|
document.getElementById('opacSlider').value = Math.round(opac * 100);
|
||||||
document.getElementById('blurVal').textContent = blur + 'px';
|
document.getElementById('blurVal').textContent = blur + 'px';
|
||||||
|
|||||||
@@ -12,4 +12,4 @@
|
|||||||
{ "src": "icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable" },
|
{ "src": "icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any maskable" },
|
||||||
{ "src": "icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
|
{ "src": "icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user