Skip to content

Commit 3695ca1

Browse files
committed
Add workspace filter to historypreview as well
1 parent 1c03234 commit 3695ca1

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { memo } from "react"
22

33
import { vscode } from "@/utils/vscode"
44
import { formatLargeNumber, formatDate } from "@/utils/format"
5-
import { Button } from "@/components/ui"
5+
import { Button, Checkbox } from "@/components/ui"
66

77
import { useAppTranslation } from "../../i18n/TranslationContext"
88
import { CopyButton } from "./CopyButton"
@@ -12,7 +12,7 @@ type HistoryPreviewProps = {
1212
showHistoryView: () => void
1313
}
1414
const HistoryPreview = ({ showHistoryView }: HistoryPreviewProps) => {
15-
const { tasks } = useTaskSearch()
15+
const { tasks, showAllWorkspaces, setShowAllWorkspaces } = useTaskSearch()
1616
const { t } = useAppTranslation()
1717

1818
return (
@@ -26,6 +26,14 @@ const HistoryPreview = ({ showHistoryView }: HistoryPreviewProps) => {
2626
{t("history:viewAll")}
2727
</Button>
2828
</div>
29+
<div className="flex items-center gap-2 mb-2" onClick={() => setShowAllWorkspaces(!showAllWorkspaces)}>
30+
<Checkbox
31+
checked={showAllWorkspaces}
32+
onCheckedChange={(checked) => setShowAllWorkspaces(checked === true)}
33+
variant="description"
34+
/>
35+
<span className="text-xs text-vscode-foreground">{t("history:showAllWorkspaces")}</span>
36+
</div>
2937
{tasks.slice(0, 3).map((item) => (
3038
<div
3139
key={item.id}
@@ -74,6 +82,12 @@ const HistoryPreview = ({ showHistoryView }: HistoryPreviewProps) => {
7482
</>
7583
)}
7684
</div>
85+
{showAllWorkspaces && item.workspace && (
86+
<div className="flex flex-row gap-1 text-vscode-descriptionForeground text-xs mt-1">
87+
<span className="codicon codicon-folder scale-80" />
88+
<span>{item.workspace}</span>
89+
</div>
90+
)}
7791
</div>
7892
</div>
7993
))}

0 commit comments

Comments
 (0)