| banksean | d52d39d | 2025-07-20 14:57:38 -0700 | [diff] [blame^] | 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ |
| 2 | import { DemoModule } from "./demo-framework/types"; |
| 3 | import { demoUtils } from "./demo-fixtures/index"; |
| 4 | |
| 5 | const demo: DemoModule = { |
| 6 | title: "Sketch Network Status Demo", |
| 7 | description: |
| 8 | "Status indicators showing different connection and activity states", |
| 9 | imports: ["../sketch-network-status.ts", "../sketch-call-status.ts"], |
| 10 | |
| 11 | customStyles: ` |
| 12 | .status-container { |
| 13 | margin: 20px 0; |
| 14 | padding: 10px; |
| 15 | border: 1px solid #ccc; |
| 16 | border-radius: 4px; |
| 17 | } |
| 18 | .label { |
| 19 | font-weight: bold; |
| 20 | margin-bottom: 5px; |
| 21 | } |
| 22 | `, |
| 23 | |
| 24 | setup: async (container: HTMLElement) => { |
| 25 | const section = demoUtils.createDemoSection( |
| 26 | "Status Indicators", |
| 27 | "Demonstrates different connection and activity states using sketch-call-status component", |
| 28 | ); |
| 29 | |
| 30 | // Connected State |
| 31 | const connectedContainer = document.createElement("div"); |
| 32 | connectedContainer.className = "status-container"; |
| 33 | |
| 34 | const connectedLabel = document.createElement("div"); |
| 35 | connectedLabel.className = "label"; |
| 36 | connectedLabel.textContent = "Connected State:"; |
| 37 | |
| 38 | const connectedStatus = document.createElement("sketch-call-status") as any; |
| 39 | connectedStatus.isDisconnected = false; |
| 40 | connectedStatus.isIdle = true; |
| 41 | connectedStatus.llmCalls = 0; |
| 42 | connectedStatus.toolCalls = []; |
| 43 | |
| 44 | connectedContainer.appendChild(connectedLabel); |
| 45 | connectedContainer.appendChild(connectedStatus); |
| 46 | |
| 47 | // Working State |
| 48 | const workingContainer = document.createElement("div"); |
| 49 | workingContainer.className = "status-container"; |
| 50 | |
| 51 | const workingLabel = document.createElement("div"); |
| 52 | workingLabel.className = "label"; |
| 53 | workingLabel.textContent = "Working State:"; |
| 54 | |
| 55 | const workingStatus = document.createElement("sketch-call-status") as any; |
| 56 | workingStatus.isDisconnected = false; |
| 57 | workingStatus.isIdle = false; |
| 58 | workingStatus.llmCalls = 1; |
| 59 | workingStatus.toolCalls = ["bash"]; |
| 60 | |
| 61 | workingContainer.appendChild(workingLabel); |
| 62 | workingContainer.appendChild(workingStatus); |
| 63 | |
| 64 | // Disconnected State |
| 65 | const disconnectedContainer = document.createElement("div"); |
| 66 | disconnectedContainer.className = "status-container"; |
| 67 | |
| 68 | const disconnectedLabel = document.createElement("div"); |
| 69 | disconnectedLabel.className = "label"; |
| 70 | disconnectedLabel.textContent = "Disconnected State:"; |
| 71 | |
| 72 | const disconnectedStatus = document.createElement( |
| 73 | "sketch-call-status", |
| 74 | ) as any; |
| 75 | disconnectedStatus.isDisconnected = true; |
| 76 | disconnectedStatus.isIdle = true; |
| 77 | disconnectedStatus.llmCalls = 0; |
| 78 | disconnectedStatus.toolCalls = []; |
| 79 | |
| 80 | disconnectedContainer.appendChild(disconnectedLabel); |
| 81 | disconnectedContainer.appendChild(disconnectedStatus); |
| 82 | |
| 83 | // Add all containers to section |
| 84 | section.appendChild(connectedContainer); |
| 85 | section.appendChild(workingContainer); |
| 86 | section.appendChild(disconnectedContainer); |
| 87 | container.appendChild(section); |
| 88 | }, |
| 89 | }; |
| 90 | |
| 91 | export default demo; |