summaryrefslogtreecommitdiff
path: root/extension/react-app/src/pages/history.tsx
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-08-25 16:59:02 -0700
committerNate Sesti <sestinj@gmail.com>2023-08-25 16:59:02 -0700
commit0757bd2b556996b9c434ac43e3e4a3b042ef5802 (patch)
tree80ea56eda32ed816be4320dd00065cc323defc97 /extension/react-app/src/pages/history.tsx
parente17be65cd6c391f5b7854ca7a6b02bfee90c0039 (diff)
downloadsncontinue-0757bd2b556996b9c434ac43e3e4a3b042ef5802.tar.gz
sncontinue-0757bd2b556996b9c434ac43e3e4a3b042ef5802.tar.bz2
sncontinue-0757bd2b556996b9c434ac43e3e4a3b042ef5802.zip
feat: :sparkles: filter history by workspace
Diffstat (limited to 'extension/react-app/src/pages/history.tsx')
-rw-r--r--extension/react-app/src/pages/history.tsx21
1 files changed, 21 insertions, 0 deletions
diff --git a/extension/react-app/src/pages/history.tsx b/extension/react-app/src/pages/history.tsx
index 2eb895b1..2a3070e6 100644
--- a/extension/react-app/src/pages/history.tsx
+++ b/extension/react-app/src/pages/history.tsx
@@ -7,6 +7,7 @@ import { useNavigate } from "react-router-dom";
import { secondaryDark, vscBackground } from "../components";
import styled from "styled-components";
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
+import CheckDiv from "../components/CheckDiv";
const Tr = styled.tr`
&:hover {
@@ -36,6 +37,11 @@ function History() {
const [sessions, setSessions] = useState<SessionInfo[]>([]);
const client = useContext(GUIClientContext);
const apiUrl = useSelector((state: RootStore) => state.config.apiUrl);
+ const workspacePaths = useSelector(
+ (state: RootStore) => state.config.workspacePaths
+ );
+
+ const [filteringByWorkspace, setFilteringByWorkspace] = useState(false);
useEffect(() => {
const fetchSessions = async () => {
@@ -67,9 +73,24 @@ function History() {
/>
<h1 className="text-2xl font-bold m-4 inline-block">History</h1>
</div>
+ <CheckDiv
+ checked={filteringByWorkspace}
+ onClick={() => setFilteringByWorkspace((prev) => !prev)}
+ title="Filter by workspace"
+ />
<table className="w-full">
<tbody>
{sessions
+ .filter((session) => {
+ if (
+ !filteringByWorkspace ||
+ typeof workspacePaths === "undefined" ||
+ typeof session.workspace_directory === "undefined"
+ ) {
+ return true;
+ }
+ return workspacePaths.includes(session.workspace_directory);
+ })
.sort(
(a, b) =>
parseDate(b.date_created).getTime() -