Skip to content

Commit eab6128

Browse files
authored
Add workspace filter to historypreview as well (#2582)
* Add workspace filter to historypreview as well * PR feedback
1 parent 1c03234 commit eab6128

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

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

Lines changed: 19 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,17 @@ const HistoryPreview = ({ showHistoryView }: HistoryPreviewProps) => {
2626
{t("history:viewAll")}
2727
</Button>
2828
</div>
29+
<div className="flex items-center gap-2 mb-2">
30+
<Checkbox
31+
id="show-all-workspaces"
32+
checked={showAllWorkspaces}
33+
onCheckedChange={(checked) => setShowAllWorkspaces(checked === true)}
34+
variant="description"
35+
/>
36+
<label htmlFor="show-all-workspaces" className="text-xs text-vscode-foreground cursor-pointer">
37+
{t("history:showAllWorkspaces")}
38+
</label>
39+
</div>
2940
{tasks.slice(0, 3).map((item) => (
3041
<div
3142
key={item.id}
@@ -74,6 +85,12 @@ const HistoryPreview = ({ showHistoryView }: HistoryPreviewProps) => {
7485
</>
7586
)}
7687
</div>
88+
{showAllWorkspaces && item.workspace && (
89+
<div className="flex flex-row gap-1 text-vscode-descriptionForeground text-xs mt-1">
90+
<span className="codicon codicon-folder scale-80" />
91+
<span>{item.workspace}</span>
92+
</div>
93+
)}
7794
</div>
7895
</div>
7996
))}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,16 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
156156
</VSCodeRadio>
157157
</VSCodeRadioGroup>
158158

159-
<div className="flex items-center gap-2" onClick={() => setShowAllWorkspaces(!showAllWorkspaces)}>
159+
<div className="flex items-center gap-2">
160160
<Checkbox
161+
id="show-all-workspaces-view"
161162
checked={showAllWorkspaces}
162163
onCheckedChange={(checked) => setShowAllWorkspaces(checked === true)}
163164
variant="description"
164165
/>
165-
<span className="text-vscode-foreground">{t("history:showAllWorkspaces")}</span>
166+
<label htmlFor="show-all-workspaces-view" className="text-vscode-foreground cursor-pointer">
167+
{t("history:showAllWorkspaces")}
168+
</label>
166169
</div>
167170

168171
{/* Select all control in selection mode */}

0 commit comments

Comments
 (0)