From fee6a1e5ceb89c44a018b6a771065dea276268a9 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 26 Sep 2024 18:47:18 -0700 Subject: [PATCH] remove bottom message div --- gui/src/components/Layout.tsx | 58 ++------------------- gui/src/redux/selectors/uiStateSelectors.ts | 5 -- gui/src/redux/slices/uiStateSlice.ts | 31 +---------- 3 files changed, 6 insertions(+), 88 deletions(-) delete mode 100644 gui/src/redux/selectors/uiStateSelectors.ts diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index d012194a3..a75fe834e 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -3,31 +3,22 @@ import { useContext, useEffect } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; import styled from "styled-components"; -import { - CustomScrollbarDiv, - defaultBorderRadius, - vscForeground, - vscInputBackground, -} from "."; +import { CustomScrollbarDiv, defaultBorderRadius, vscInputBackground } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; +import { setShowDialog } from "../redux/slices/uiStateSlice"; import { RootState } from "../redux/store"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; +import ButtonWithTooltip from "./ButtonWithTooltip"; import TextDialog from "./dialogs"; import ProgressBar from "./loaders/ProgressBar"; +import { useOnboardingCard } from "./OnboardingCard"; +import { isNewUserOnboarding } from "./OnboardingCard/utils"; import PostHogPageView from "./PosthogPageView"; import ProfileSwitcher from "./ProfileSwitcher"; -import { isNewUserOnboarding } from "./OnboardingCard/utils"; -import { useOnboardingCard } from "./OnboardingCard"; -import { - setBottomMessage, - setBottomMessageCloseTimeout, - setShowDialog, -} from "../redux/slices/uiStateSlice"; -import ButtonWithTooltip from "./ButtonWithTooltip"; const FOOTER_HEIGHT = "1.8em"; @@ -48,23 +39,6 @@ const LayoutTopDiv = styled(CustomScrollbarDiv)` } `; -const BottomMessageDiv = styled.div<{ displayOnBottom: boolean }>` - position: fixed; - bottom: ${(props) => (props.displayOnBottom ? "50px" : undefined)}; - top: ${(props) => (props.displayOnBottom ? undefined : "50px")}; - left: 0; - right: 0; - margin: 8px; - margin-top: 0; - background-color: ${vscInputBackground}; - color: ${vscForeground}; - border-radius: ${defaultBorderRadius}; - padding: 12px; - z-index: 100; - box-shadow: 0px 0px 2px 0px ${vscForeground}; - max-height: 35vh; -`; - const Footer = styled.footer` display: flex; flex-direction: row; @@ -120,13 +94,6 @@ const Layout = () => { const defaultModel = useSelector(defaultModelSelector); - const bottomMessage = useSelector( - (state: RootState) => state.uiState.bottomMessage, - ); - const displayBottomMessageOnBottom = useSelector( - (state: RootState) => state.uiState.displayBottomMessageOnBottom, - ); - const timeline = useSelector((state: RootState) => state.state.history); useEffect(() => { @@ -264,21 +231,6 @@ const Layout = () => { - - { - dispatch(setBottomMessageCloseTimeout(undefined)); - }} - onMouseLeave={(e) => { - if (!e.buttons) { - dispatch(setBottomMessage(undefined)); - } - }} - hidden={!bottomMessage} - > - {bottomMessage} -
state.uiState.bottomMessage; - -export { selectBottomMessage }; diff --git a/gui/src/redux/slices/uiStateSlice.ts b/gui/src/redux/slices/uiStateSlice.ts index d4c4f7390..94a5f2934 100644 --- a/gui/src/redux/slices/uiStateSlice.ts +++ b/gui/src/redux/slices/uiStateSlice.ts @@ -5,9 +5,6 @@ import { } from "../../components/OnboardingCard"; type UiState = { - bottomMessage: JSX.Element | undefined; - bottomMessageCloseTimeout: NodeJS.Timeout | undefined; - displayBottomMessageOnBottom: boolean; showDialog: boolean; dialogMessage: string | JSX.Element | undefined; dialogEntryOn: boolean; @@ -18,12 +15,9 @@ type UiState = { export const uiStateSlice = createSlice({ name: "uiState", initialState: { - bottomMessage: undefined, - bottomMessageCloseTimeout: undefined, showDialog: false, dialogMessage: "", dialogEntryOn: false, - displayBottomMessageOnBottom: true, nextCodeBlockToApplyIndex: 0, onboardingCard: defaultOnboardingCardState, } as UiState, @@ -34,21 +28,6 @@ export const uiStateSlice = createSlice({ ) => { state.onboardingCard = { ...state.onboardingCard, ...action.payload }; }, - setBottomMessage: ( - state, - action: PayloadAction, - ) => { - state.bottomMessage = action.payload; - }, - setBottomMessageCloseTimeout: ( - state, - action: PayloadAction, - ) => { - if (state.bottomMessageCloseTimeout) { - clearTimeout(state.bottomMessageCloseTimeout); - } - state.bottomMessageCloseTimeout = action.payload; - }, setDialogMessage: ( state, action: PayloadAction, @@ -64,12 +43,7 @@ export const uiStateSlice = createSlice({ setShowDialog: (state, action: PayloadAction) => { state.showDialog = action.payload; }, - setDisplayBottomMessageOnBottom: ( - state, - action: PayloadAction, - ) => { - state.displayBottomMessageOnBottom = action.payload; - }, + resetNextCodeBlockToApplyIndex: (state) => { state.nextCodeBlockToApplyIndex = 0; }, @@ -86,9 +60,6 @@ export const { setShowDialog, resetNextCodeBlockToApplyIndex, incrementNextCodeBlockToApplyIndex, - setBottomMessage, - setBottomMessageCloseTimeout, - setDisplayBottomMessageOnBottom, } = uiStateSlice.actions; export default uiStateSlice.reducer;