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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Rudraprasad Das 2024-01-12 15:41:51 +05:30 committed by GitHub
parent 4bd46aee2b
commit 0d36609926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 46 deletions

View File

@ -23,12 +23,14 @@ export default function BottomBar({ viewMode }: { viewMode: boolean }) {
return (
<Container>
<Wrapper>
<SwitchEnvironment
editorId={appId}
onChangeEnv={onChangeEnv}
startSwitchEnvMessage={START_SWITCH_ENVIRONMENT}
viewMode={viewMode}
/>
{!viewMode && (
<SwitchEnvironment
editorId={appId}
onChangeEnv={onChangeEnv}
startSwitchEnvMessage={START_SWITCH_ENVIRONMENT}
viewMode={viewMode}
/>
)}
{!viewMode && <QuickGitActions />}
</Wrapper>
{!viewMode && (

View File

@ -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 && <AppViewerPageContainer />}
</AppViewerBody>
{showBottomBar && <BottomBar viewMode />}
<div
className={`fixed hidden right-8 z-3 md:flex ${
showBottomBar ? "bottom-12" : "bottom-4"
}`}
>
<div className={"fixed hidden right-8 z-3 md:flex bottom-4"}>
{!hideWatermark && (
<a
className="hover:no-underline"