PromucFlow_constructor/app/client/src/pages/AppIDE/layouts/StaticLayout.tsx
Ankita Kinger c21e5edaf2
chore: Moving static layout styled components to a common file for re-using on EE (#39379)
## Description

- Moving static layout styled components to a common file for re-using
on EE
- Updating AppIDE folder name: `layout` to `layouts`
- Showing the Add button for libraries via props to re-use the component
on EE

Fixes [#39037](https://github.com/appsmithorg/appsmith/issues/39037)

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13436155470>
> Commit: bafebbe1d485867240076a2122d87aac26eab177
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13436155470&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 20 Feb 2025 14:41:02 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Introduced an option in the libraries panel to conditionally display
an “add” button, offering a more dynamic experience.
- Added new layout components to facilitate better layout management
within the application.

- **Refactor**
- Enhanced layout management through unified grid-based components for
improved visual consistency.
- Updated component interfaces to accept new props for enhanced
functionality.
  - Adjusted import paths to reflect a restructured file organization.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-02-20 20:34:06 +05:30

74 lines
2.1 KiB
TypeScript

import React from "react";
import {
useGitModEnabled,
useGitProtectedMode,
} from "pages/Editor/gitSync/hooks/modHooks";
import { GitProtectedBranchCallout as GitProtectedBranchCalloutNew } from "git";
import BottomBar from "components/BottomBar";
import EditorWrapperContainer from "pages/Editor/commons/EditorWrapperContainer";
import Sidebar from "./routers/Sidebar";
import LeftPane from "./routers/LeftPane";
import MainPane from "./routers/MainPane";
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();
const isProtectedMode = useGitProtectedMode();
if (isGitModEnabled) {
return <GitProtectedBranchCalloutNew />;
}
if (isProtectedMode) {
return <ProtectedCallout />;
}
return null;
}
export const StaticLayout = React.memo(() => {
const { areas, columns } = useGridLayoutTemplate();
const isSidebarVisible = columns[0] !== "0px";
return (
<>
<GitProtectedBranchCallout />
<EditorWrapperContainer>
<GridContainer
style={{
gridTemplateRows: "100%",
gridTemplateAreas: areas
.map((area) => `"${area.join(" ")}"`)
.join("\n"),
gridTemplateColumns: columns.join(" "),
}}
>
<LayoutContainer name={Areas.Sidebar}>
{isSidebarVisible ? <Sidebar /> : <div />}
</LayoutContainer>
<LayoutContainer name={Areas.Explorer}>
<LeftPane />
</LayoutContainer>
<LayoutContainer name={Areas.WidgetEditor}>
<MainPane id="app-body" />
</LayoutContainer>
<LayoutContainer name={Areas.PropertyPane}>
<RightPane />
</LayoutContainer>
</GridContainer>
</EditorWrapperContainer>
<BottomBar />
</>
);
});