diff --git a/static/adwright.js b/static/adwright.js index 60d44d8..1eed445 100644 --- a/static/adwright.js +++ b/static/adwright.js @@ -337,17 +337,20 @@ function _renderCycles() { const pane = _pane("cycles"); if (!pane) return; - const cycles = NS.state.data.cycles || []; + const cycles = NS.state.data.cycles; // null = never fetched, [] = fetched empty + const emptyMsg = cycles === null + ? 'No cycles loaded. Click Refresh cycles.' + : '0 cycles in Adwright. Create a cycle via CMO chat to dispatch ads.'; pane.innerHTML = '
' + '
Cycles
' + '' + '
' + - (cycles.length + ((cycles && cycles.length) ? ('
' + cycles.map((c) => _cycleRow(c)).join("") + '
') - : '
No cycles loaded. Click Refresh cycles.
'); + : '
' + emptyMsg + '
'); _rewireActions(pane); pane.querySelectorAll("[data-svrnty-aw-cycle]").forEach((row) => { row.addEventListener("click", () => { @@ -404,15 +407,19 @@ function _renderAudience() { const pane = _pane("audience"); if (!pane) return; - const segs = NS.state.data.segments || []; + const segs = NS.state.data.segments; // null = never fetched, [] = fetched empty + const segList = segs || []; + const emptyMsg = segs === null + ? 'No segments loaded. Click Refresh.' + : '0 segments in Adwright. Define segments via CMO chat (e.g., "add segment vegan-31-50").'; pane.innerHTML = '
' + '
Audience segments
' + '' + '
' + - (segs.length + (segList.length ? '
' + - segs.map((s) => + segList.map((s) => '
' + '
' + '
' + _esc(s.name || s.id) + '
' + @@ -422,7 +429,7 @@ '
' ).join("") + '
' - : '
No segments loaded. Click Refresh.
'); + : '
' + emptyMsg + '
'); _rewireActions(pane); _refreshDisabledState(); } @@ -468,15 +475,19 @@ function _renderConnections() { const pane = _pane("connections"); if (!pane) return; - const conns = NS.state.data.connections || []; + const conns = NS.state.data.connections; // null = never fetched, [] = fetched empty + const connList = conns || []; + const emptyConnMsg = conns === null + ? 'No status loaded. Click Re-check.' + : '0 connections configured. Provision Meta + Woo credentials below.'; pane.innerHTML = '
' + '
Connections
' + '' + '
' + '
' + - (conns.length ? conns.map(_connRow).join("") : - '
No status loaded. Click Re-check.
') + + (connList.length ? connList.map(_connRow).join("") : + '
' + emptyConnMsg + '
') + '
' + '' + '
' +