DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
Raw History Blame Contribute Delete
2.18 kB
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>Multi Block Prompt Fixture</title>
<style>
:root { --sidebar-width: 240px; --content-max-width: 900px; }
body { margin: 0; font-family: Arial, sans-serif; }
.app { display: flex; min-height: 100vh; }
[data-testid="sidebar"] { width: 240px; padding: 16px; background: #1f2937; color: white; overflow-y: auto; }
[data-testid="content"] { width: 900px; max-width: 100%; margin: 0 auto; padding: 24px; }
[data-testid="prompt-response-block"] { border: 1px solid #bbb; padding: 12px; margin-bottom: 12px; }
textarea { width: 100%; min-height: 56px; }
</style>
</head>
<body>
<div class="app">
<aside data-testid="sidebar"><h2>Blocks</h2><ol data-testid="sidebar-list"><li>block-1 idle</li></ol></aside>
<main data-testid="content">
<section data-testid="blocks">
<article data-testid="prompt-response-block" data-block-id="block-1">
<textarea data-testid="prompt-input" placeholder="Prompt"></textarea>
<button data-testid="send-button">Send</button>
<output data-testid="response">not sent</output>
</article>
</section>
<button data-testid="new-block-placeholder">New block</button>
</main>
</div>
<script>
window.BlockManager = null;
const blocks = document.querySelector('[data-testid="blocks"]');
document.querySelector('[data-testid="new-block-placeholder"]').addEventListener('click', () => {
blocks.insertAdjacentHTML('beforeend', '<article data-testid="prompt-response-block" data-block-id="block-2"><textarea data-testid="prompt-input" placeholder="Prompt"></textarea><button data-testid="send-button">Send</button><output data-testid="response">not sent</output></article>');
});
document.addEventListener('click', event => {
if (event.target.matches('[data-testid="send-button"]')) {
const block = event.target.closest('[data-testid="prompt-response-block"]');
block.querySelector('[data-testid="response"]').textContent = 'shared response';
}
});
</script>
</body>
</html>