Skip to content

Commit 0be6743

Browse files
authored
Fix: add favorite button back to tasks (#2184)
1 parent b5001a3 commit 0be6743

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

.changeset/free-socks-shake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Fix: add favorite button back to tasks

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { formatTimeAgo } from "@/utils/format"
44
import { CopyButton } from "./CopyButton"
55
import { ExportButton } from "./ExportButton"
66
import { DeleteButton } from "./DeleteButton"
7+
import { FavoriteButton } from "../kilocode/history/FavoriteButton" // kilocode_change
78
import { StandardTooltip } from "../ui/standard-tooltip"
89

910
export interface TaskItemFooterProps {
@@ -34,6 +35,7 @@ const TaskItemFooter: React.FC<TaskItemFooterProps> = ({ item, variant, isSelect
3435
{!isSelectionMode && (
3536
<div className="flex flex-row gap-0 items-center text-vscode-descriptionForeground/60 hover:text-vscode-descriptionForeground">
3637
<CopyButton itemTask={item.task} />
38+
<FavoriteButton isFavorited={item.isFavorited ?? false} id={item.id} />
3739
{variant === "full" && <ExportButton itemId={item.id} />}
3840
{onDelete && <DeleteButton itemId={item.id} onDelete={onDelete} />}
3941
</div>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { vscode } from "@/utils/vscode"
2+
import { Button } from "@src/components/ui"
3+
import { useAppTranslation } from "@/i18n/TranslationContext"
4+
5+
export const FavoriteButton = ({ id, isFavorited }: { id: string; isFavorited: boolean }) => {
6+
const { t } = useAppTranslation()
7+
8+
return (
9+
<Button
10+
variant="ghost"
11+
size="icon"
12+
title={isFavorited ? t("history:unfavoriteTask") : t("history:favoriteTask")}
13+
data-testid="favorite-task-button"
14+
onClick={(e: React.MouseEvent) => {
15+
e.stopPropagation()
16+
vscode.postMessage({ type: "toggleTaskFavorite", text: id })
17+
}}
18+
className={`group-hover:opacity-100 transition-opacity ${isFavorited ? "opacity-70" : "opacity-50"}`}>
19+
<span className={`codicon ${isFavorited ? "codicon-star-full" : "codicon-star-empty"}`} />
20+
</Button>
21+
)
22+
}

0 commit comments

Comments
 (0)