fix(webui): align file edits and remove redundant status markers
This commit is contained in:
1 parent
a3e9d0f9a9
commit
a4140dac25
3 files changed
+37
-55
No files matched your search
@@ -887,8 +887,8 @@ export function StreamingLabelSheen({
|
||||
<span
|
||||
data-sheen-text={active ? sheenText : undefined}
|
||||
className={cn(
|
||||
"block w-fit max-w-full truncate pr-0.5 font-medium leading-normal after:pr-0.5",
|
||||
active ? "streaming-text-sheen" : "text-muted-foreground",
|
||||
"block w-fit max-w-full truncate pr-0.5 font-medium leading-normal",
|
||||
active ? "streaming-text-sheen after:pr-0.5" : "text-muted-foreground",
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -10,6 +10,7 @@ export type ActivityStepTone = "neutral" | "active" | "success" | "error";
|
||||
export interface ActivityStepProps {
|
||||
icon?: LucideIcon;
|
||||
marker?: ReactNode;
|
||||
showMarker?: boolean;
|
||||
label: ReactNode;
|
||||
ariaLabel?: string;
|
||||
active?: boolean;
|
||||
@@ -24,6 +25,7 @@ export interface ActivityStepProps {
|
||||
export function ActivityStep({
|
||||
icon: Icon,
|
||||
marker,
|
||||
showMarker = true,
|
||||
label,
|
||||
ariaLabel,
|
||||
active = false,
|
||||
@@ -58,32 +60,35 @@ export function ActivityStep({
|
||||
data-testid="activity-step"
|
||||
aria-label={ariaLabel}
|
||||
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,
|
||||
)}
|
||||
style={style}
|
||||
>
|
||||
<span
|
||||
className={cn(
|
||||
"flex h-5 w-[1.125rem] shrink-0 items-start justify-center pt-[3px]",
|
||||
)}
|
||||
aria-hidden
|
||||
>
|
||||
{marker ?? (
|
||||
<span
|
||||
className={cn(
|
||||
"grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",
|
||||
tone === "active" && "border-muted-foreground/28 text-muted-foreground/72",
|
||||
tone === "success" && "border-emerald-500/28 text-emerald-500/78",
|
||||
tone === "error" && "border-destructive/30 text-destructive/78",
|
||||
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>
|
||||
)}
|
||||
</span>
|
||||
{showMarker ? (
|
||||
<span
|
||||
className={cn(
|
||||
"flex h-5 w-[1.125rem] shrink-0 items-start justify-center pt-[3px]",
|
||||
)}
|
||||
aria-hidden
|
||||
>
|
||||
{marker ?? (
|
||||
<span
|
||||
className={cn(
|
||||
"grid h-3.5 w-3.5 place-items-center rounded-full border bg-background transition-colors",
|
||||
tone === "active" && "border-muted-foreground/28 text-muted-foreground/72",
|
||||
tone === "success" && "border-emerald-500/28 text-emerald-500/78",
|
||||
tone === "error" && "border-destructive/30 text-destructive/78",
|
||||
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>
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
<div className={cn("min-w-0", contentClassName)}>
|
||||
{typeof label === "string" ? (
|
||||
<TooltipProvider>
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
AlertCircle,
|
||||
CheckCircle2,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
ChevronUp,
|
||||
CircleDashed,
|
||||
ExternalLink,
|
||||
} from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -95,29 +92,11 @@ function FileEditRow({
|
||||
const action = fileEditAction(edit, editing, failed);
|
||||
const hasCountedDiff = !failed && !edit.binary && hasVisibleDiffStats(edit);
|
||||
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 (
|
||||
<div className="min-w-0">
|
||||
<ActivityStep
|
||||
marker={(
|
||||
<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>
|
||||
)}
|
||||
showMarker={false}
|
||||
active={editing}
|
||||
tone={failed ? "error" : editing ? "active" : "success"}
|
||||
className="text-xs"
|
||||
@@ -126,7 +105,7 @@ function FileEditRow({
|
||||
? t("message.fileEditPreparing", { defaultValue: "Preparing file edit…" })
|
||||
: (
|
||||
<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
|
||||
path={edit.path}
|
||||
previewPath={edit.absolute_path || edit.path}
|
||||
@@ -142,14 +121,12 @@ function FileEditRow({
|
||||
)}
|
||||
/>
|
||||
{showDiff ? (
|
||||
<div className="ml-[2.125rem] min-w-0">
|
||||
<FileUnifiedDiff
|
||||
diff={edit.diff!}
|
||||
collapsed={displayMode === "collapsed_diff"}
|
||||
previewPath={edit.absolute_path || edit.path}
|
||||
onOpenFilePreview={onOpenFilePreview}
|
||||
/>
|
||||
</div>
|
||||
<FileUnifiedDiff
|
||||
diff={edit.diff!}
|
||||
collapsed={displayMode === "collapsed_diff"}
|
||||
previewPath={edit.absolute_path || edit.path}
|
||||
onOpenFilePreview={onOpenFilePreview}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user