| Pokey Rule | ef58e06 | 2025-05-07 13:32:58 +0100 | [diff] [blame] | 1 | import { LitElement, css, html } from "lit"; |
| 2 | import { customElement, property } from "lit/decorators.js"; |
| 3 | import { ToolCall } from "../types"; |
| 4 | |
| Pokey Rule | ef58e06 | 2025-05-07 13:32:58 +0100 | [diff] [blame] | 5 | @customElement("sketch-tool-card-title") |
| 6 | export class SketchToolCardTitle extends LitElement { |
| 7 | @property() toolCall: ToolCall; |
| 8 | @property() open: boolean; |
| 9 | |
| 10 | static styles = css` |
| 11 | .summary-text { |
| 12 | font-style: italic; |
| 13 | } |
| 14 | pre { |
| 15 | display: inline; |
| 16 | font-family: monospace; |
| 17 | background: rgb(236, 236, 236); |
| 18 | padding: 2px 4px; |
| 19 | border-radius: 2px; |
| 20 | margin: 0; |
| 21 | } |
| 22 | `; |
| 23 | |
| 24 | render() { |
| 25 | const inputData = JSON.parse(this.toolCall?.input || "{}"); |
| 26 | return html` |
| 27 | <sketch-tool-card .open=${this.open} .toolCall=${this.toolCall}> |
| 28 | <span slot="summary" class="summary-text"> |
| 29 | Title: "${inputData.title}" | Branch: sketch/${inputData.branch_name} |
| 30 | </span> |
| 31 | <div slot="input"> |
| 32 | <div>Set title to: <b>${inputData.title}</b></div> |
| 33 | <div>Set branch to: <code>sketch/${inputData.branch_name}</code></div> |
| 34 | </div> |
| 35 | </sketch-tool-card> |
| 36 | `; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | declare global { |
| 41 | interface HTMLElementTagNameMap { |
| 42 | "sketch-tool-card-title": SketchToolCardTitle; |
| 43 | } |
| 44 | } |