Skip to content

Commit 4505987

Browse files
committed
style(ui): format control views
1 parent eb6a3fc commit 4505987

40 files changed

Lines changed: 2681 additions & 3345 deletions

‎ui/src/ui/app-render.helpers.ts‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ function renderCronFilterIcon(hiddenCount: number) {
109109
<circle cx="12" cy="12" r="10"></circle>
110110
<polyline points="12 6 12 12 16 14"></polyline>
111111
</svg>
112-
${
113-
hiddenCount > 0
114-
? html`<span
112+
${hiddenCount > 0
113+
? html`<span
115114
style="
116115
position: absolute;
117116
top: -5px;
@@ -126,8 +125,7 @@ function renderCronFilterIcon(hiddenCount: number) {
126125
"
127126
>${hiddenCount}</span
128127
>`
129-
: ""
130-
}
128+
: ""}
131129
</span>
132130
`;
133131
}
@@ -313,13 +311,11 @@ export function renderChatControls(state: AppViewState) {
313311
state.sessionsHideCron = !hideCron;
314312
}}
315313
aria-pressed=${hideCron}
316-
title=${
317-
hideCron
318-
? hiddenCronCount > 0
319-
? t("chat.showCronSessionsHidden", { count: String(hiddenCronCount) })
320-
: t("chat.showCronSessions")
321-
: t("chat.hideCronSessions")
322-
}
314+
title=${hideCron
315+
? hiddenCronCount > 0
316+
? t("chat.showCronSessionsHidden", { count: String(hiddenCronCount) })
317+
: t("chat.showCronSessions")
318+
: t("chat.hideCronSessions")}
323319
>
324320
${renderCronFilterIcon(hiddenCronCount)}
325321
</button>
@@ -945,9 +941,9 @@ export function renderTopbarThemeModeToggle(state: AppViewState) {
945941
(opt) => html`
946942
<button
947943
type="button"
948-
class="topbar-theme-mode__btn ${
949-
opt.id === state.themeMode ? "topbar-theme-mode__btn--active" : ""
950-
}"
944+
class="topbar-theme-mode__btn ${opt.id === state.themeMode
945+
? "topbar-theme-mode__btn--active"
946+
: ""}"
951947
title=${opt.label}
952948
aria-label="Color mode: ${opt.label}"
953949
aria-pressed=${opt.id === state.themeMode}

‎ui/src/ui/app-render.ts‎

Lines changed: 1334 additions & 1395 deletions
Large diffs are not rendered by default.

‎ui/src/ui/chat/grouped-render.ts‎

Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,9 @@ export function renderMessageGroup(
177177
<span class="chat-group-timestamp">${timestamp}</span>
178178
${renderMessageMeta(meta)}
179179
${normalizedRole === "assistant" && isTtsSupported() ? renderTtsButton(group) : nothing}
180-
${
181-
opts.onDelete
182-
? renderDeleteButton(opts.onDelete, normalizedRole === "user" ? "left" : "right")
183-
: nothing
184-
}
180+
${opts.onDelete
181+
? renderDeleteButton(opts.onDelete, normalizedRole === "user" ? "left" : "right")
182+
: nothing}
185183
</div>
186184
</div>
187185
</div>
@@ -697,84 +695,70 @@ function renderGroupedMessage(
697695

698696
return html`
699697
<div class="${bubbleClasses}">
700-
${
701-
hasActions
702-
? html`<div class="chat-bubble-actions">
698+
${hasActions
699+
? html`<div class="chat-bubble-actions">
703700
${canExpand ? renderExpandButton(markdown!, onOpenSidebar!) : nothing}
704701
${canCopyMarkdown ? renderCopyAsMarkdownButton(markdown!) : nothing}
705702
</div>`
706-
: nothing
707-
}
708-
${
709-
isToolMessage
710-
? html`
703+
: nothing}
704+
${isToolMessage
705+
? html`
711706
<details class="chat-tool-msg-collapse">
712707
<summary class="chat-tool-msg-summary">
713708
<span class="chat-tool-msg-summary__icon">${icons.zap}</span>
714709
<span class="chat-tool-msg-summary__label">Tool output</span>
715-
${
716-
toolSummaryLabel
717-
? html`<span class="chat-tool-msg-summary__names">${toolSummaryLabel}</span>`
718-
: toolPreview
719-
? html`<span class="chat-tool-msg-summary__preview">${toolPreview}</span>`
720-
: nothing
721-
}
710+
${toolSummaryLabel
711+
? html`<span class="chat-tool-msg-summary__names">${toolSummaryLabel}</span>`
712+
: toolPreview
713+
? html`<span class="chat-tool-msg-summary__preview">${toolPreview}</span>`
714+
: nothing}
722715
</summary>
723716
<div class="chat-tool-msg-body">
724717
${renderMessageImages(images)}
725-
${
726-
reasoningMarkdown
727-
? html`<div class="chat-thinking">
718+
${reasoningMarkdown
719+
? html`<div class="chat-thinking">
728720
${unsafeHTML(toSanitizedMarkdownHtml(reasoningMarkdown))}
729721
</div>`
730-
: nothing
731-
}
732-
${
733-
jsonResult
734-
? html`<details class="chat-json-collapse">
722+
: nothing}
723+
${jsonResult
724+
? html`<details class="chat-json-collapse">
735725
<summary class="chat-json-summary">
736726
<span class="chat-json-badge">JSON</span>
737727
<span class="chat-json-label">${jsonSummaryLabel(jsonResult.parsed)}</span>
738728
</summary>
739729
<pre class="chat-json-content"><code>${jsonResult.pretty}</code></pre>
740730
</details>`
741-
: markdown
742-
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
731+
: markdown
732+
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
743733
${unsafeHTML(toSanitizedMarkdownHtml(markdown))}
744734
</div>`
745-
: nothing
746-
}
735+
: nothing}
747736
${hasToolCards ? renderCollapsedToolCards(toolCards, onOpenSidebar) : nothing}
748737
</div>
749738
</details>
750739
`
751-
: html`
740+
: html`
752741
${renderMessageImages(images)}
753-
${
754-
reasoningMarkdown
755-
? html`<div class="chat-thinking">
742+
${reasoningMarkdown
743+
? html`<div class="chat-thinking">
756744
${unsafeHTML(toSanitizedMarkdownHtml(reasoningMarkdown))}
757745
</div>`
758-
: nothing
759-
}
760-
${
761-
jsonResult
762-
? html`<details class="chat-json-collapse">
746+
: nothing}
747+
${jsonResult
748+
? html`<details class="chat-json-collapse">
763749
<summary class="chat-json-summary">
764750
<span class="chat-json-badge">JSON</span>
765751
<span class="chat-json-label">${jsonSummaryLabel(jsonResult.parsed)}</span>
766752
</summary>
767753
<pre class="chat-json-content"><code>${jsonResult.pretty}</code></pre>
768754
</details>`
769-
: markdown
770-
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
755+
: markdown
756+
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
771757
${unsafeHTML(toSanitizedMarkdownHtml(markdown))}
772758
</div>`
773-
: nothing
774-
}
759+
: nothing}
775760
${hasToolCards ? renderCollapsedToolCards(toolCards, onOpenSidebar) : nothing}
776-
`
777-
}
761+
`}
778762
</div>
779763
`;
780764
}

‎ui/src/ui/chat/tool-cards.ts‎

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -81,49 +81,35 @@ export function renderToolCardSidebar(card: ToolCard, onOpenSidebar?: (content:
8181
@click=${handleClick}
8282
role=${canClick ? "button" : nothing}
8383
tabindex=${canClick ? "0" : nothing}
84-
@keydown=${
85-
canClick
86-
? (e: KeyboardEvent) => {
87-
if (e.key !== "Enter" && e.key !== " ") {
88-
return;
89-
}
90-
e.preventDefault();
91-
handleClick?.();
84+
@keydown=${canClick
85+
? (e: KeyboardEvent) => {
86+
if (e.key !== "Enter" && e.key !== " ") {
87+
return;
9288
}
93-
: nothing
94-
}
89+
e.preventDefault();
90+
handleClick?.();
91+
}
92+
: nothing}
9593
>
9694
<div class="chat-tool-card__header">
9795
<div class="chat-tool-card__title">
9896
<span class="chat-tool-card__icon">${icons[display.icon]}</span>
9997
<span>${display.label}</span>
10098
</div>
101-
${
102-
canClick
103-
? html`<span class="chat-tool-card__action"
99+
${canClick
100+
? html`<span class="chat-tool-card__action"
104101
>${hasText ? "View" : ""} ${icons.check}</span
105102
>`
106-
: nothing
107-
}
108-
${
109-
isEmpty && !canClick
110-
? html`<span class="chat-tool-card__status">${icons.check}</span>`
111-
: nothing
112-
}
103+
: nothing}
104+
${isEmpty && !canClick
105+
? html`<span class="chat-tool-card__status">${icons.check}</span>`
106+
: nothing}
113107
</div>
114108
${detail ? html`<div class="chat-tool-card__detail">${detail}</div>` : nothing}
115-
${
116-
isEmpty
117-
? html`
118-
<div class="chat-tool-card__status-text muted">Completed</div>
119-
`
120-
: nothing
121-
}
122-
${
123-
showCollapsed
124-
? html`<div class="chat-tool-card__preview mono">${getTruncatedPreview(card.text!)}</div>`
125-
: nothing
126-
}
109+
${isEmpty ? html` <div class="chat-tool-card__status-text muted">Completed</div> ` : nothing}
110+
${showCollapsed
111+
? html`<div class="chat-tool-card__preview mono">${getTruncatedPreview(card.text!)}</div>`
112+
: nothing}
127113
${showInline ? html`<div class="chat-tool-card__inline mono">${card.text}</div>` : nothing}
128114
</div>
129115
`;

‎ui/src/ui/icons.ts‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ export const icons = {
121121
<path d="m6 6 12 12" />
122122
</svg>
123123
`,
124-
check: html`
125-
<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg>
126-
`,
124+
check: html` <svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg> `,
127125
arrowDown: html`
128126
<svg viewBox="0 0 24 24">
129127
<path d="M12 5v14" />
@@ -144,8 +142,12 @@ export const icons = {
144142
`,
145143
brain: html`
146144
<svg viewBox="0 0 24 24">
147-
<path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z" />
148-
<path d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z" />
145+
<path
146+
d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z"
147+
/>
148+
<path
149+
d="M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z"
150+
/>
149151
<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4" />
150152
<path d="M17.599 6.5a3 3 0 0 0 .399-1.375" />
151153
<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
@@ -236,9 +238,7 @@ export const icons = {
236238
<path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" />
237239
</svg>
238240
`,
239-
circle: html`
240-
<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /></svg>
241-
`,
241+
circle: html` <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /></svg> `,
242242
puzzle: html`
243243
<svg viewBox="0 0 24 24">
244244
<path
@@ -286,9 +286,7 @@ export const icons = {
286286
<path d="M22 2 11 13" />
287287
</svg>
288288
`,
289-
stop: html`
290-
<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="1" /></svg>
291-
`,
289+
stop: html` <svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="1" /></svg> `,
292290
pin: html`
293291
<svg viewBox="0 0 24 24">
294292
<line x1="12" x2="12" y1="17" y2="22" />

‎ui/src/ui/views/agents-panels-overview.ts‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ export function renderAgentOverview(params: {
115115
</div>
116116
</div>
117117
118-
${
119-
configDirty
120-
? html`
121-
<div class="callout warn" style="margin-top: 16px">You have unsaved config changes.</div>
122-
`
123-
: nothing
124-
}
118+
${configDirty
119+
? html`
120+
<div class="callout warn" style="margin-top: 16px">
121+
You have unsaved config changes.
122+
</div>
123+
`
124+
: nothing}
125125
126126
<div class="agent-model-select" style="margin-top: 20px;">
127127
<div class="label">Model Selection</div>
@@ -134,17 +134,13 @@ export function renderAgentOverview(params: {
134134
@change=${(e: Event) =>
135135
onModelChange(agent.id, (e.target as HTMLSelectElement).value || null)}
136136
>
137-
${
138-
isDefault
139-
? html`
140-
<option value="">Not set</option>
141-
`
142-
: html`
137+
${isDefault
138+
? html` <option value="">Not set</option> `
139+
: html`
143140
<option value="">
144141
${defaultPrimary ? `Inherit default (${defaultPrimary})` : "Inherit default"}
145142
</option>
146-
`
147-
}
143+
`}
148144
${buildModelOptions(configForm, effectivePrimary ?? undefined, params.modelCatalog)}
149145
</select>
150146
</label>

0 commit comments

Comments
 (0)