blob: 96244ea18fc2d8b2233993ddac1ef6036df800a2 [file] [log] [blame]
Philip Zeyliger99a9a022025-04-27 15:15:25 +00001import { css, html, LitElement } from "lit";
2import { customElement, property } from "lit/decorators.js";
3
4@customElement("sketch-call-status")
5export class SketchCallStatus extends LitElement {
6 @property({ type: Number })
7 llmCalls: number = 0;
8
9 @property({ type: Array })
10 toolCalls: string[] = [];
11
12 static styles = css`
13 .call-status-container {
14 display: flex;
15 align-items: center;
16 gap: 10px;
17 padding: 0 10px;
18 }
19
20 .indicator {
21 display: flex;
22 align-items: center;
23 gap: 4px;
24 position: relative;
25 }
26
27 .llm-indicator {
28 opacity: 0.5;
29 }
30
31 .llm-indicator.active {
32 opacity: 1;
33 color: #ffc107;
34 }
35
36 .tool-indicator {
37 opacity: 0.5;
38 }
39
40 .tool-indicator.active {
41 opacity: 1;
42 color: #2196f3;
43 }
44
45 .count-badge {
46 position: absolute;
47 top: -8px;
48 right: -8px;
49 background-color: #f44336;
50 color: white;
51 border-radius: 50%;
52 width: 16px;
53 height: 16px;
54 font-size: 11px;
55 display: flex;
56 align-items: center;
57 justify-content: center;
58 }
59
60 /* Icon styles */
61 .icon {
62 font-size: 20px;
63 }
64 `;
65
66 constructor() {
67 super();
68 }
69
70 render() {
71 return html`
72 <div class="call-status-container">
73 <div
74 class="indicator llm-indicator ${this.llmCalls > 0 ? "active" : ""}"
75 title="${this.llmCalls > 0
76 ? `${this.llmCalls} LLM ${this.llmCalls === 1 ? "call" : "calls"} in progress`
77 : "No LLM calls in progress"}"
78 >
79 <span class="icon">💡</span>
80 ${this.llmCalls >= 1
81 ? html`<span class="count-badge">${this.llmCalls}</span>`
82 : ""}
83 </div>
84 <div
85 class="indicator tool-indicator ${this.toolCalls.length > 0
86 ? "active"
87 : ""}"
88 title="${this.toolCalls.length > 0
89 ? `${this.toolCalls.length} tool ${this.toolCalls.length === 1 ? "call" : "calls"} in progress: ${this.toolCalls.join(", ")}`
90 : "No tool calls in progress"}"
91 >
92 <span class="icon">🔧</span>
93 ${this.toolCalls.length >= 1
94 ? html`<span class="count-badge">${this.toolCalls.length}</span>`
95 : ""}
96 </div>
97 </div>
98 `;
99 }
100}
101
102declare global {
103 interface HTMLElementTagNameMap {
104 "sketch-call-status": SketchCallStatus;
105 }
106}