| 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: "Status Indicators Demo", |
| 7 | description: |
| 8 | "Status indicators showing connected, working, and disconnected states without the green connection dot", |
| 9 | imports: ["../sketch-call-status.ts", "../sketch-network-status.ts"], |
| 10 | |
| 11 | customStyles: ` |
| 12 | .demo-container { |
| 13 | display: flex; |
| 14 | flex-direction: column; |
| 15 | gap: 20px; |
| 16 | } |
| 17 | .status-container { |
| 18 | padding: 20px; |
| 19 | border: 1px solid #ccc; |
| 20 | border-radius: 5px; |
| 21 | background-color: #f9f9f9; |
| 22 | } |
| 23 | .label { |
| 24 | font-weight: bold; |
| 25 | margin-bottom: 10px; |
| 26 | font-size: 16px; |
| 27 | } |
| 28 | .status-row { |
| 29 | display: flex; |
| 30 | align-items: center; |
| 31 | gap: 10px; |
| 32 | padding: 10px 0; |
| 33 | border-bottom: 1px solid #eee; |
| 34 | } |
| 35 | .status-item { |
| 36 | min-width: 200px; |
| 37 | } |
| 38 | .status-view { |
| 39 | background-color: white; |
| 40 | border: 1px solid #ddd; |
| 41 | padding: 10px; |
| 42 | border-radius: 4px; |
| 43 | } |
| 44 | .description { |
| 45 | margin-top: 10px; |
| 46 | color: #666; |
| 47 | font-size: 14px; |
| 48 | } |
| 49 | `, |
| 50 | |
| 51 | setup: async (container: HTMLElement) => { |
| 52 | const section = demoUtils.createDemoSection( |
| 53 | "Status Indicators", |
| 54 | "Demonstrates the new status indicators without the green connection dot, showing different connection and activity states.", |
| 55 | ); |
| 56 | |
| 57 | const demoContainer = document.createElement("div"); |
| 58 | demoContainer.className = "demo-container"; |
| 59 | |
| 60 | // Connected States Container |
| 61 | const connectedContainer = document.createElement("div"); |
| 62 | connectedContainer.className = "status-container"; |
| 63 | |
| 64 | const connectedLabel = document.createElement("div"); |
| 65 | connectedLabel.className = "label"; |
| 66 | connectedLabel.textContent = "Connected States:"; |
| 67 | connectedContainer.appendChild(connectedLabel); |
| 68 | |
| 69 | // IDLE State |
| 70 | const idleRow = document.createElement("div"); |
| 71 | idleRow.className = "status-row"; |
| 72 | |
| 73 | const idleItem = document.createElement("div"); |
| 74 | idleItem.className = "status-item"; |
| 75 | idleItem.textContent = "IDLE:"; |
| 76 | |
| 77 | const idleView = document.createElement("div"); |
| 78 | idleView.className = "status-view"; |
| 79 | |
| 80 | const idleStatus = document.createElement("sketch-call-status") as any; |
| 81 | idleStatus.isDisconnected = false; |
| 82 | idleStatus.isIdle = true; |
| 83 | idleStatus.llmCalls = 0; |
| 84 | idleStatus.toolCalls = []; |
| 85 | |
| 86 | const idleDescription = document.createElement("div"); |
| 87 | idleDescription.className = "description"; |
| 88 | idleDescription.textContent = "Agent is connected but not actively working"; |
| 89 | |
| 90 | idleView.appendChild(idleStatus); |
| 91 | idleRow.appendChild(idleItem); |
| 92 | idleRow.appendChild(idleView); |
| 93 | idleRow.appendChild(idleDescription); |
| 94 | connectedContainer.appendChild(idleRow); |
| 95 | |
| 96 | // WORKING State |
| 97 | const workingRow = document.createElement("div"); |
| 98 | workingRow.className = "status-row"; |
| 99 | |
| 100 | const workingItem = document.createElement("div"); |
| 101 | workingItem.className = "status-item"; |
| 102 | workingItem.textContent = "WORKING:"; |
| 103 | |
| 104 | const workingView = document.createElement("div"); |
| 105 | workingView.className = "status-view"; |
| 106 | |
| 107 | const workingStatus = document.createElement("sketch-call-status") as any; |
| 108 | workingStatus.isDisconnected = false; |
| 109 | workingStatus.isIdle = false; |
| 110 | workingStatus.llmCalls = 1; |
| 111 | workingStatus.toolCalls = ["bash"]; |
| 112 | |
| 113 | const workingDescription = document.createElement("div"); |
| 114 | workingDescription.className = "description"; |
| 115 | workingDescription.textContent = "Agent is connected and actively working"; |
| 116 | |
| 117 | workingView.appendChild(workingStatus); |
| 118 | workingRow.appendChild(workingItem); |
| 119 | workingRow.appendChild(workingView); |
| 120 | workingRow.appendChild(workingDescription); |
| 121 | connectedContainer.appendChild(workingRow); |
| 122 | |
| 123 | // Disconnected States Container |
| 124 | const disconnectedContainer = document.createElement("div"); |
| 125 | disconnectedContainer.className = "status-container"; |
| 126 | |
| 127 | const disconnectedLabel = document.createElement("div"); |
| 128 | disconnectedLabel.className = "label"; |
| 129 | disconnectedLabel.textContent = "Disconnected State:"; |
| 130 | disconnectedContainer.appendChild(disconnectedLabel); |
| 131 | |
| 132 | // DISCONNECTED State |
| 133 | const disconnectedRow = document.createElement("div"); |
| 134 | disconnectedRow.className = "status-row"; |
| 135 | |
| 136 | const disconnectedItem = document.createElement("div"); |
| 137 | disconnectedItem.className = "status-item"; |
| 138 | disconnectedItem.textContent = "DISCONNECTED:"; |
| 139 | |
| 140 | const disconnectedView = document.createElement("div"); |
| 141 | disconnectedView.className = "status-view"; |
| 142 | |
| 143 | const disconnectedStatus = document.createElement( |
| 144 | "sketch-call-status", |
| 145 | ) as any; |
| 146 | disconnectedStatus.isDisconnected = true; |
| 147 | disconnectedStatus.isIdle = true; |
| 148 | disconnectedStatus.llmCalls = 0; |
| 149 | disconnectedStatus.toolCalls = []; |
| 150 | |
| 151 | const disconnectedDescription = document.createElement("div"); |
| 152 | disconnectedDescription.className = "description"; |
| 153 | disconnectedDescription.textContent = "Connection lost to the agent"; |
| 154 | |
| 155 | disconnectedView.appendChild(disconnectedStatus); |
| 156 | disconnectedRow.appendChild(disconnectedItem); |
| 157 | disconnectedRow.appendChild(disconnectedView); |
| 158 | disconnectedRow.appendChild(disconnectedDescription); |
| 159 | disconnectedContainer.appendChild(disconnectedRow); |
| 160 | |
| 161 | // Assemble the demo |
| 162 | demoContainer.appendChild(connectedContainer); |
| 163 | demoContainer.appendChild(disconnectedContainer); |
| 164 | section.appendChild(demoContainer); |
| 165 | container.appendChild(section); |
| 166 | }, |
| 167 | }; |
| 168 | |
| 169 | export default demo; |