mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-07 02:58:15 +00:00
Add navigation link to history tab in HistoryPreview (#5630)
* 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 * feat: add viewAllHistory translation to all language files * Tweaks and translations * Fix test --------- Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
This commit is contained in:
parent
5bffebde58
commit
2220a2d2ba
20 changed files with 58 additions and 26 deletions
|
|
@ -1,18 +1,32 @@
|
|||
import { memo } from "react"
|
||||
|
||||
import { vscode } from "@src/utils/vscode"
|
||||
import { useAppTranslation } from "@src/i18n/TranslationContext"
|
||||
|
||||
import { useTaskSearch } from "./useTaskSearch"
|
||||
import TaskItem from "./TaskItem"
|
||||
|
||||
const HistoryPreview = () => {
|
||||
const { tasks } = useTaskSearch()
|
||||
const { t } = useAppTranslation()
|
||||
|
||||
const handleViewAllHistory = () => {
|
||||
vscode.postMessage({ type: "switchTab", tab: "history" })
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-3">
|
||||
{tasks.length !== 0 && (
|
||||
<>
|
||||
{tasks.slice(0, 3).map((item) => (
|
||||
{tasks.slice(0, 2).map((item) => (
|
||||
<TaskItem key={item.id} item={item} variant="compact" />
|
||||
))}
|
||||
<button
|
||||
onClick={handleViewAllHistory}
|
||||
className="text-base text-vscode-descriptionForeground hover:text-vscode-textLink-foreground transition-colors cursor-pointer text-center w-full bg-vscode-editor-background rounded p-3 hover:border-vscode-toolbar-hoverBackground/60"
|
||||
aria-label={t("history:viewAllHistory")}>
|
||||
{t("history:viewAllHistory")}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ describe("HistoryPreview", () => {
|
|||
expect(screen.queryByTestId(/task-item-/)).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders up to 3 tasks when tasks are available", () => {
|
||||
it("renders up to 2 tasks when tasks are available", () => {
|
||||
mockUseTaskSearch.mockReturnValue({
|
||||
tasks: mockTasks,
|
||||
searchQuery: "",
|
||||
|
|
@ -101,17 +101,17 @@ describe("HistoryPreview", () => {
|
|||
|
||||
render(<HistoryPreview />)
|
||||
|
||||
// Should render only the first 3 tasks
|
||||
// Should render only the first 2 tasks
|
||||
expect(screen.getByTestId("task-item-task-1")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("task-item-task-2")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("task-item-task-3")).toBeInTheDocument()
|
||||
expect(screen.queryByTestId("task-item-task-3")).not.toBeInTheDocument()
|
||||
expect(screen.queryByTestId("task-item-task-4")).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders all tasks when there are 3 or fewer", () => {
|
||||
const threeTasks = mockTasks.slice(0, 3)
|
||||
it("renders all tasks when there are 2 or fewer", () => {
|
||||
const twoTasks = mockTasks.slice(0, 2)
|
||||
mockUseTaskSearch.mockReturnValue({
|
||||
tasks: threeTasks,
|
||||
tasks: twoTasks,
|
||||
searchQuery: "",
|
||||
setSearchQuery: vi.fn(),
|
||||
sortOption: "newest",
|
||||
|
|
@ -126,7 +126,7 @@ describe("HistoryPreview", () => {
|
|||
|
||||
expect(screen.getByTestId("task-item-task-1")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("task-item-task-2")).toBeInTheDocument()
|
||||
expect(screen.getByTestId("task-item-task-3")).toBeInTheDocument()
|
||||
expect(screen.queryByTestId("task-item-task-3")).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it("renders only 1 task when there is only 1 task", () => {
|
||||
|
|
|
|||
|
|
@ -47,5 +47,6 @@
|
|||
"mostExpensive": "Més cares",
|
||||
"mostTokens": "Més tokens",
|
||||
"mostRelevant": "Més rellevants"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Veure totes les tasques"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,5 +47,6 @@
|
|||
"mostExpensive": "Teuerste",
|
||||
"mostTokens": "Meiste Tokens",
|
||||
"mostRelevant": "Relevanteste"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Gesamten Verlauf anzeigen"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Most Expensive",
|
||||
"mostTokens": "Most Tokens",
|
||||
"mostRelevant": "Most Relevant"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "View all tasks"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,5 +47,6 @@
|
|||
"mostExpensive": "Más costosas",
|
||||
"mostTokens": "Más tokens",
|
||||
"mostRelevant": "Más relevantes"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Ver todo el historial"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,5 +47,6 @@
|
|||
"mostExpensive": "Plus coûteuses",
|
||||
"mostTokens": "Plus de tokens",
|
||||
"mostRelevant": "Plus pertinentes"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Voir tout l'historique"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "सबसे महंगा",
|
||||
"mostTokens": "सबसे अधिक टोकन",
|
||||
"mostRelevant": "सबसे प्रासंगिक"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "सभी कार्य देखें"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,5 +49,6 @@
|
|||
"mostExpensive": "Termahal",
|
||||
"mostTokens": "Token Terbanyak",
|
||||
"mostRelevant": "Paling Relevan"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Lihat semua tugas"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Più costose",
|
||||
"mostTokens": "Più token",
|
||||
"mostRelevant": "Più rilevanti"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Visualizza tutta la cronologia"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "最も高価",
|
||||
"mostTokens": "最多トークン",
|
||||
"mostRelevant": "最も関連性の高い"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "すべての履歴を表示"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "가장 비싼순",
|
||||
"mostTokens": "토큰 많은순",
|
||||
"mostRelevant": "관련성 높은순"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "모든 기록 보기"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Duurste",
|
||||
"mostTokens": "Meeste tokens",
|
||||
"mostRelevant": "Meest relevant"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Alle geschiedenis bekijken"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Najdroższe",
|
||||
"mostTokens": "Najwięcej tokenów",
|
||||
"mostRelevant": "Najbardziej trafne"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Zobacz wszystkie zadania"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Mais caras",
|
||||
"mostTokens": "Mais tokens",
|
||||
"mostRelevant": "Mais relevantes"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Ver todo o histórico"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Самые дорогие",
|
||||
"mostTokens": "Больше всего токенов",
|
||||
"mostRelevant": "Наиболее релевантные"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Просмотреть всю историю"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "En Pahalı",
|
||||
"mostTokens": "En Çok Token",
|
||||
"mostRelevant": "En İlgili"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Tüm görevleri görüntüle"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "Đắt nhất",
|
||||
"mostTokens": "Nhiều token nhất",
|
||||
"mostRelevant": "Liên quan nhất"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "Xem tất cả nhiệm vụ"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "费用最高",
|
||||
"mostTokens": "最多 Token",
|
||||
"mostRelevant": "最相关"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "查看所有历史记录"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@
|
|||
"mostExpensive": "費用最高",
|
||||
"mostTokens": "最多 Token",
|
||||
"mostRelevant": "最相關"
|
||||
}
|
||||
},
|
||||
"viewAllHistory": "檢視所有工作"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue