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