From be662c228431240a00a23b4d31ea9aac3fa6da43 Mon Sep 17 00:00:00 2001 From: tomasz-io Date: Mon, 10 Mar 2025 15:15:54 -0700 Subject: [PATCH] improv: state from local storage --- gui/src/components/ExploreHubCard/index.tsx | 6 +++++- gui/src/redux/slices/uiSlice.ts | 3 ++- gui/src/util/localStorage.ts | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gui/src/components/ExploreHubCard/index.tsx b/gui/src/components/ExploreHubCard/index.tsx index 715c22dea..10f2274b7 100644 --- a/gui/src/components/ExploreHubCard/index.tsx +++ b/gui/src/components/ExploreHubCard/index.tsx @@ -2,6 +2,7 @@ import { ChevronRightIcon } from "@heroicons/react/24/outline"; import { Button, ButtonSubtext } from ".."; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { setIsExploreDialogOpen } from "../../redux/slices/uiSlice"; +import { setLocalStorage } from "../../util/localStorage"; import { ReusableCard } from "../ReusableCard"; export function ExploreHubCard() { @@ -13,7 +14,10 @@ export function ExploreHubCard() { return ( dispatch(setIsExploreDialogOpen(false))} + onClose={() => { + setLocalStorage("isExploreDialogOpen", false); + return dispatch(setIsExploreDialogOpen(false)); + }} >

Create Your Own Assistant

diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts index fe54f388c..3362fc0a2 100644 --- a/gui/src/redux/slices/uiSlice.ts +++ b/gui/src/redux/slices/uiSlice.ts @@ -5,6 +5,7 @@ import { defaultOnboardingCardState, OnboardingCardState, } from "../../components/OnboardingCard"; +import { getLocalStorage } from "../../util/localStorage"; type ToolSetting = | "allowedWithPermission" @@ -32,7 +33,7 @@ export const uiSlice = createSlice({ dialogMessage: "", dialogEntryOn: false, onboardingCard: defaultOnboardingCardState, - isExploreDialogOpen: false, + isExploreDialogOpen: getLocalStorage("isExploreDialogOpen"), shouldAddFileForEditing: false, ttsActive: false, useTools: false, diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts index e80e4ceea..b1863de3a 100644 --- a/gui/src/util/localStorage.ts +++ b/gui/src/util/localStorage.ts @@ -2,6 +2,7 @@ import { JSONContent } from "@tiptap/react"; import { OnboardingStatus } from "../components/OnboardingCard"; type LocalStorageTypes = { + isExploreDialogOpen: boolean; onboardingStatus?: OnboardingStatus; hasDismissedOnboardingCard: boolean; mainTextEntryCounter: number;