remove bottom message div
This commit is contained in:
parent
1f055916e1
commit
fee6a1e5ce
3 changed files with 6 additions and 88 deletions
|
|
@ -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 = () => {
|
|||
</ButtonWithTooltip>
|
||||
</Footer>
|
||||
</GridDiv>
|
||||
|
||||
<BottomMessageDiv
|
||||
displayOnBottom={displayBottomMessageOnBottom}
|
||||
onMouseEnter={() => {
|
||||
dispatch(setBottomMessageCloseTimeout(undefined));
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
if (!e.buttons) {
|
||||
dispatch(setBottomMessage(undefined));
|
||||
}
|
||||
}}
|
||||
hidden={!bottomMessage}
|
||||
>
|
||||
{bottomMessage}
|
||||
</BottomMessageDiv>
|
||||
</div>
|
||||
<div
|
||||
style={{ fontSize: `${getFontSize() - 4}px` }}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
import { RootState } from "../store";
|
||||
|
||||
const selectBottomMessage = (state: RootState) => state.uiState.bottomMessage;
|
||||
|
||||
export { selectBottomMessage };
|
||||
|
|
@ -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<UiState["bottomMessage"]>,
|
||||
) => {
|
||||
state.bottomMessage = action.payload;
|
||||
},
|
||||
setBottomMessageCloseTimeout: (
|
||||
state,
|
||||
action: PayloadAction<UiState["bottomMessageCloseTimeout"]>,
|
||||
) => {
|
||||
if (state.bottomMessageCloseTimeout) {
|
||||
clearTimeout(state.bottomMessageCloseTimeout);
|
||||
}
|
||||
state.bottomMessageCloseTimeout = action.payload;
|
||||
},
|
||||
setDialogMessage: (
|
||||
state,
|
||||
action: PayloadAction<UiState["dialogMessage"]>,
|
||||
|
|
@ -64,12 +43,7 @@ export const uiStateSlice = createSlice({
|
|||
setShowDialog: (state, action: PayloadAction<UiState["showDialog"]>) => {
|
||||
state.showDialog = action.payload;
|
||||
},
|
||||
setDisplayBottomMessageOnBottom: (
|
||||
state,
|
||||
action: PayloadAction<UiState["displayBottomMessageOnBottom"]>,
|
||||
) => {
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue