Skip to content

Commit

Permalink
extracting out showNudge config from screen mode toggle component
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitakinger committed Jan 24, 2025
1 parent efceb1e commit f9c8157
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 7 additions & 4 deletions app/client/src/pages/Editor/IDE/EditorTabs/ScreenModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ import type { AppState } from "ee/reducers";
import { selectFeatureFlagCheck } from "ee/selectors/featureFlagsSelectors";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { Nudge } from "IDE/Components/Nudge";
import { useShowSideBySideNudge } from "../hooks";

export const ScreenModeToggle = () => {
interface Props {
showNudge: boolean;
dismissNudge: () => void;
}

export const ScreenModeToggle = (props: Props) => {
const { dismissNudge, showNudge } = props;
const dispatch = useDispatch();
const ideViewMode = useSelector(getIDEViewMode);
const isAnimatedIDEEnabled = useSelector((state: AppState) => {
Expand All @@ -43,8 +48,6 @@ export const ScreenModeToggle = () => {
}
}, [dispatch, isAnimatedIDEEnabled]);

const [showNudge, dismissNudge] = useShowSideBySideNudge();

const switchToSplitScreen = useCallback(() => {
AnalyticsUtil.logEvent("EDITOR_MODE_CHANGE", {
to: EditorViewMode.SplitScreen,
Expand Down
9 changes: 7 additions & 2 deletions app/client/src/pages/Editor/IDE/EditorTabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import {
} from "ee/entities/IDE/constants";

import Container from "./Container";
import { useCurrentEditorState, useIDETabClickHandlers } from "../hooks";
import {
useCurrentEditorState,
useIDETabClickHandlers,
useShowSideBySideNudge,
} from "../hooks";
import { SCROLL_AREA_OPTIONS, TabSelectors } from "./constants";
import { AddButton } from "./AddButton";
import { useLocation } from "react-router";
Expand All @@ -32,6 +36,7 @@ const EditorTabs = () => {
const entities = useSelector(tabsConfig.listSelector, shallowEqual);
const files = useSelector(tabsConfig.tabsSelector, shallowEqual);
const isListViewActive = useSelector(getListViewActiveState);
const [showNudge, dismissNudge] = useShowSideBySideNudge();

const location = useLocation();
const dispatch = useDispatch();
Expand Down Expand Up @@ -147,7 +152,7 @@ const EditorTabs = () => {
</ScrollArea>
{files.length > 0 ? <AddButton /> : null}
{/* Switch screen mode button */}
<ScreenModeToggle />
<ScreenModeToggle dismissNudge={dismissNudge} showNudge={showNudge} />
</Container>

{/* Overflow list */}
Expand Down

0 comments on commit f9c8157

Please sign in to comment.