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