Skip to content

Commit d35f37a

Browse files
committed
style: format ui views
1 parent 6f75798 commit d35f37a

40 files changed

Lines changed: 3335 additions & 2675 deletions

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ 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-
${hiddenCount > 0
113-
? html`<span
112+
${
113+
hiddenCount > 0
114+
? html`<span
114115
style="
115116
position: absolute;
116117
top: -5px;
@@ -125,7 +126,8 @@ function renderCronFilterIcon(hiddenCount: number) {
125126
"
126127
>${hiddenCount}</span
127128
>`
128-
: ""}
129+
: ""
130+
}
129131
</span>
130132
`;
131133
}
@@ -311,11 +313,13 @@ export function renderChatControls(state: AppViewState) {
311313
state.sessionsHideCron = !hideCron;
312314
}}
313315
aria-pressed=${hideCron}
314-
title=${hideCron
315-
? hiddenCronCount > 0
316-
? t("chat.showCronSessionsHidden", { count: String(hiddenCronCount) })
317-
: t("chat.showCronSessions")
318-
: t("chat.hideCronSessions")}
316+
title=${
317+
hideCron
318+
? hiddenCronCount > 0
319+
? t("chat.showCronSessionsHidden", { count: String(hiddenCronCount) })
320+
: t("chat.showCronSessions")
321+
: t("chat.hideCronSessions")
322+
}
319323
>
320324
${renderCronFilterIcon(hiddenCronCount)}
321325
</button>
@@ -941,9 +945,9 @@ export function renderTopbarThemeModeToggle(state: AppViewState) {
941945
(opt) => html`
942946
<button
943947
type="button"
944-
class="topbar-theme-mode__btn ${opt.id === state.themeMode
945-
? "topbar-theme-mode__btn--active"
946-
: ""}"
948+
class="topbar-theme-mode__btn ${
949+
opt.id === state.themeMode ? "topbar-theme-mode__btn--active" : ""
950+
}"
947951
title=${opt.label}
948952
aria-label="Color mode: ${opt.label}"
949953
aria-pressed=${opt.id === state.themeMode}

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

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

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

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

696698
return html`
697699
<div class="${bubbleClasses}">
698-
${hasActions
699-
? html`<div class="chat-bubble-actions">
700+
${
701+
hasActions
702+
? html`<div class="chat-bubble-actions">
700703
${canExpand ? renderExpandButton(markdown!, onOpenSidebar!) : nothing}
701704
${canCopyMarkdown ? renderCopyAsMarkdownButton(markdown!) : nothing}
702705
</div>`
703-
: nothing}
704-
${isToolMessage
705-
? html`
706+
: nothing
707+
}
708+
${
709+
isToolMessage
710+
? html`
706711
<details class="chat-tool-msg-collapse">
707712
<summary class="chat-tool-msg-summary">
708713
<span class="chat-tool-msg-summary__icon">${icons.zap}</span>
709714
<span class="chat-tool-msg-summary__label">Tool output</span>
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}
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+
}
715722
</summary>
716723
<div class="chat-tool-msg-body">
717724
${renderMessageImages(images)}
718-
${reasoningMarkdown
719-
? html`<div class="chat-thinking">
725+
${
726+
reasoningMarkdown
727+
? html`<div class="chat-thinking">
720728
${unsafeHTML(toSanitizedMarkdownHtml(reasoningMarkdown))}
721729
</div>`
722-
: nothing}
723-
${jsonResult
724-
? html`<details class="chat-json-collapse">
730+
: nothing
731+
}
732+
${
733+
jsonResult
734+
? html`<details class="chat-json-collapse">
725735
<summary class="chat-json-summary">
726736
<span class="chat-json-badge">JSON</span>
727737
<span class="chat-json-label">${jsonSummaryLabel(jsonResult.parsed)}</span>
728738
</summary>
729739
<pre class="chat-json-content"><code>${jsonResult.pretty}</code></pre>
730740
</details>`
731-
: markdown
732-
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
741+
: markdown
742+
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
733743
${unsafeHTML(toSanitizedMarkdownHtml(markdown))}
734744
</div>`
735-
: nothing}
745+
: nothing
746+
}
736747
${hasToolCards ? renderCollapsedToolCards(toolCards, onOpenSidebar) : nothing}
737748
</div>
738749
</details>
739750
`
740-
: html`
751+
: html`
741752
${renderMessageImages(images)}
742-
${reasoningMarkdown
743-
? html`<div class="chat-thinking">
753+
${
754+
reasoningMarkdown
755+
? html`<div class="chat-thinking">
744756
${unsafeHTML(toSanitizedMarkdownHtml(reasoningMarkdown))}
745757
</div>`
746-
: nothing}
747-
${jsonResult
748-
? html`<details class="chat-json-collapse">
758+
: nothing
759+
}
760+
${
761+
jsonResult
762+
? html`<details class="chat-json-collapse">
749763
<summary class="chat-json-summary">
750764
<span class="chat-json-badge">JSON</span>
751765
<span class="chat-json-label">${jsonSummaryLabel(jsonResult.parsed)}</span>
752766
</summary>
753767
<pre class="chat-json-content"><code>${jsonResult.pretty}</code></pre>
754768
</details>`
755-
: markdown
756-
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
769+
: markdown
770+
? html`<div class="chat-text" dir="${detectTextDirection(markdown)}">
757771
${unsafeHTML(toSanitizedMarkdownHtml(markdown))}
758772
</div>`
759-
: nothing}
773+
: nothing
774+
}
760775
${hasToolCards ? renderCollapsedToolCards(toolCards, onOpenSidebar) : nothing}
761-
`}
776+
`
777+
}
762778
</div>
763779
`;
764780
}

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

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,35 +81,49 @@ export function renderToolCardSidebar(card: ToolCard, onOpenSidebar?: (content:
8181
@click=${handleClick}
8282
role=${canClick ? "button" : nothing}
8383
tabindex=${canClick ? "0" : nothing}
84-
@keydown=${canClick
85-
? (e: KeyboardEvent) => {
86-
if (e.key !== "Enter" && e.key !== " ") {
87-
return;
84+
@keydown=${
85+
canClick
86+
? (e: KeyboardEvent) => {
87+
if (e.key !== "Enter" && e.key !== " ") {
88+
return;
89+
}
90+
e.preventDefault();
91+
handleClick?.();
8892
}
89-
e.preventDefault();
90-
handleClick?.();
91-
}
92-
: nothing}
93+
: nothing
94+
}
9395
>
9496
<div class="chat-tool-card__header">
9597
<div class="chat-tool-card__title">
9698
<span class="chat-tool-card__icon">${icons[display.icon]}</span>
9799
<span>${display.label}</span>
98100
</div>
99-
${canClick
100-
? html`<span class="chat-tool-card__action"
101+
${
102+
canClick
103+
? html`<span class="chat-tool-card__action"
101104
>${hasText ? "View" : ""} ${icons.check}</span
102105
>`
103-
: nothing}
104-
${isEmpty && !canClick
105-
? html`<span class="chat-tool-card__status">${icons.check}</span>`
106-
: nothing}
106+
: nothing
107+
}
108+
${
109+
isEmpty && !canClick
110+
? html`<span class="chat-tool-card__status">${icons.check}</span>`
111+
: nothing
112+
}
107113
</div>
108114
${detail ? html`<div class="chat-tool-card__detail">${detail}</div>` : nothing}
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}
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+
}
113127
${showInline ? html`<div class="chat-tool-card__inline mono">${card.text}</div>` : nothing}
114128
</div>
115129
`;

‎ui/src/ui/icons.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ export const icons = {
121121
<path d="m6 6 12 12" />
122122
</svg>
123123
`,
124-
check: html` <svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg> `,
124+
check: html`
125+
<svg viewBox="0 0 24 24"><path d="M20 6 9 17l-5-5" /></svg>
126+
`,
125127
arrowDown: html`
126128
<svg viewBox="0 0 24 24">
127129
<path d="M12 5v14" />
@@ -142,12 +144,8 @@ export const icons = {
142144
`,
143145
brain: html`
144146
<svg viewBox="0 0 24 24">
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-
/>
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" />
151149
<path d="M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4" />
152150
<path d="M17.599 6.5a3 3 0 0 0 .399-1.375" />
153151
<path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
@@ -238,7 +236,9 @@ export const icons = {
238236
<path d="M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z" />
239237
</svg>
240238
`,
241-
circle: html` <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /></svg> `,
239+
circle: html`
240+
<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" /></svg>
241+
`,
242242
puzzle: html`
243243
<svg viewBox="0 0 24 24">
244244
<path
@@ -286,7 +286,9 @@ export const icons = {
286286
<path d="M22 2 11 13" />
287287
</svg>
288288
`,
289-
stop: html` <svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="1" /></svg> `,
289+
stop: html`
290+
<svg viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" rx="1" /></svg>
291+
`,
290292
pin: html`
291293
<svg viewBox="0 0 24 24">
292294
<line x1="12" x2="12" y1="17" y2="22" />

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

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

0 commit comments

Comments
 (0)