()
| 1107 | |
| 1108 | let step = 0; |
| 1109 | function next() { |
| 1110 | if (step >= PLAYGROUND_TURNS.length) { |
| 1111 | // reset |
| 1112 | step = 0; |
| 1113 | body.innerHTML = ""; |
| 1114 | counter.textContent = "0/" + PLAYGROUND_TURNS.length; |
| 1115 | advance.textContent = "▶ Send the first prompt"; |
| 1116 | return; |
| 1117 | } |
| 1118 | const node = renderTurn(PLAYGROUND_TURNS[step]); |
| 1119 | node.classList.add("lc-fade-in"); |
| 1120 | body.appendChild(node); |
| 1121 | body.scrollTop = body.scrollHeight; |
| 1122 | step += 1; |
| 1123 | counter.textContent = step + "/" + PLAYGROUND_TURNS.length; |
| 1124 | advance.textContent = step >= PLAYGROUND_TURNS.length ? "↺ Replay" : "→ Next turn"; |
| 1125 | } |
| 1126 | advance.addEventListener("click", next); |
| 1127 | } |
| 1128 |
no test coverage detected