Skip to content

Commit 3f688ea

Browse files
author
Bruno Bergher
committed
Additional visual cleanup, tweaks to make this work in the full history view
1 parent b86602b commit 3f688ea

File tree

9 files changed

+46
-90
lines changed

9 files changed

+46
-90
lines changed

webview-ui/src/components/common/VersionIndicator.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const VersionIndicator: React.FC<VersionIndicatorProps> = ({ onClick, className
1313
return (
1414
<button
1515
onClick={onClick}
16-
className={`text-xs text-vscode-descriptionForeground hover:text-vscode-foreground transition-colors cursor-pointer px-2 py-1 rounded border border-vscode-panel-border hover:border-vscode-focusBorder ${className}`}
16+
className={`text-xs text-vscode-descriptionForeground hover:text-vscode-foreground transition-colors cursor-pointer px-2 py-1 rounded border ${className}`}
1717
aria-label={t("chat:versionIndicator.ariaLabel", { version: Package.version })}>
1818
v{Package.version}
1919
</button>

webview-ui/src/components/history/DeleteButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const DeleteButton = ({ itemId, onDelete }: DeleteButtonProps) => {
3131
size="icon"
3232
data-testid="delete-task-button"
3333
onClick={handleDeleteClick}
34-
className="group-hover:opacity-100 opacity-50 transition-opacity">
34+
className="opacity-70">
3535
<span className="codicon codicon-trash size-4 align-middle text-vscode-descriptionForeground" />
3636
</Button>
3737
</StandardTooltip>

webview-ui/src/components/history/HistoryPreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const HistoryPreview = () => {
1818
<div className="flex flex-col gap-3">
1919
{tasks.length !== 0 && (
2020
<>
21-
{tasks.slice(0, 5).map((item) => (
21+
{tasks.slice(0, 3).map((item) => (
2222
<TaskItem key={item.id} item={item} variant="compact" />
2323
))}
2424
<button

webview-ui/src/components/history/HistoryView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
222222
</div>
223223
</TabHeader>
224224

225-
<TabContent className="p-0">
225+
<TabContent className="px-2 py-0">
226226
<Virtuoso
227227
className="flex-1 overflow-y-scroll"
228228
data={tasks}
@@ -243,15 +243,15 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
243243
isSelected={selectedTaskIds.includes(item.id)}
244244
onToggleSelection={toggleTaskSelection}
245245
onDelete={setDeleteTaskId}
246-
className="m-2 mr-0"
246+
className="m-2"
247247
/>
248248
)}
249249
/>
250250
</TabContent>
251251

252252
{/* Fixed action bar at bottom - only shown in selection mode with selected items */}
253253
{isSelectionMode && selectedTaskIds.length > 0 && (
254-
<div className="fixed bottom-0 left-0 right-0 bg-vscode-editor-background border-t border-vscode-panel-border p-2 flex justify-between items-center">
254+
<div className="fixed bottom-0 left-0 right-2 bg-vscode-editor-background border-t border-vscode-panel-border p-2 flex justify-between items-center">
255255
<div className="text-vscode-foreground">
256256
{t("history:selectedItems", { selected: selectedTaskIds.length, total: tasks.length })}
257257
</div>

webview-ui/src/components/history/TaskItem.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { vscode } from "@/utils/vscode"
55
import { cn } from "@/lib/utils"
66
import { Checkbox } from "@/components/ui/checkbox"
77

8-
import TaskItemHeader from "./TaskItemHeader"
98
import TaskItemFooter from "./TaskItemFooter"
109

1110
interface DisplayHistoryItem extends HistoryItem {
@@ -52,7 +51,7 @@ const TaskItem = ({
5251
className,
5352
)}
5453
onClick={handleClick}>
55-
<div className="flex gap-2 p-3">
54+
<div className={(!isCompact && isSelectionMode ? "pl-3 pb-3" : "pl-4") + " flex gap-3 px-3 pt-3 pb-1"}>
5655
{/* Selection checkbox - only in full variant */}
5756
{!isCompact && isSelectionMode && (
5857
<div
@@ -69,26 +68,25 @@ const TaskItem = ({
6968
)}
7069

7170
<div className="flex-1 min-w-0">
72-
{/* Header with metadata */}
73-
<TaskItemHeader item={item} isSelectionMode={isSelectionMode} onDelete={onDelete} />
74-
75-
{/* Task content - always show up to 3 lines */}
7671
<div
7772
className={cn(
78-
"overflow-hidden whitespace-pre-wrap text-vscode-foreground text-ellipsis line-clamp-3",
73+
"overflow-hidden whitespace-pre-wrap text-vscode-foreground text-ellipsis line-clamp-2",
7974
{
8075
"text-base": !isCompact,
8176
},
77+
!isCompact && isSelectionMode ? "mb-1" : "",
8278
)}
8379
data-testid="task-content"
8480
{...(item.highlight ? { dangerouslySetInnerHTML: { __html: item.highlight } } : {})}>
8581
{item.highlight ? undefined : item.task}
8682
</div>
83+
<TaskItemFooter
84+
item={item}
85+
variant={variant}
86+
isSelectionMode={isSelectionMode}
87+
onDelete={onDelete}
88+
/>
8789

88-
{/* Task Item Footer */}
89-
<TaskItemFooter item={item} variant={variant} isSelectionMode={isSelectionMode} />
90-
91-
{/* Workspace info */}
9290
{showWorkspace && item.workspace && (
9391
<div className="flex flex-row gap-1 text-vscode-descriptionForeground text-xs mt-1">
9492
<span className="codicon codicon-folder scale-80" />

webview-ui/src/components/history/TaskItemFooter.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,25 @@ import type { HistoryItem } from "@roo-code/types"
33
import { formatTimeAgo } from "@/utils/format"
44
import { CopyButton } from "./CopyButton"
55
import { ExportButton } from "./ExportButton"
6+
import { DeleteButton } from "./DeleteButton"
7+
import { StandardTooltip } from "../ui/standard-tooltip"
68

79
export interface TaskItemFooterProps {
810
item: HistoryItem
911
variant: "compact" | "full"
1012
isSelectionMode?: boolean
13+
onDelete?: (taskId: string) => void
1114
}
1215

13-
const TaskItemFooter: React.FC<TaskItemFooterProps> = ({ item, variant, isSelectionMode = false }) => {
16+
const TaskItemFooter: React.FC<TaskItemFooterProps> = ({ item, variant, isSelectionMode = false, onDelete }) => {
1417
return (
15-
<div className="text-xs text-vscode-descriptionForeground flex justify-between items-center mt-1">
16-
<div className="flex gap-3 items-center">
18+
<div className="text-xs text-vscode-descriptionForeground flex justify-between items-center">
19+
<div className="flex gap-2 items-center text-vscode-descriptionForeground/60">
1720
{/* Datetime with time-ago format */}
18-
<span className="text-vscode-descriptionForeground">{formatTimeAgo(item.ts)}</span>
19-
21+
<StandardTooltip content={new Date(item.ts).toLocaleString()}>
22+
<span className="capitalize">{formatTimeAgo(item.ts)}</span>
23+
</StandardTooltip>
24+
<span>·</span>
2025
{/* Cost */}
2126
{!!item.totalCost && (
2227
<span className="flex items-center" data-testid="cost-footer-compact">
@@ -27,9 +32,10 @@ const TaskItemFooter: React.FC<TaskItemFooterProps> = ({ item, variant, isSelect
2732

2833
{/* Action Buttons for non-compact view */}
2934
{!isSelectionMode && (
30-
<div className="flex flex-row gap-0 items-center opacity-50 hover:opacity-100">
35+
<div className="flex flex-row gap-0 items-center text-vscode-descriptionForeground/60 hover:text-vscode-descriptionForeground">
3136
<CopyButton itemTask={item.task} />
3237
{variant === "full" && <ExportButton itemId={item.id} />}
38+
{onDelete && <DeleteButton itemId={item.id} onDelete={onDelete} />}
3339
</div>
3440
)}
3541
</div>

webview-ui/src/components/history/TaskItemHeader.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

webview-ui/src/components/history/__tests__/TaskItemFooter.spec.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,24 @@ describe("TaskItemFooter", () => {
5656
// Should not show any action buttons
5757
expect(screen.queryByTestId("copy-prompt-button")).not.toBeInTheDocument()
5858
expect(screen.queryByTestId("export")).not.toBeInTheDocument()
59+
expect(screen.queryByTestId("delete-task-button")).not.toBeInTheDocument()
60+
})
61+
62+
it("shows delete button when not in selection mode and onDelete is provided", () => {
63+
render(<TaskItemFooter item={mockItem} variant="full" isSelectionMode={false} onDelete={vi.fn()} />)
64+
65+
expect(screen.getByTestId("delete-task-button")).toBeInTheDocument()
66+
})
67+
68+
it("does not show delete button in selection mode", () => {
69+
render(<TaskItemFooter item={mockItem} variant="full" isSelectionMode={true} onDelete={vi.fn()} />)
70+
71+
expect(screen.queryByTestId("delete-task-button")).not.toBeInTheDocument()
72+
})
73+
74+
it("does not show delete button when onDelete is not provided", () => {
75+
render(<TaskItemFooter item={mockItem} variant="full" isSelectionMode={false} />)
76+
77+
expect(screen.queryByTestId("delete-task-button")).not.toBeInTheDocument()
5978
})
6079
})

webview-ui/src/components/history/__tests__/TaskItemHeader.spec.tsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)