Update task header and focus chain UI design (#6415)
* Fix chatfield buttons positioning * Fix task header icons being cut off at bottom * Fix copy for focus chain * Fix focus chain text overflowing and being hidden * Remove transition animation * Fix token stats * Tweak task header styles * Fix focus chain progress bar direction * Hide checkpoint text unless hovered * Make copy button smaller and muted * Use new focus chain design * Make timeline blocks circles * Move focus chain down and fix pencil icon positioning
This commit is contained in:
1 parent
a3945dce7f
commit
011b19225e
16 files changed
+261
-197
No files matched your search
@@ -17,12 +17,12 @@ export function getFocusChainFilePath(taskDir: string, taskId: string): string {
|
||||
export function createFocusChainMarkdownContent(taskId: string, focusChainList: string): string {
|
||||
return `# Focus Chain List for Task ${taskId}
|
||||
|
||||
<!-- Edit this markdown file to update your focus chain focusChain list -->
|
||||
<!-- Edit this markdown file to update your focus chain list -->
|
||||
<!-- Use the format: - [ ] for incomplete items and - [x] for completed items -->
|
||||
|
||||
${focusChainList}
|
||||
|
||||
<!-- Save this file and the focusChain list will be updated in the task -->`
|
||||
<!-- Save this file and the focus chain list will be updated in the task -->`
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1428,7 +1428,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
className="relative flex transition-colors ease-in-out duration-100 p-2.5"
|
||||
className="relative flex transition-colors ease-in-out duration-100 px-3.5 py-2.5"
|
||||
onDragEnter={handleDragEnter}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDragOver={onDragOver}
|
||||
@@ -1504,11 +1504,10 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
)}
|
||||
<div
|
||||
className={cn(
|
||||
"absolute left-3.5 right-3.5 bottom-2.5 top-2.5 whitespace-pre-wrap break-words rounded-xs px-9 py-9 overflow-hidden bg-input-background",
|
||||
{
|
||||
"border-input-border": isTextAreaFocused || isVoiceRecording,
|
||||
"left-2.5 right-2.5": isTextAreaFocused || isVoiceRecording,
|
||||
},
|
||||
"absolute bottom-2.5 top-2.5 whitespace-pre-wrap break-words rounded-xs overflow-hidden bg-input-background",
|
||||
isTextAreaFocused || isVoiceRecording
|
||||
? "left-3.5 right-3.5"
|
||||
: "left-3.5 right-3.5 border border-input-border",
|
||||
)}
|
||||
ref={highlightLayerRef}
|
||||
style={{
|
||||
@@ -1522,12 +1521,11 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
fontSize: "var(--vscode-editor-font-size)",
|
||||
lineHeight: "var(--vscode-editor-line-height)",
|
||||
borderRadius: 2,
|
||||
borderLeft: 0,
|
||||
borderRight: 0,
|
||||
borderTop: 0,
|
||||
borderColor: "transparent",
|
||||
borderBottom: `${thumbnailsHeight}px solid transparent`,
|
||||
padding: "9px 28px 9px 9px",
|
||||
borderLeft: isTextAreaFocused || isVoiceRecording ? 0 : undefined,
|
||||
borderRight: isTextAreaFocused || isVoiceRecording ? 0 : undefined,
|
||||
borderTop: isTextAreaFocused || isVoiceRecording ? 0 : undefined,
|
||||
borderBottom: isTextAreaFocused || isVoiceRecording ? 0 : undefined,
|
||||
padding: `9px 28px ${9 + thumbnailsHeight}px 9px`,
|
||||
}}
|
||||
/>
|
||||
<DynamicTextArea
|
||||
@@ -1627,7 +1625,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
/>
|
||||
)}
|
||||
<div
|
||||
className="absolute flex items-end bottom-3.5 right-5 z-10 h-8 text-xs"
|
||||
className="absolute flex items-end bottom-4.5 right-5 z-10 h-8 text-xs"
|
||||
style={{ height: textAreaBaseHeight }}>
|
||||
<div className="flex flex-row items-center">
|
||||
{dictationSettings?.dictationEnabled === true && dictationSettings?.featureEnabled && (
|
||||
@@ -1686,16 +1684,16 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-between items-center -mt-1 px-2.5 py-0.5">
|
||||
<div className="flex justify-between items-center -mt-1 px-3 pb-2">
|
||||
{/* Always render both components, but control visibility with CSS */}
|
||||
<div className="relative flex-1 min-w-0 h-7">
|
||||
<div className="relative flex-1 min-w-0 h-5">
|
||||
{/* ButtonGroup - always in DOM but visibility controlled */}
|
||||
<ButtonGroup className="absolute top-0 left-0 right-0 transition-opacity duration-300 ease-in-out w-full h-5 z-10 flex items-center">
|
||||
<ButtonGroup className="absolute top-0 left-0 right-0 ease-in-out w-full h-5 z-10 flex items-center">
|
||||
<Tooltip style={{ left: 0 }} tipText="Add Context">
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
aria-label="Add Context"
|
||||
className="p-0 m-0 flex items-center mt-0.5"
|
||||
className="p-0 m-0 flex items-center"
|
||||
data-testid="context-button"
|
||||
onClick={handleContextButtonClick}>
|
||||
<ButtonContainer>
|
||||
@@ -1708,7 +1706,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
aria-label="Add Files & Images"
|
||||
className="p-0 m-0 flex items-center mt-0.5"
|
||||
className="p-0 m-0 flex items-center"
|
||||
data-testid="files-button"
|
||||
disabled={shouldDisableFilesAndImages}
|
||||
onClick={() => {
|
||||
|
||||
@@ -145,7 +145,7 @@ export const ActionButtons: React.FC<ActionButtonsProps> = ({
|
||||
{secondaryText && secondaryAction && (
|
||||
<VSCodeButton
|
||||
appearance="secondary"
|
||||
className={primaryText ? "flex-1 mr-[6px]" : "flex-[2]"}
|
||||
className={primaryText ? "flex-1" : "flex-[2]"}
|
||||
disabled={!canInteract}
|
||||
onClick={() => handleActionClick(secondaryAction, inputValue, selectedImages, selectedFiles)}>
|
||||
{secondaryText}
|
||||
|
||||
@@ -116,12 +116,9 @@ export const AutoCondenseMarker: React.FC<{
|
||||
}}>
|
||||
{(isContextWindowHoverOpen || isAnimating || showPercentageAfterAnimation) && (
|
||||
<div
|
||||
className={cn(
|
||||
"absolute -top-4 -left-1 text-button-background font-mono text-xs transition-opacity duration-300",
|
||||
{
|
||||
"opacity-0": isFadingOut,
|
||||
},
|
||||
)}>
|
||||
className={cn("absolute -top-4 -left-1 text-button-background font-mono text-xs", {
|
||||
"opacity-0": isFadingOut,
|
||||
})}>
|
||||
{marker.label}%
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -24,9 +24,9 @@ export const CheckpointError: React.FC<CheckpointErrorProps> = ({
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<div className="flex items-center justify-center w-full opacity-80 hover:opacity-100 transition-opacity duration-200">
|
||||
<div className="flex items-center justify-center w-full">
|
||||
<Alert
|
||||
className="rounded-sm border-0 bg-[var(--vscode-inputValidation-errorBackground)] text-[var(--vscode-inputValidation-errorForeground)] p-1.5"
|
||||
className="rounded-sm border-0 bg-[var(--vscode-inputValidation-errorBackground)] text-[var(--vscode-inputValidation-errorForeground)] pl-1 pr-1.5 py-0"
|
||||
color="warning"
|
||||
description={
|
||||
<div className="flex gap-2">
|
||||
|
||||
@@ -124,8 +124,8 @@ const ContextWindow: React.FC<ContextWindowProgressProps> = ({
|
||||
}
|
||||
return {
|
||||
percentage: (lastApiReqTotalTokens / contextWindow) * 100,
|
||||
max: formatTokenNumber(contextWindow),
|
||||
used: formatTokenNumber(lastApiReqTotalTokens),
|
||||
max: contextWindow,
|
||||
used: lastApiReqTotalTokens,
|
||||
}
|
||||
}, [contextWindow, lastApiReqTotalTokens])
|
||||
|
||||
@@ -207,7 +207,7 @@ const ContextWindow: React.FC<ContextWindowProgressProps> = ({
|
||||
<div className="flex gap-1 flex-row @max-xs:flex-col @max-xs:items-start items-center text-sm">
|
||||
<div className="flex items-center gap-1.5 flex-1 whitespace-nowrap text-xs">
|
||||
<span className="cursor-pointer" title="Current tokens used in this request">
|
||||
{tokenData.used}
|
||||
{formatTokenNumber(tokenData.used)}
|
||||
</span>
|
||||
<div className="flex relative items-center gap-1 flex-1 w-full h-full" onMouseEnter={() => setIsOpened(true)}>
|
||||
<Tooltip
|
||||
@@ -237,7 +237,7 @@ const ContextWindow: React.FC<ContextWindowProgressProps> = ({
|
||||
aria-valuemin={0}
|
||||
aria-valuenow={Math.round(threshold * 100)}
|
||||
aria-valuetext={`${Math.round(threshold * 100)}% threshold`}
|
||||
className="relative w-full text-badge-foreground context-window-progress brightness-100"
|
||||
className="relative w-full text-foreground context-window-progress brightness-100"
|
||||
onFocus={handleFocus}
|
||||
onKeyDown={handleKeyDown}
|
||||
ref={progressBarRef}
|
||||
@@ -271,7 +271,7 @@ const ContextWindow: React.FC<ContextWindowProgressProps> = ({
|
||||
</Tooltip>
|
||||
</div>
|
||||
<span className="cursor-pointer" title="Maximum context window size for this model">
|
||||
{tokenData.max}
|
||||
{formatTokenNumber(tokenData.max)}
|
||||
</span>
|
||||
</div>
|
||||
<CompactTaskButton onClick={handleCompactClick} />
|
||||
|
||||
@@ -17,8 +17,8 @@ interface TokenDetail {
|
||||
|
||||
interface TaskContextWindowButtonsProps extends TokenUsageInfoProps {
|
||||
percentage: number
|
||||
tokenUsed: string
|
||||
contextWindow: string
|
||||
tokenUsed: number
|
||||
contextWindow: number
|
||||
autoCompactThreshold?: number
|
||||
isThresholdChanged?: boolean
|
||||
isThresholdFadingOut?: boolean
|
||||
@@ -121,7 +121,7 @@ export const ContextWindowSummary: React.FC<TaskContextWindowButtonsProps> = ({
|
||||
})
|
||||
}, [])
|
||||
|
||||
const totalTokens = (tokensIn || 0) + (tokensOut || 0)
|
||||
const totalTokens = (tokensIn || 0) + (tokensOut || 0) + (cacheWrites || 0) + (cacheReads || 0)
|
||||
|
||||
return (
|
||||
<div className="context-window-tooltip-content flex flex-col gap-2 bg-menu rounded shadow-sm border border-menu-border z-100 w-60 p-4">
|
||||
@@ -146,21 +146,19 @@ export const ContextWindowSummary: React.FC<TaskContextWindowButtonsProps> = ({
|
||||
isExpanded={expandedSections.has("context")}
|
||||
onToggle={(event) => toggleSection("context", event)}
|
||||
title="Context Window"
|
||||
value={percentage ? `${percentage.toFixed(1)}% used` : contextWindow}>
|
||||
value={percentage ? `${percentage.toFixed(1)}% used` : formatTokenNumber(contextWindow)}>
|
||||
<div className="space-y-1">
|
||||
<div className="flex justify-between">
|
||||
<span>Used:</span>
|
||||
<span className="font-mono">{tokenUsed}</span>
|
||||
<span className="font-mono">{formatTokenNumber(tokenUsed)}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Total:</span>
|
||||
<span className="font-mono">{contextWindow}</span>
|
||||
<span className="font-mono">{formatTokenNumber(contextWindow)}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Remaining:</span>
|
||||
<span className="font-mono">
|
||||
{formatTokenNumber(parseInt(contextWindow.replace(/,/g, "")) - parseInt(tokenUsed.replace(/,/g, "")))}
|
||||
</span>
|
||||
<span className="font-mono">{formatTokenNumber(contextWindow - tokenUsed)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</AccordionItem>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cn } from "@heroui/react"
|
||||
import { isCompletedFocusChainItem, isFocusChainItem } from "@shared/focus-chain-utils"
|
||||
import { StringRequest } from "@shared/proto/cline/common"
|
||||
import { ChevronDownIcon, ChevronRightIcon } from "lucide-react"
|
||||
import { ChevronDownIcon, ChevronRightIcon, PencilIcon } from "lucide-react"
|
||||
import React, { memo, useCallback, useMemo, useState } from "react"
|
||||
import ChecklistRenderer from "@/components/common/ChecklistRenderer"
|
||||
import { FileServiceClient } from "@/services/grpc-client"
|
||||
@@ -31,46 +31,30 @@ const ToDoListHeader = memo<{
|
||||
todoInfo: TodoInfo
|
||||
isExpanded: boolean
|
||||
}>(({ todoInfo, isExpanded }) => {
|
||||
const { currentTodo, currentIndex, totalCount, completedCount, progressPercentage } = todoInfo
|
||||
const { currentTodo, currentIndex, totalCount, completedCount } = todoInfo
|
||||
const isCompleted = completedCount === totalCount
|
||||
|
||||
// Pre-compute display text
|
||||
const displayText = isCompleted ? COMPLETED_MESSAGE : currentTodo?.text || TODO_LIST_LABEL
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn("relative w-full h-full", {
|
||||
"text-success": isCompleted,
|
||||
})}>
|
||||
<div
|
||||
className={cn(
|
||||
"absolute bottom-0 left-0 transition-[width] duration-300 ease-in-out pointer-events-none z-1 h-1 bg-success",
|
||||
{
|
||||
"opacity-0": progressPercentage === 0 || progressPercentage === 100,
|
||||
},
|
||||
)}
|
||||
style={{
|
||||
width: `${100 - progressPercentage}%`,
|
||||
}}
|
||||
/>
|
||||
<div className="flex items-center justify-between gap-2 z-10 py-2.5 px-1.5">
|
||||
<div className="flex items-center gap-1.5 flex-1 min-w-0">
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-lg px-2 py-0.25 text-xs inline-block shrink-0 bg-badge-foreground/20 text-badge-foreground",
|
||||
{
|
||||
"bg-success text-black": isCompleted,
|
||||
},
|
||||
)}>
|
||||
{currentIndex}/{totalCount}
|
||||
</span>
|
||||
<span className="header-text text-xs font-medium break-words overflow-hidden text-ellipsis whitespace-nowrap max-w-[calc(100%-60px)]">
|
||||
{displayText}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between text-foreground">
|
||||
{isExpanded ? <ChevronDownIcon className="ml-0.25" size="16" /> : <ChevronRightIcon size="16" />}
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-2 z-10 py-2.5 px-1.5 relative">
|
||||
<div className="flex items-center gap-1.5 flex-1 min-w-0">
|
||||
<span
|
||||
className={cn(
|
||||
"rounded-lg px-2 py-0.25 text-xs inline-block shrink-0 bg-badge-foreground/20 text-foreground",
|
||||
{
|
||||
"bg-success text-black": isCompleted,
|
||||
},
|
||||
)}>
|
||||
{currentIndex}/{totalCount}
|
||||
</span>
|
||||
<span className="header-text text-xs font-medium break-words overflow-hidden text-ellipsis whitespace-nowrap">
|
||||
{displayText}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between text-foreground">
|
||||
{isExpanded ? <ChevronDownIcon className="ml-0.25" size="16" /> : <ChevronRightIcon size="16" />}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -158,6 +142,7 @@ const parseCurrentTodoInfo = (text: string): TodoInfo | null => {
|
||||
export const FocusChain: React.FC<FocusChainProps> = memo(
|
||||
({ currentTaskItemId, lastProgressMessageText }) => {
|
||||
const [isExpanded, setIsExpanded] = useState(false)
|
||||
const [isHoveringList, setIsHoveringList] = useState(false)
|
||||
|
||||
// Parse todo info with caching
|
||||
const todoInfo = useMemo(
|
||||
@@ -188,18 +173,78 @@ export const FocusChain: React.FC<FocusChainProps> = memo(
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative rounded-sm bg-toolbar-hover/65 flex flex-col gap-1.5 select-none hover:bg-toolbar-hover overflow-hidden opacity-80 hover:opacity-100 transition-all duration-200 cursor-pointer"
|
||||
className="relative flex flex-col gap-1.5 select-none overflow-hidden transition-[transform,box-shadow] duration-200 cursor-pointer hover:brightness-120"
|
||||
onClick={handleToggle}
|
||||
style={{
|
||||
backgroundColor: "color-mix(in srgb, var(--vscode-progressBar-background) 40%, transparent)",
|
||||
borderTopLeftRadius: 0,
|
||||
borderTopRightRadius: 0,
|
||||
borderBottomLeftRadius: "4px",
|
||||
borderBottomRightRadius: "4px",
|
||||
borderLeft: "1px solid color-mix(in srgb, var(--vscode-progressBar-background) 50%, transparent)",
|
||||
borderRight: "1px solid color-mix(in srgb, var(--vscode-progressBar-background) 50%, transparent)",
|
||||
borderBottom: "1px solid color-mix(in srgb, var(--vscode-progressBar-background) 50%, transparent)",
|
||||
width: "calc(100% - 14px)",
|
||||
marginLeft: "7px",
|
||||
marginTop: "-5.5px",
|
||||
}}
|
||||
title={CLICK_TO_EDIT_TITLE}>
|
||||
<ToDoListHeader isExpanded={isExpanded} todoInfo={todoInfo} />
|
||||
{isExpanded && (
|
||||
<div className="mx-1 pb-2 px-1 relative" onClick={handleEditClick}>
|
||||
<ChecklistRenderer text={lastProgressMessageText!} />
|
||||
{isCompleted && (
|
||||
<div className="mt-2 text-xs font-semibold text-muted-foreground">{NEW_STEPS_MESSAGE}</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* Progress bar background */}
|
||||
<div
|
||||
className="absolute inset-0 pointer-events-none"
|
||||
style={{
|
||||
background: `linear-gradient(to right, var(--vscode-progressBar-background) ${todoInfo.progressPercentage}%, transparent ${todoInfo.progressPercentage}%)`,
|
||||
opacity: 0.3,
|
||||
transition: "all 0.3s ease-in-out",
|
||||
}}
|
||||
/>
|
||||
{/* Content with higher z-index */}
|
||||
<div className="relative z-10">
|
||||
<ToDoListHeader isExpanded={isExpanded} todoInfo={todoInfo} />
|
||||
{isExpanded && (
|
||||
<div
|
||||
className="mx-1 pb-2 px-1 relative group cursor-pointer"
|
||||
onClick={handleEditClick}
|
||||
onMouseEnter={() => setIsHoveringList(true)}
|
||||
onMouseLeave={() => setIsHoveringList(false)}>
|
||||
<style>
|
||||
{`
|
||||
.focuschain-thin-scrollbar::-webkit-scrollbar {
|
||||
width: 2px;
|
||||
}
|
||||
.focuschain-thin-scrollbar::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
.focuschain-thin-scrollbar::-webkit-scrollbar-thumb {
|
||||
background: var(--vscode-scrollbarSlider-background);
|
||||
border-radius: 1px;
|
||||
}
|
||||
.focuschain-thin-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--vscode-scrollbarSlider-hoverBackground);
|
||||
}
|
||||
.focuschain-thin-scrollbar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--vscode-scrollbarSlider-background) transparent;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<div className="focuschain-thin-scrollbar">
|
||||
<ChecklistRenderer text={lastProgressMessageText!} />
|
||||
</div>
|
||||
{/* {isCompleted && (
|
||||
<div className="mt-2 text-xs font-semibold text-muted-foreground">{NEW_STEPS_MESSAGE}</div>
|
||||
)} */}
|
||||
{/* Pencil icon on hover */}
|
||||
<div
|
||||
className={cn("absolute bottom-2 right-2", isHoveringList ? "opacity-60" : "opacity-0")}
|
||||
style={{
|
||||
pointerEvents: "none",
|
||||
}}>
|
||||
<PencilIcon className="text-foreground" size={14} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
|
||||
@@ -33,7 +33,7 @@ interface TaskHeaderProps {
|
||||
onSendMessage?: (command: string, files: string[], images: string[]) => void
|
||||
}
|
||||
|
||||
const BUTTON_CLASS = "max-h-3 border-0 font-bold bg-transparent hover:opacity-100 text-badge-foreground"
|
||||
const BUTTON_CLASS = "max-h-3 border-0 font-bold bg-transparent hover:opacity-100 text-foreground"
|
||||
|
||||
const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
task,
|
||||
@@ -88,7 +88,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
const highlightedText = useMemo(() => highlightText(task.text, false), [task.text])
|
||||
|
||||
return (
|
||||
<div className={"p-2 flex flex-col gap-1.5 text-badge-foreground"}>
|
||||
<div className={"p-2 flex flex-col gap-1.5"}>
|
||||
{/* Display Checkpoint Error */}
|
||||
<CheckpointError
|
||||
checkpointManagerErrorMessage={checkpointManagerErrorMessage}
|
||||
@@ -97,10 +97,10 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
{/* Task Header */}
|
||||
<div
|
||||
className={cn(
|
||||
"relative overflow-hidden cursor-pointer text-badge-foreground rounded-sm flex flex-col gap-1.5 z-10 pt-2 pb-2 px-2 hover:opacity-100 bg-[var(--vscode-toolbar-hoverBackground)]/65",
|
||||
"relative overflow-hidden cursor-pointer rounded-sm flex flex-col gap-1.5 z-10 pt-2 pb-2 px-2 hover:opacity-100 bg-[var(--vscode-toolbar-hoverBackground)]/65",
|
||||
{
|
||||
"opacity-100 border-1 border-muted-foreground": isTaskExpanded, // No hover effects when expanded, add border
|
||||
"opacity-80 transition-opacity duration-200 hover:bg-[var(--vscode-toolbar-hoverBackground)]":
|
||||
"opacity-100 border-1 border-[var(--vscode-editorGroup-border)]": isTaskExpanded, // No hover effects when expanded, add border
|
||||
"hover:bg-[var(--vscode-toolbar-hoverBackground)] border-1 border-[var(--vscode-editorGroup-border)]":
|
||||
!isTaskExpanded, // Hover effects only when collapsed
|
||||
},
|
||||
)}>
|
||||
@@ -146,7 +146,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
|
||||
<div className="whitespace-nowrap overflow-hidden text-ellipsis flex-grow min-w-0 max-h-20 overflow-y-auto scroll-smooth">
|
||||
<div
|
||||
className={
|
||||
"ph-no-capture overflow-hidden whitespace-pre-wrap break-words px-0.5 text-sm cursor-pointer opacity-80 hover:opacity-100 transition-opacity duration-200 mt-1"
|
||||
"ph-no-capture overflow-hidden whitespace-pre-wrap break-words px-0.5 text-sm cursor-pointer mt-1"
|
||||
}>
|
||||
{highlightedText}
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getColor } from "./util"
|
||||
|
||||
// Timeline dimensions and spacing
|
||||
const TIMELINE_HEIGHT = "12px"
|
||||
const BLOCK_WIDTH = "13px"
|
||||
const BLOCK_WIDTH = "11px"
|
||||
const BLOCK_GAP = "4px"
|
||||
const _TOOLTIP_MARGIN = 32 // 32px margin on each side
|
||||
|
||||
@@ -85,11 +85,12 @@ const TaskTimeline: React.FC<TaskTimelineProps> = ({ messages, onBlockClick }) =
|
||||
<div
|
||||
style={{
|
||||
width: BLOCK_WIDTH,
|
||||
height: "100%",
|
||||
height: BLOCK_WIDTH,
|
||||
backgroundColor: "#e5e5e5", // Light gray placeholder
|
||||
flexShrink: 0,
|
||||
marginRight: BLOCK_GAP,
|
||||
opacity: 0.5,
|
||||
borderRadius: "50%",
|
||||
}}
|
||||
/>
|
||||
)
|
||||
@@ -122,13 +123,14 @@ const TaskTimeline: React.FC<TaskTimelineProps> = ({ messages, onBlockClick }) =
|
||||
onMouseLeave={handleMouseLeave}
|
||||
style={{
|
||||
width: BLOCK_WIDTH,
|
||||
height: "100%",
|
||||
height: BLOCK_WIDTH,
|
||||
backgroundColor: getColor(message),
|
||||
flexShrink: 0,
|
||||
cursor: "pointer",
|
||||
marginRight: BLOCK_GAP,
|
||||
opacity: isHovered ? 0.7 : 1,
|
||||
transition: "opacity 0.2s ease",
|
||||
borderRadius: "50%",
|
||||
}}
|
||||
/>
|
||||
</TaskTimelineTooltip>
|
||||
|
||||
@@ -17,11 +17,13 @@ const CompactTaskButton: React.FC<{
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
delay={0}
|
||||
disableAnimation={true}
|
||||
placement="bottom">
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
className={cn(
|
||||
"text-badge-foreground flex items-center text-sm font-bold hover:bg-transparent hover:opacity-80",
|
||||
"text-foreground flex items-center text-sm font-bold hover:bg-transparent hover:opacity-80",
|
||||
className,
|
||||
)}
|
||||
onClick={onClick}
|
||||
|
||||
@@ -30,7 +30,7 @@ const CopyTaskButton: React.FC<{
|
||||
onPress={() => handleCopy()}
|
||||
radius="sm"
|
||||
size="sm">
|
||||
{copied ? <CheckIcon size="14" /> : <CopyIcon size="14" />}
|
||||
{copied ? <CheckIcon size="13" /> : <CopyIcon size="13" />}
|
||||
</Button>
|
||||
</HeroTooltip>
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ const DeleteTaskButton: React.FC<{
|
||||
}}
|
||||
radius="sm"
|
||||
size="sm">
|
||||
<TrashIcon size="14" />
|
||||
<TrashIcon size="13" />
|
||||
</Button>
|
||||
</HeroTooltip>
|
||||
)
|
||||
|
||||
@@ -105,15 +105,12 @@ const ChecklistRenderer: React.FC<ChecklistRendererProps> = ({ text }) => {
|
||||
}}>
|
||||
{items.map((item, index) => (
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: Using index as key for checklist items
|
||||
<div className="flex *:items-start gap-1.5 p-0.5" key={`checklist-item-${index}`}>
|
||||
<span className={cn("text-xs shrink-0", item.checked ? "text-success" : "text-badge-foreground")}>
|
||||
<div className="flex items-start gap-1.5 p-0.5" key={`checklist-item-${index}`}>
|
||||
<span className={cn("text-xs shrink-0 mt-0.5", item.checked ? "text-success" : "text-foreground")}>
|
||||
{item.checked ? <CheckIcon size={10} /> : <CircleIcon size={10} />}
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
"text-xs shrink-0 break-words",
|
||||
item.checked ? "text-description" : "text-badge-foreground",
|
||||
)}
|
||||
className={cn("text-xs break-words flex-1", item.checked ? "text-description" : "text-foreground")}
|
||||
style={{
|
||||
textDecoration: item.checked ? "line-through" : "none",
|
||||
lineHeight: "1.3",
|
||||
|
||||
@@ -173,99 +173,102 @@ export const CheckmarkControl = ({ messageTs, isCheckpointCheckedOut }: Checkmar
|
||||
flexShrink: 0,
|
||||
}}
|
||||
/>
|
||||
<Label $isCheckedOut={isCheckpointCheckedOut}>
|
||||
{isCheckpointCheckedOut ? "Checkpoint (restored)" : "Checkpoint"}
|
||||
</Label>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} />
|
||||
<ButtonGroup>
|
||||
<CustomButton
|
||||
$isCheckedOut={isCheckpointCheckedOut}
|
||||
disabled={compareDisabled}
|
||||
onClick={async () => {
|
||||
setCompareDisabled(true)
|
||||
try {
|
||||
await CheckpointsServiceClient.checkpointDiff(
|
||||
Int64Request.create({
|
||||
value: messageTs,
|
||||
}),
|
||||
)
|
||||
} catch (err) {
|
||||
console.error("CheckpointDiff error:", err)
|
||||
} finally {
|
||||
setCompareDisabled(false)
|
||||
}
|
||||
}}
|
||||
style={{ cursor: compareDisabled ? "wait" : "pointer" }}>
|
||||
Compare
|
||||
</CustomButton>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} small />
|
||||
<div ref={refs.setReference} style={{ position: "relative", marginTop: -2 }}>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} className="hover-show-inverse" />
|
||||
<div className="hover-content">
|
||||
<Label $isCheckedOut={isCheckpointCheckedOut}>
|
||||
{isCheckpointCheckedOut ? "Checkpoint (restored)" : "Checkpoint"}
|
||||
</Label>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} />
|
||||
<ButtonGroup>
|
||||
<CustomButton
|
||||
$isCheckedOut={isCheckpointCheckedOut}
|
||||
isActive={showRestoreConfirm}
|
||||
onClick={() => setShowRestoreConfirm(true)}>
|
||||
Restore
|
||||
disabled={compareDisabled}
|
||||
onClick={async () => {
|
||||
setCompareDisabled(true)
|
||||
try {
|
||||
await CheckpointsServiceClient.checkpointDiff(
|
||||
Int64Request.create({
|
||||
value: messageTs,
|
||||
}),
|
||||
)
|
||||
} catch (err) {
|
||||
console.error("CheckpointDiff error:", err)
|
||||
} finally {
|
||||
setCompareDisabled(false)
|
||||
}
|
||||
}}
|
||||
style={{ cursor: compareDisabled ? "wait" : "pointer" }}>
|
||||
Compare
|
||||
</CustomButton>
|
||||
{showRestoreConfirm &&
|
||||
createPortal(
|
||||
<RestoreConfirmTooltip
|
||||
data-placement={placement}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
ref={refs.setFloating}
|
||||
style={floatingStyles}>
|
||||
<RestoreOption>
|
||||
<VSCodeButton
|
||||
disabled={restoreWorkspaceDisabled || isCheckpointCheckedOut}
|
||||
onClick={handleRestoreWorkspace}
|
||||
style={{
|
||||
cursor: isCheckpointCheckedOut
|
||||
? "not-allowed"
|
||||
: restoreWorkspaceDisabled
|
||||
? "wait"
|
||||
: "pointer",
|
||||
width: "100%",
|
||||
marginBottom: "10px",
|
||||
}}>
|
||||
Restore Files
|
||||
</VSCodeButton>
|
||||
<p>
|
||||
Restores your project's files back to a snapshot taken at this point (use "Compare" to see
|
||||
what will be reverted)
|
||||
</p>
|
||||
</RestoreOption>
|
||||
<RestoreOption>
|
||||
<VSCodeButton
|
||||
disabled={restoreTaskDisabled}
|
||||
onClick={handleRestoreTask}
|
||||
style={{
|
||||
cursor: restoreTaskDisabled ? "wait" : "pointer",
|
||||
width: "100%",
|
||||
marginBottom: "10px",
|
||||
}}>
|
||||
Restore Task Only
|
||||
</VSCodeButton>
|
||||
<p>Deletes messages after this point (does not affect workspace files)</p>
|
||||
</RestoreOption>
|
||||
<RestoreOption>
|
||||
<VSCodeButton
|
||||
disabled={restoreBothDisabled}
|
||||
onClick={handleRestoreBoth}
|
||||
style={{
|
||||
cursor: restoreBothDisabled ? "wait" : "pointer",
|
||||
width: "100%",
|
||||
marginBottom: "10px",
|
||||
}}>
|
||||
Restore Files & Task
|
||||
</VSCodeButton>
|
||||
<p>Restores your project's files and deletes all messages after this point</p>
|
||||
</RestoreOption>
|
||||
</RestoreConfirmTooltip>,
|
||||
document.body,
|
||||
)}
|
||||
</div>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} small />
|
||||
</ButtonGroup>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} small />
|
||||
<div ref={refs.setReference} style={{ position: "relative", marginTop: -2 }}>
|
||||
<CustomButton
|
||||
$isCheckedOut={isCheckpointCheckedOut}
|
||||
isActive={showRestoreConfirm}
|
||||
onClick={() => setShowRestoreConfirm(true)}>
|
||||
Restore
|
||||
</CustomButton>
|
||||
{showRestoreConfirm &&
|
||||
createPortal(
|
||||
<RestoreConfirmTooltip
|
||||
data-placement={placement}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
ref={refs.setFloating}
|
||||
style={floatingStyles}>
|
||||
<RestoreOption>
|
||||
<VSCodeButton
|
||||
disabled={restoreWorkspaceDisabled || isCheckpointCheckedOut}
|
||||
onClick={handleRestoreWorkspace}
|
||||
style={{
|
||||
cursor: isCheckpointCheckedOut
|
||||
? "not-allowed"
|
||||
: restoreWorkspaceDisabled
|
||||
? "wait"
|
||||
: "pointer",
|
||||
width: "100%",
|
||||
marginBottom: "10px",
|
||||
}}>
|
||||
Restore Files
|
||||
</VSCodeButton>
|
||||
<p>
|
||||
Restores your project's files back to a snapshot taken at this point (use "Compare" to
|
||||
see what will be reverted)
|
||||
</p>
|
||||
</RestoreOption>
|
||||
<RestoreOption>
|
||||
<VSCodeButton
|
||||
disabled={restoreTaskDisabled}
|
||||
onClick={handleRestoreTask}
|
||||
style={{
|
||||
cursor: restoreTaskDisabled ? "wait" : "pointer",
|
||||
width: "100%",
|
||||
marginBottom: "10px",
|
||||
}}>
|
||||
Restore Task Only
|
||||
</VSCodeButton>
|
||||
<p>Deletes messages after this point (does not affect workspace files)</p>
|
||||
</RestoreOption>
|
||||
<RestoreOption>
|
||||
<VSCodeButton
|
||||
disabled={restoreBothDisabled}
|
||||
onClick={handleRestoreBoth}
|
||||
style={{
|
||||
cursor: restoreBothDisabled ? "wait" : "pointer",
|
||||
width: "100%",
|
||||
marginBottom: "10px",
|
||||
}}>
|
||||
Restore Files & Task
|
||||
</VSCodeButton>
|
||||
<p>Restores your project's files and deletes all messages after this point</p>
|
||||
</RestoreOption>
|
||||
</RestoreConfirmTooltip>,
|
||||
document.body,
|
||||
)}
|
||||
</div>
|
||||
<DottedLine $isCheckedOut={isCheckpointCheckedOut} small />
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
@@ -277,6 +280,7 @@ const Container = styled.div<{ isMenuOpen?: boolean; $isCheckedOut?: boolean }>`
|
||||
gap: 4px;
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
min-height: 17px;
|
||||
margin-top: -10px;
|
||||
margin-bottom: -10px;
|
||||
opacity: ${(props) => (props.$isCheckedOut ? 1 : props.isMenuOpen ? 1 : 0.5)};
|
||||
@@ -284,6 +288,26 @@ const Container = styled.div<{ isMenuOpen?: boolean; $isCheckedOut?: boolean }>`
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.hover-content {
|
||||
display: ${(props) => (props.isMenuOpen ? "flex" : "none")};
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&:hover .hover-content {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.hover-show-inverse {
|
||||
display: ${(props) => (props.isMenuOpen ? "none" : "flex")};
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&:hover .hover-show-inverse {
|
||||
display: none;
|
||||
}
|
||||
`
|
||||
|
||||
const Label = styled.span<{ $isCheckedOut?: boolean }>`
|
||||
|
||||
@@ -26,6 +26,7 @@ interface WithCopyButtonProps {
|
||||
|
||||
const StyledButton = styled(VSCodeButton)`
|
||||
z-index: 1;
|
||||
transform: scale(0.9);
|
||||
`
|
||||
|
||||
// Unified container component
|
||||
@@ -49,7 +50,7 @@ const ButtonContainer = styled.div<{ $position?: "top-right" | "bottom-right" }>
|
||||
opacity: 0;
|
||||
|
||||
${ContentContainer}:hover & {
|
||||
opacity: 1;
|
||||
opacity: 0.5;
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
Reference in new issue
Block a user