| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <title>sketch-timeline-message demo</title> |
| 4 | <link rel="stylesheet" href="demo.css" /> |
| Pokey Rule | e2a8c2f | 2025-04-23 15:09:25 +0100 | [diff] [blame] | 5 | <script type="module" src="../sketch-timeline-message.ts" |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 6 | ></script> |
| 7 | |
| 8 | <script> |
| 9 | const messages = [ |
| 10 | { |
| 11 | type: "agent", |
| 12 | content: "an agent message", |
| 13 | }, |
| 14 | { |
| 15 | type: "user", |
| 16 | content: "a user message", |
| 17 | }, |
| 18 | { |
| 19 | type: "tool", |
| 20 | content: "a tool use message", |
| 21 | }, |
| 22 | { |
| 23 | type: "commit", |
| 24 | end_of_turn: false, |
| 25 | content: "", |
| 26 | commits: [ |
| 27 | { |
| 28 | hash: "ece101c103ec231da87f4df05c1b5e6a24e13add", |
| 29 | subject: "Add README.md for web components directory", |
| 30 | body: "This adds documentation for the web components used in the Loop UI,\nincluding a description of each component, usage examples, and\ndevelopment guidelines.\n\nCo-Authored-By: sketch\nadd README.md for loop/webui/src/web-components", |
| 31 | pushed_branch: |
| 32 | "sketch/create-readmemd-for-web-components-directory", |
| 33 | }, |
| 34 | ], |
| 35 | timestamp: "2025-04-14T16:39:33.639533919Z", |
| 36 | conversation_id: "", |
| 37 | idx: 17, |
| 38 | }, |
| 39 | { |
| 40 | type: "agent", |
| 41 | content: "an end-of-turn agent message", |
| 42 | end_of_turn: true, |
| 43 | }, |
| 44 | ]; |
| 45 | document.addEventListener("DOMContentLoaded", () => { |
| 46 | messages.forEach((msg, idx) => { |
| 47 | const jsonEl = document.createElement("pre"); |
| 48 | jsonEl.innerText = `.message property: ${JSON.stringify(msg)}`; |
| 49 | document.body.append(jsonEl); |
| 50 | const messageEl = document.createElement("sketch-timeline-message"); |
| 51 | messageEl.message = msg; |
| 52 | document.body.appendChild(messageEl); |
| 53 | }); |
| Sean McCullough | 71941bd | 2025-04-18 13:31:48 -0700 | [diff] [blame] | 54 | window.addEventListener("show-commit-diff", (evt) => { |
| 55 | console.log("show-commit-diff", evt); |
| 56 | }); |
| Sean McCullough | 86b5686 | 2025-04-18 13:04:03 -0700 | [diff] [blame] | 57 | }); |
| 58 | </script> |
| 59 | </head> |
| 60 | <body> |
| 61 | <h1>sketch-timeline-message demo</h1> |
| 62 | </body> |
| 63 | </html> |