Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Move Toolbar to IDE #36214

Merged
merged 14 commits into from
Sep 12, 2024
52 changes: 52 additions & 0 deletions app/client/src/IDE/Structure/Toolbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from "react";
import { Flex } from "@appsmith/ads";

interface ToolbarProps {
children?: React.ReactNode[] | React.ReactNode;
}

const Toolbar = (props: ToolbarProps) => {
return (
<Flex
alignItems="center"
borderBottom="1px solid var(--ads-v2-color-border-muted);"
flexDirection="row"
height="32px"
justifyContent="space-between"
padding="spaces-2"
>
{props.children}
</Flex>
);
};

const Left = (props: ToolbarProps) => {
return (
<Flex
alignItems="center"
flexDirection="row"
gap="spaces-2"
justifySelf="flex-start"
>
{props.children}
</Flex>
);
};

const Right = (props: ToolbarProps) => {
return (
<Flex
alignItems="center"
flexDirection="row"
gap="spaces-2"
justifySelf="flex-end"
>
{props.children}
</Flex>
);
};

Toolbar.Left = Left;
Toolbar.Right = Right;

export default Toolbar;
8 changes: 8 additions & 0 deletions app/client/src/IDE/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
export { IDE_HEADER_HEIGHT } from "./Structure/constants";
export { default as IDEHeader } from "./Structure/Header";

/**
* The IDEToolbar gets exported with 2 layout subsections.
* IDEToolbar.Left and IDEToolbar.Right
* These are composable components that you can use to spread the content of the toolbar
* It is possible to use the Toolbar without using these subsections
*/
export { default as IDEToolbar } from "./Structure/Toolbar";

/* ====================================================
**** UI Components ****
Components that are smaller UI abstractions for easy use and standardisation within the IDE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,43 @@
import React from "react";
import { IDEToolbar } from "IDE";
import { Button, Tooltip } from "@appsmith/ads";
import { modText } from "../../utils/helpers";

const PluginActionToolbar = () => {
return <div />;
interface PluginActionToolbarProps {
runOptions?: React.ReactNode;
children?: React.ReactNode[] | React.ReactNode;
}

const PluginActionToolbar = (props: PluginActionToolbarProps) => {
return (
<IDEToolbar>
<IDEToolbar.Left>{props.children}</IDEToolbar.Left>
<IDEToolbar.Right>
{props.runOptions}
<Tooltip
content={modText() + " ⏎"}
placement="topRight"
showArrow={false}
>
<Button kind="primary" size="sm">
Run
</Button>
</Tooltip>
<Button
isIconButton
kind="secondary"
size="sm"
startIcon="settings-2-line"
/>
<Button
isIconButton
kind="tertiary"
size="sm"
startIcon="more-2-fill"
/>
</IDEToolbar.Right>
</IDEToolbar>
);
};

export default PluginActionToolbar;

This file was deleted.

This file was deleted.

This file was deleted.

63 changes: 0 additions & 63 deletions app/client/src/pages/Editor/QueryEditor/EditorJSONtoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import styled from "styled-components";
import FormRow from "components/editorComponents/FormRow";
import {
createMessage,
DEBUGGER_RESPONSE,
DOCUMENTATION,
DOCUMENTATION_TOOLTIP,
} from "ee/constants/messages";
Expand All @@ -29,17 +28,12 @@ import { setQueryPaneConfigSelectedTabIndex } from "actions/queryPaneActions";
import type { SourceEntity } from "entities/AppsmithConsole";
import { ENTITY_TYPE as SOURCE_ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils";
import { DocsLink, openDoc } from "../../../constants/DocumentationLinks";
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
import { QueryEditorContext } from "./QueryEditorContext";
import QueryDebuggerTabs from "./QueryDebuggerTabs";
import useShowSchema from "components/editorComponents/ActionRightPane/useShowSchema";
import { doesPluginRequireDatasource } from "ee/entities/Engine/actionHelpers";
import FormRender from "./FormRender";
import QueryEditorHeader from "./QueryEditorHeader";
import ActionEditor from "../IDE/EditorPane/components/ActionEditor";
import QueryResponseTab from "./QueryResponseTab";
import DatasourceSelector from "./DatasourceSelector";
import RunHistory from "ee/components/RunHistory";

const QueryFormContainer = styled.form`
Expand Down Expand Up @@ -227,10 +221,6 @@ export function EditorJSONtoForm(props: Props) {
useShowSchema(currentActionConfig?.pluginId || "") &&
pluginRequireDatasource;

const isActionRedesignEnabled = useFeatureFlag(
FEATURE_FLAG.release_actions_redesign_enabled,
);

const dispatch = useDispatch();

const handleDocumentationClick = () => {
Expand All @@ -256,59 +246,6 @@ export function EditorJSONtoForm(props: Props) {
return null;
}

if (isActionRedesignEnabled && plugin) {
const responseTabs = [];
if (currentActionConfig) {
responseTabs.push({
key: "response",
title: createMessage(DEBUGGER_RESPONSE),
panelComponent: (
<QueryResponseTab
actionName={actionName}
actionSource={actionSource}
currentActionConfig={currentActionConfig}
isRunning={isRunning}
onRunClick={onRunClick}
runErrorMessage={runErrorMessage}
/>
),
});
}
return (
<ActionEditor
isRunning={isRunning}
onDocsClick={handleDocumentationClick}
onRunClick={onRunClick}
runOptionsSelector={
<DatasourceSelector
currentActionConfig={currentActionConfig}
dataSources={dataSources}
formName={formName}
onCreateDatasourceClick={onCreateDatasourceClick}
plugin={plugin}
/>
}
settingsRender={
<SettingsWrapper>
<ActionSettings
actionSettingsConfig={settingConfig}
formName={formName}
/>
</SettingsWrapper>
}
tabs={responseTabs}
>
<FormRender
editorConfig={editorConfig}
formData={props.formData}
formEvaluationState={props.formEvaluationState}
formName={formName}
uiComponent={uiComponent}
/>
</ActionEditor>
);
}

return (
<>
{closeEditorLink}
Expand Down
Loading