Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions app/client/src/IDE/Components/LayoutComponents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import styled from "styled-components";

export const GridContainer = styled.div`
display: grid;
width: 100vw;
height: 100%;
`;

export const LayoutContainer = styled.div<{ name: string }>`
position: relative;
grid-area: ${(props) => props.name};
`;
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import React from "react";
import JSLibrariesSection from "pages/AppIDE/components/LibrariesList/JSLibrariesSection";
import { IDESidePaneWrapper } from "IDE";

const LibrarySidePane = () => {
const LibrarySidePane = (props: { showAddButton: boolean }) => {
const { showAddButton } = props;

return (
<IDESidePaneWrapper>
<JSLibrariesSection />
<JSLibrariesSection showAddButton={showAddButton} />
</IDESidePaneWrapper>
);
};
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/pages/AppIDE/AppIDE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { RouteComponentProps } from "react-router-dom";
import { withRouter } from "react-router-dom";
import type { BuilderRouteParams } from "constants/routes";
import type { AppState } from "ee/reducers";
import IDE from "./layout";
import IDE from "./layouts";
import {
getCurrentApplicationId,
getIsEditorInitialized,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { useSelector } from "react-redux";
import { animated, useTransition } from "react-spring";
import { LibraryEntity } from "pages/Editor/Explorer/Libraries";

function JSLibrariesSection() {
function JSLibrariesSection(props: { showAddButton: boolean }) {
const { showAddButton } = props;
const libraries = useSelector(selectLibrariesForExplorer);
const transitions = useTransition(libraries, {
keys: (lib) => lib.name,
Expand All @@ -16,7 +17,10 @@ function JSLibrariesSection() {
leave: { opacity: 1 },
});

const rightIcon = useMemo(() => <AddLibraryPopover />, []);
const rightIcon = useMemo(
() => (showAddButton ? <AddLibraryPopover /> : null),
[],
);
Comment thread
alex-golovanov marked this conversation as resolved.

return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import styled from "styled-components";

import {
useGitModEnabled,
Expand All @@ -16,6 +15,10 @@ import RightPane from "./routers/RightPane";
import { ProtectedCallout } from "../components/ProtectedCallout";
import { useGridLayoutTemplate } from "./hooks/useGridLayoutTemplate";
import { Areas } from "./constants";
import {
GridContainer,
LayoutContainer,
} from "IDE/Components/LayoutComponents";

function GitProtectedBranchCallout() {
const isGitModEnabled = useGitModEnabled();
Expand All @@ -32,17 +35,6 @@ function GitProtectedBranchCallout() {
return null;
}

const GridContainer = styled.div`
display: grid;
width: 100vw;
height: 100%;
`;

const LayoutContainer = styled.div<{ name: string }>`
position: relative;
grid-area: ${(props) => props.name};
`;

export const StaticLayout = React.memo(() => {
const { areas, columns } = useGridLayoutTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ const LeftPane = () => {
)}
/>
<SentryRoute
component={LibrarySidePane}
exact
path={librarySidePanePaths}
render={(routeProps) => (
<LibrarySidePane {...routeProps} showAddButton />
)}
/>
<SentryRoute
component={AppSettingsPane}
Expand Down