Skip to content

Commit c34ad72

Browse files
committed
chore: cleanup
1 parent cc86a64 commit c34ad72

2 files changed

Lines changed: 59 additions & 54 deletions

File tree

packages/ui/src/components/message-part.css

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,69 +1219,70 @@
12191219
}
12201220

12211221
[data-component="accordion"][data-scope="apply-patch"] {
1222+
[data-slot="accordion-trigger"] {
1223+
background-color: var(--background-stronger) !important;
1224+
}
1225+
12221226
[data-slot="apply-patch-trigger-content"] {
12231227
display: flex;
12241228
align-items: center;
12251229
justify-content: space-between;
12261230
width: 100%;
1231+
gap: 20px;
1232+
}
1233+
1234+
[data-slot="apply-patch-file-info"] {
1235+
flex-grow: 1;
1236+
display: flex;
1237+
align-items: center;
1238+
gap: 20px;
12271239
min-width: 0;
1228-
gap: 12px;
12291240
}
12301241

1231-
[data-slot="apply-patch-file-path"] {
1232-
font-family: var(--font-family-mono);
1233-
font-size: var(--font-size-small);
1234-
color: var(--text-weak);
1235-
overflow: hidden;
1242+
[data-slot="apply-patch-file-name-container"] {
1243+
display: flex;
1244+
flex-grow: 1;
1245+
min-width: 0;
1246+
}
1247+
1248+
[data-slot="apply-patch-directory"] {
1249+
color: var(--text-base);
12361250
text-overflow: ellipsis;
1251+
overflow: hidden;
12371252
white-space: nowrap;
1238-
flex-grow: 1;
1253+
direction: rtl;
1254+
text-align: left;
1255+
}
1256+
1257+
[data-slot="apply-patch-filename"] {
1258+
color: var(--text-strong);
1259+
flex-shrink: 0;
12391260
}
12401261

12411262
[data-slot="apply-patch-trigger-actions"] {
12421263
flex-shrink: 0;
1243-
display: inline-flex;
1264+
display: flex;
1265+
gap: 16px;
12441266
align-items: center;
1245-
gap: 10px;
1267+
justify-content: flex-end;
12461268
}
12471269

1248-
[data-slot="apply-patch-file-action"] {
1270+
[data-slot="apply-patch-change"] {
12491271
font-family: var(--font-family-sans);
12501272
font-size: var(--font-size-small);
12511273
font-weight: var(--font-weight-medium);
1252-
line-height: var(--line-height-large);
1253-
color: var(--text-base);
1254-
flex-shrink: 0;
1255-
1256-
&[data-type="delete"] {
1257-
color: var(--text-critical-base);
1258-
}
1259-
1260-
&[data-type="add"] {
1261-
color: var(--text-success-base);
1262-
}
1263-
1264-
&[data-type="move"] {
1265-
color: var(--text-warning-base);
1266-
}
12671274
}
12681275

1269-
[data-slot="apply-patch-deletion-count"] {
1270-
font-family: var(--font-family-mono);
1271-
font-size: var(--font-size-small);
1272-
color: var(--text-critical-base);
1273-
flex-shrink: 0;
1276+
[data-slot="apply-patch-change"][data-type="added"] {
1277+
color: var(--icon-diff-add-base);
12741278
}
12751279

1276-
[data-slot="apply-patch-file-chevron"] {
1277-
display: inline-flex;
1278-
color: var(--icon-weaker);
1279-
transform: rotate(-90deg);
1280-
transition: transform 0.15s ease;
1280+
[data-slot="apply-patch-change"][data-type="removed"] {
1281+
color: var(--icon-diff-delete-base);
12811282
}
12821283

1283-
[data-slot="accordion-item"][data-expanded] [data-slot="apply-patch-file-chevron"] {
1284-
transform: rotate(0deg);
1284+
[data-slot="apply-patch-change"][data-type="modified"] {
1285+
color: var(--icon-diff-modified-base);
12851286
}
12861287
}
12871288

packages/ui/src/components/message-part.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { Accordion } from "./accordion"
3939
import { Button } from "./button"
4040
import { Card } from "./card"
4141
import { Collapsible } from "./collapsible"
42+
import { FileIcon } from "./file-icon"
4243
import { Icon } from "./icon"
4344
import { Checkbox } from "./checkbox"
4445
import { DiffChanges } from "./diff-changes"
@@ -1661,34 +1662,37 @@ ToolRegistry.register({
16611662
<Accordion.Header>
16621663
<Accordion.Trigger>
16631664
<div data-slot="apply-patch-trigger-content">
1664-
<span data-slot="apply-patch-file-path">{file.relativePath}</span>
1665+
<div data-slot="apply-patch-file-info">
1666+
<FileIcon node={{ path: file.relativePath, type: "file" }} />
1667+
<div data-slot="apply-patch-file-name-container">
1668+
<Show when={file.relativePath.includes("/")}>
1669+
<span data-slot="apply-patch-directory">{`\u202A${getDirectory(file.relativePath)}\u202C`}</span>
1670+
</Show>
1671+
<span data-slot="apply-patch-filename">{getFilename(file.relativePath)}</span>
1672+
</div>
1673+
</div>
16651674
<div data-slot="apply-patch-trigger-actions">
16661675
<Switch>
1667-
<Match when={file.type === "delete"}>
1668-
<span data-slot="apply-patch-file-action" data-type="delete">
1669-
{i18n.t("ui.patch.action.deleted")}
1670-
</span>
1671-
</Match>
16721676
<Match when={file.type === "add"}>
1673-
<span data-slot="apply-patch-file-action" data-type="add">
1677+
<span data-slot="apply-patch-change" data-type="added">
16741678
{i18n.t("ui.patch.action.created")}
16751679
</span>
16761680
</Match>
1681+
<Match when={file.type === "delete"}>
1682+
<span data-slot="apply-patch-change" data-type="removed">
1683+
{i18n.t("ui.patch.action.deleted")}
1684+
</span>
1685+
</Match>
16771686
<Match when={file.type === "move"}>
1678-
<span data-slot="apply-patch-file-action" data-type="move">
1687+
<span data-slot="apply-patch-change" data-type="modified">
16791688
{i18n.t("ui.patch.action.moved")}
16801689
</span>
16811690
</Match>
1691+
<Match when={true}>
1692+
<DiffChanges changes={{ additions: file.additions, deletions: file.deletions }} />
1693+
</Match>
16821694
</Switch>
1683-
<Show when={file.type !== "delete"}>
1684-
<DiffChanges changes={{ additions: file.additions, deletions: file.deletions }} />
1685-
</Show>
1686-
<Show when={file.type === "delete"}>
1687-
<span data-slot="apply-patch-deletion-count">-{file.deletions}</span>
1688-
</Show>
1689-
<span data-slot="apply-patch-file-chevron">
1690-
<Icon name="chevron-down" size="small" />
1691-
</span>
1695+
<Icon name="chevron-grabber-vertical" size="small" />
16921696
</div>
16931697
</div>
16941698
</Accordion.Trigger>

0 commit comments

Comments
 (0)