From 0d3660992634d782dabaef49f1a3f2a651c0b6b7 Mon Sep 17 00:00:00 2001 From: Rudraprasad Das Date: Fri, 12 Jan 2024 15:41:51 +0530 Subject: [PATCH] fix: removing env switcher from bottom bar permanently (#30200) ## Description Removes env switcher from view mode #### PR fixes following issue(s) Fixes #30199 #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed ## Summary by CodeRabbit - **New Features** - Updated the Bottom Bar to conditionally display components based on the view mode. - **Refactor** - Streamlined the App Viewer interface for enhanced user experience. - **Chores** - Removed unnecessary feature flags and imports for a cleaner codebase. --- app/client/src/components/BottomBar/index.tsx | 14 ++++--- app/client/src/pages/AppViewer/index.tsx | 42 +------------------ 2 files changed, 10 insertions(+), 46 deletions(-) diff --git a/app/client/src/components/BottomBar/index.tsx b/app/client/src/components/BottomBar/index.tsx index 2b9c64c060..2e90f0abfa 100644 --- a/app/client/src/components/BottomBar/index.tsx +++ b/app/client/src/components/BottomBar/index.tsx @@ -23,12 +23,14 @@ export default function BottomBar({ viewMode }: { viewMode: boolean }) { return ( - + {!viewMode && ( + + )} {!viewMode && } {!viewMode && ( diff --git a/app/client/src/pages/AppViewer/index.tsx b/app/client/src/pages/AppViewer/index.tsx index 0a45e95c3f..47407e8443 100644 --- a/app/client/src/pages/AppViewer/index.tsx +++ b/app/client/src/pages/AppViewer/index.tsx @@ -44,19 +44,12 @@ import { } from "@appsmith/selectors/applicationSelectors"; import { editorInitializer } from "../../utils/editor/EditorUtils"; import { widgetInitialisationSuccess } from "../../actions/widgetActions"; -import { - areEnvironmentsFetched, - getEnvironmentsWithPermission, -} from "@appsmith/selectors/environmentSelectors"; import type { FontFamily } from "@design-system/theming"; import { ThemeProvider as WDSThemeProvider, useTheme, } from "@design-system/theming"; import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; -import { RAMP_NAME } from "utils/ProductRamps/RampsControlList"; -import { showProductRamps } from "@appsmith/selectors/rampSelectors"; -import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag"; import { KBViewerFloatingButton } from "@appsmith/pages/AppViewer/KnowledgeBase/KBViewerFloatingButton"; import urlBuilder from "@appsmith/entities/URLRedirect/URLAssembly"; import { getHideWatermark } from "@appsmith/selectors/tenantSelectors"; @@ -65,17 +58,12 @@ const AppViewerBody = styled.section<{ hasPages: boolean; headerHeight: number; showGuidedTourMessage: boolean; - showBottomBar: boolean; }>` display: flex; flex-direction: row; align-items: stretch; justify-content: flex-start; - height: calc( - 100vh - - ${(props) => (props.showBottomBar ? props.theme.bottomBarHeight : "0px")} - - ${({ headerHeight }) => headerHeight}px - ); + height: calc(100vh - ${({ headerHeight }) => headerHeight}px); --view-mode-header-height: ${({ headerHeight }) => headerHeight}px; `; @@ -132,26 +120,6 @@ function AppViewer(props: Props) { const { theme } = useTheme(isWDSEnabled ? wdsThemeProps : themeProps); const focusRef = useWidgetFocus(); - const showRampSelector = showProductRamps(RAMP_NAME.MULTIPLE_ENV, true); - const canShowRamp = useSelector(showRampSelector); - - const workspaceId = currentApplicationDetails?.workspaceId || ""; - const isMultipleEnvEnabled = useFeatureFlag( - FEATURE_FLAG.release_datasource_environments_enabled, - ); - const environmentList = useSelector(getEnvironmentsWithPermission); - // If there is only one environment and it is default, don't show the bottom bar - const isOnlyDefaultShown = - environmentList.length === 1 && environmentList[0]?.isDefault; - const showBottomBar = useSelector((state: AppState) => { - return ( - areEnvironmentsFetched(state, workspaceId) && - (isMultipleEnvEnabled || canShowRamp) && - environmentList.length > 0 && - !isOnlyDefaultShown - ); - }); - /** * initializes the widgets factory and registers all widgets */ @@ -251,17 +219,11 @@ function AppViewer(props: Props) { hasPages={pages.length > 1} headerHeight={headerHeight} ref={focusRef} - showBottomBar={!!showBottomBar} showGuidedTourMessage={showGuidedTourMessage} > {isInitialized && } - {showBottomBar && } -