Skip to content

Commit b4cc977

Browse files
committed
feat: add navigation link to history tab in HistoryPreview
- Add 'View all history' link at bottom of history preview - Include internationalization support with new translation key - Use consistent styling with VSCode theme colors - Navigate to history tab using switchTab message format
1 parent 84bfd76 commit b4cc977

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import { memo } from "react"
22

3+
import { vscode } from "@src/utils/vscode"
4+
import { useAppTranslation } from "@src/i18n/TranslationContext"
5+
36
import { useTaskSearch } from "./useTaskSearch"
47
import TaskItem from "./TaskItem"
58

69
const HistoryPreview = () => {
710
const { tasks } = useTaskSearch()
11+
const { t } = useAppTranslation()
12+
13+
const handleViewAllHistory = () => {
14+
vscode.postMessage({ type: "switchTab", tab: "history" })
15+
}
816

917
return (
1018
<div className="flex flex-col gap-3">
@@ -13,6 +21,13 @@ const HistoryPreview = () => {
1321
{tasks.slice(0, 3).map((item) => (
1422
<TaskItem key={item.id} item={item} variant="compact" />
1523
))}
24+
<button
25+
onClick={handleViewAllHistory}
26+
className="text-xs text-vscode-descriptionForeground hover:text-vscode-textLink-foreground transition-colors cursor-pointer text-left flex items-center gap-1 mt-1"
27+
aria-label={t("history:viewAllHistory")}>
28+
<span>{t("history:viewAllHistory")}</span>
29+
<span className="codicon codicon-arrow-right text-xs" />
30+
</button>
1631
</>
1732
)}
1833
</div>

webview-ui/src/i18n/locales/en/history.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@
4040
"mostExpensive": "Most Expensive",
4141
"mostTokens": "Most Tokens",
4242
"mostRelevant": "Most Relevant"
43-
}
43+
},
44+
"viewAllHistory": "View all history"
4445
}

0 commit comments

Comments
 (0)