fix(webui): use file-type icons in file change activity
This commit is contained in:
1 parent
d076e4ef13
commit
8de03ac0a2
8 files changed
+132
-68
No files matched your search
@@ -3,7 +3,7 @@ import type { LucideIcon } from "lucide-react";
|
||||
|
||||
import { StreamingLabelSheen } from "@/components/ui/streaming-label-sheen";
|
||||
import { formControlFocusClassName } from "@/components/ui/form-control";
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { HoverHint, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type ActivityStepTone = "neutral" | "active" | "success" | "error";
|
||||
@@ -11,6 +11,7 @@ export type ActivityStepTone = "neutral" | "active" | "success" | "error";
|
||||
export interface ActivityStepProps {
|
||||
icon?: LucideIcon;
|
||||
marker?: ReactNode;
|
||||
markerLabel?: string;
|
||||
showMarker?: boolean;
|
||||
label: ReactNode;
|
||||
detail?: string;
|
||||
@@ -30,6 +31,7 @@ export interface ActivityStepProps {
|
||||
export function ActivityStep({
|
||||
icon: Icon,
|
||||
marker,
|
||||
markerLabel,
|
||||
showMarker = true,
|
||||
label,
|
||||
detail,
|
||||
@@ -48,6 +50,30 @@ export function ActivityStep({
|
||||
const lineRef = useRef<HTMLDivElement>(null);
|
||||
const [hintOpen, setHintOpen] = useState(false);
|
||||
const textLabel = typeof label === "string" ? [label, detail].filter(Boolean).join("\n") : undefined;
|
||||
const activityMarker = (
|
||||
<span
|
||||
className={cn(
|
||||
"flex h-5 w-[1.125rem] shrink-0 items-start justify-center pt-[3px]",
|
||||
markerLabel && ["rounded-sm", formControlFocusClassName],
|
||||
)}
|
||||
aria-hidden={markerLabel ? undefined : true}
|
||||
role={markerLabel ? "img" : undefined}
|
||||
aria-label={markerLabel}
|
||||
tabIndex={markerLabel ? 0 : undefined}
|
||||
>
|
||||
{marker ?? (
|
||||
<span
|
||||
className={cn(
|
||||
"grid h-3.5 w-3.5 place-items-center transition-colors",
|
||||
tone === "error" ? "text-destructive/[0.78]" : "text-muted-foreground",
|
||||
markerClassName,
|
||||
)}
|
||||
>
|
||||
{Icon ? <Icon className="h-3.5 w-3.5" strokeWidth={1.75} aria-hidden /> : null}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
const line = (
|
||||
<div
|
||||
ref={lineRef}
|
||||
@@ -92,26 +118,9 @@ export function ActivityStep({
|
||||
)}
|
||||
style={style}
|
||||
>
|
||||
{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 transition-colors",
|
||||
tone === "error" ? "text-destructive/[0.78]" : "text-muted-foreground",
|
||||
markerClassName,
|
||||
)}
|
||||
>
|
||||
{Icon ? <Icon className="h-3.5 w-3.5" strokeWidth={1.75} /> : null}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
{showMarker ? markerLabel ? (
|
||||
<HoverHint content={markerLabel}>{activityMarker}</HoverHint>
|
||||
) : activityMarker : null}
|
||||
<div className={cn("min-w-0", contentClassName)}>
|
||||
{typeof label === "string" ? (
|
||||
<TooltipProvider>
|
||||
|
||||
Reference in new issue
Block a user