2019-10-29 12:02:58 +00:00
|
|
|
import styled from "styled-components";
|
2021-08-13 11:38:26 +00:00
|
|
|
import * as Sentry from "@sentry/react";
|
2022-02-08 16:16:16 +00:00
|
|
|
import { useDispatch, useSelector } from "react-redux";
|
2022-01-29 07:26:19 +00:00
|
|
|
import React, { useState, useCallback } from "react";
|
|
|
|
|
import { Route, Switch } from "react-router";
|
2021-11-23 08:01:46 +00:00
|
|
|
|
2021-08-13 11:38:26 +00:00
|
|
|
import EditorsRouter from "./routes";
|
2021-09-06 09:29:35 +00:00
|
|
|
import BottomBar from "./BottomBar";
|
2022-01-29 07:26:19 +00:00
|
|
|
import { DEFAULT_ENTITY_EXPLORER_WIDTH } from "constants/AppConstants";
|
2021-11-23 08:01:46 +00:00
|
|
|
import WidgetsEditor from "./WidgetsEditor";
|
|
|
|
|
import { updateExplorerWidthAction } from "actions/explorerActions";
|
2021-09-13 07:22:51 +00:00
|
|
|
import { BUILDER_CHECKLIST_URL, BUILDER_URL } from "constants/routes";
|
|
|
|
|
import OnboardingChecklist from "./FirstTimeUserOnboarding/Checklist";
|
2021-11-23 08:01:46 +00:00
|
|
|
import EntityExplorerSidebar from "components/editorComponents/Sidebar";
|
2022-02-08 16:16:16 +00:00
|
|
|
import classNames from "classnames";
|
|
|
|
|
import { previewModeSelector } from "selectors/editorSelectors";
|
2021-11-23 08:01:46 +00:00
|
|
|
|
2020-09-24 16:05:18 +00:00
|
|
|
const SentryRoute = Sentry.withSentryRouting(Route);
|
|
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
const Container = styled.div`
|
|
|
|
|
display: flex;
|
2021-09-06 09:29:35 +00:00
|
|
|
height: calc(
|
|
|
|
|
100vh - ${(props) => props.theme.smallHeaderHeight} -
|
2021-10-04 08:01:46 +00:00
|
|
|
${(props) => props.theme.bottomBarHeight}
|
2021-09-06 09:29:35 +00:00
|
|
|
);
|
2021-02-08 07:30:01 +00:00
|
|
|
background-color: ${(props) => props.theme.appBackground};
|
2019-10-29 12:02:58 +00:00
|
|
|
`;
|
2021-11-23 08:01:46 +00:00
|
|
|
function MainContainer() {
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const [sidebarWidth, setSidebarWidth] = useState(
|
|
|
|
|
DEFAULT_ENTITY_EXPLORER_WIDTH,
|
|
|
|
|
);
|
2019-10-29 12:02:58 +00:00
|
|
|
|
2021-11-23 08:01:46 +00:00
|
|
|
/**
|
|
|
|
|
* on entity explorer sidebar width change
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
const onLeftSidebarWidthChange = useCallback((newWidth) => {
|
|
|
|
|
setSidebarWidth(newWidth);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* on entity explorer sidebar drag end
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
const onLeftSidebarDragEnd = useCallback(() => {
|
|
|
|
|
dispatch(updateExplorerWidthAction(sidebarWidth));
|
|
|
|
|
}, [sidebarWidth]);
|
|
|
|
|
|
2022-02-08 16:16:16 +00:00
|
|
|
const isPreviewMode = useSelector(previewModeSelector);
|
|
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
return (
|
2021-09-06 09:29:35 +00:00
|
|
|
<>
|
2021-11-23 08:01:46 +00:00
|
|
|
<Container className="w-full overflow-x-hidden">
|
|
|
|
|
<EntityExplorerSidebar
|
|
|
|
|
onDragEnd={onLeftSidebarDragEnd}
|
|
|
|
|
onWidthChange={onLeftSidebarWidthChange}
|
|
|
|
|
width={sidebarWidth}
|
|
|
|
|
/>
|
2022-01-29 07:26:19 +00:00
|
|
|
<div
|
|
|
|
|
className="relative flex flex-col w-full overflow-auto"
|
|
|
|
|
id="app-body"
|
|
|
|
|
>
|
|
|
|
|
<Switch key={BUILDER_URL}>
|
2021-09-06 09:29:35 +00:00
|
|
|
<SentryRoute component={WidgetsEditor} exact path={BUILDER_URL} />
|
2021-09-13 07:22:51 +00:00
|
|
|
<SentryRoute
|
|
|
|
|
component={OnboardingChecklist}
|
|
|
|
|
exact
|
|
|
|
|
path={BUILDER_CHECKLIST_URL}
|
|
|
|
|
/>
|
2021-09-06 09:29:35 +00:00
|
|
|
<SentryRoute component={EditorsRouter} />
|
|
|
|
|
</Switch>
|
2021-11-23 08:01:46 +00:00
|
|
|
</div>
|
2021-09-06 09:29:35 +00:00
|
|
|
</Container>
|
2022-02-08 16:16:16 +00:00
|
|
|
<BottomBar
|
|
|
|
|
className={classNames({
|
|
|
|
|
"translate-y-full fixed bottom-0": isPreviewMode,
|
|
|
|
|
"translate-y-0 relative opacity-100": !isPreviewMode,
|
|
|
|
|
"transition-all transform duration-400": true,
|
|
|
|
|
})}
|
|
|
|
|
/>
|
2021-09-06 09:29:35 +00:00
|
|
|
</>
|
2019-10-29 12:02:58 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2019-10-29 12:02:58 +00:00
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
MainContainer.displayName = "MainContainer";
|
|
|
|
|
|
2019-10-29 12:02:58 +00:00
|
|
|
export default MainContainer;
|