fix(webui): align file edits and remove redundant status markers

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-10 15:33:35 +08:00
1 parent a3e9d0f9a9
commit a4140dac25
3 files changed
+37 -55

No files matched your search

+2 -2
View File
@@ -887,8 +887,8 @@ export function StreamingLabelSheen({
<span <span
data-sheen-text={active ? sheenText : undefined} data-sheen-text={active ? sheenText : undefined}
className={cn( className={cn(
"block w-fit max-w-full truncate pr-0.5 font-medium leading-normal after:pr-0.5", "block w-fit max-w-full truncate pr-0.5 font-medium leading-normal",
active ? "streaming-text-sheen" : "text-muted-foreground", active ? "streaming-text-sheen after:pr-0.5" : "text-muted-foreground",
)} )}
> >
{children} {children}
@@ -10,6 +10,7 @@ export type ActivityStepTone = "neutral" | "active" | "success" | "error";
export interface ActivityStepProps { export interface ActivityStepProps {
icon?: LucideIcon; icon?: LucideIcon;
marker?: ReactNode; marker?: ReactNode;
showMarker?: boolean;
label: ReactNode; label: ReactNode;
ariaLabel?: string; ariaLabel?: string;
active?: boolean; active?: boolean;
@@ -24,6 +25,7 @@ export interface ActivityStepProps {
export function ActivityStep({ export function ActivityStep({
icon: Icon, icon: Icon,
marker, marker,
showMarker = true,
label, label,
ariaLabel, ariaLabel,
active = false, active = false,
@@ -58,32 +60,35 @@ export function ActivityStep({
data-testid="activity-step" data-testid="activity-step"
aria-label={ariaLabel} aria-label={ariaLabel}
className={cn( className={cn(
"relative grid min-w-0 grid-cols-[1.125rem_minmax(0,1fr)] gap-2 py-0.5 text-[13px] leading-5", "relative grid min-w-0 py-0.5 text-[13px] leading-5",
showMarker ? "grid-cols-[1.125rem_minmax(0,1fr)] gap-2" : "grid-cols-1",
className, className,
)} )}
style={style} style={style}
> >
<span {showMarker ? (
className={cn( <span
"flex h-5 w-[1.125rem] shrink-0 items-start justify-center pt-[3px]", className={cn(
)} "flex h-5 w-[1.125rem] shrink-0 items-start justify-center pt-[3px]",
aria-hidden )}
> aria-hidden
{marker ?? ( >
<span {marker ?? (
className={cn( <span
"grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors", className={cn(
tone === "active" && "border-muted-foreground/28 text-muted-foreground/72", "grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",
tone === "success" && "border-emerald-500/28 text-emerald-500/78", tone === "active" && "border-muted-foreground/28 text-muted-foreground/72",
tone === "error" && "border-destructive/30 text-destructive/78", tone === "success" && "border-emerald-500/28 text-emerald-500/78",
tone === "neutral" && "border-muted-foreground/18 text-muted-foreground/50", tone === "error" && "border-destructive/30 text-destructive/78",
markerClassName, tone === "neutral" && "border-muted-foreground/18 text-muted-foreground/50",
)} markerClassName,
> )}
{Icon ? <Icon className="h-2.5 w-2.5" strokeWidth={2.15} /> : null} >
</span> {Icon ? <Icon className="h-2.5 w-2.5" strokeWidth={2.15} /> : null}
)} </span>
</span> )}
</span>
) : null}
<div className={cn("min-w-0", contentClassName)}> <div className={cn("min-w-0", contentClassName)}>
{typeof label === "string" ? ( {typeof label === "string" ? (
<TooltipProvider> <TooltipProvider>
@@ -1,11 +1,8 @@
import { useEffect, useMemo, useState } from "react"; import { useEffect, useMemo, useState } from "react";
import { import {
AlertCircle,
CheckCircle2,
ChevronDown, ChevronDown,
ChevronRight, ChevronRight,
ChevronUp, ChevronUp,
CircleDashed,
ExternalLink, ExternalLink,
} from "lucide-react"; } from "lucide-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -95,29 +92,11 @@ function FileEditRow({
const action = fileEditAction(edit, editing, failed); const action = fileEditAction(edit, editing, failed);
const hasCountedDiff = !failed && !edit.binary && hasVisibleDiffStats(edit); const hasCountedDiff = !failed && !edit.binary && hasVisibleDiffStats(edit);
const showDiff = canRenderDiff(edit, displayMode); const showDiff = canRenderDiff(edit, displayMode);
const statusIcon = failed ? (
<AlertCircle className="h-3 w-3" aria-hidden />
) : editing ? (
<CircleDashed className="h-3 w-3 animate-spin" aria-hidden />
) : (
<CheckCircle2 className="h-3 w-3" aria-hidden />
);
return ( return (
<div className="min-w-0"> <div className="min-w-0">
<ActivityStep <ActivityStep
marker={( showMarker={false}
<span
className={cn(
"grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",
failed && "border-destructive/30 text-destructive/78",
editing && "border-muted-foreground/24 text-muted-foreground/65",
!failed && !editing && "border-emerald-500/28 text-emerald-500/78",
)}
>
{statusIcon}
</span>
)}
active={editing} active={editing}
tone={failed ? "error" : editing ? "active" : "success"} tone={failed ? "error" : editing ? "active" : "success"}
className="text-xs" className="text-xs"
@@ -126,7 +105,7 @@ function FileEditRow({
? t("message.fileEditPreparing", { defaultValue: "Preparing file edit…" }) ? t("message.fileEditPreparing", { defaultValue: "Preparing file edit…" })
: ( : (
<span className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap"> <span className="flex min-w-0 items-center gap-1.5 overflow-hidden whitespace-nowrap">
<span className="shrink-0">{action}</span> <span className={cn("shrink-0", failed && "text-destructive/80")}>{action}</span>
<FileReferenceChip <FileReferenceChip
path={edit.path} path={edit.path}
previewPath={edit.absolute_path || edit.path} previewPath={edit.absolute_path || edit.path}
@@ -142,14 +121,12 @@ function FileEditRow({
)} )}
/> />
{showDiff ? ( {showDiff ? (
<div className="ml-[2.125rem] min-w-0"> <FileUnifiedDiff
<FileUnifiedDiff diff={edit.diff!}
diff={edit.diff!} collapsed={displayMode === "collapsed_diff"}
collapsed={displayMode === "collapsed_diff"} previewPath={edit.absolute_path || edit.path}
previewPath={edit.absolute_path || edit.path} onOpenFilePreview={onOpenFilePreview}
onOpenFilePreview={onOpenFilePreview} />
/>
</div>
) : null} ) : null}
</div> </div>
); );