## Description - Creates a new IDE component for `BottomView` that can be either collapsed or closed. - Creates a different view for `EntityTabs` when it is collapsed - Start using the collapsed version for Entity Responses (Query / API / JS) Fixes #33333 Fixes #33336 Fixes #31402 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!CAUTION] > 🔴 🔴 🔴 Some tests have failed. > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9175565108> > Commit: 8f3b96eb0b7d18301fb902cddd13755abee38871 > Cypress dashboard: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9175565108&attempt=1&selectiontype=test&testsstatus=failed&specsstatus=fail" target="_blank"> Click here!</a> > The following are new failures, please fix them before merging the PR: <ol> > <li>cypress/e2e/Regression/ClientSide/Binding/Button_Text_WithRecaptcha_spec.js > <li>cypress/e2e/Regression/ClientSide/Widgets/Others/IconButton_2_spec.ts </ol> > To know the list of identified flaky tests - <a href="https://internal.appsmith.com/app/cypress-dashboard/identified-flaky-tests-65890b3c81d7400d08fa9ee3?branch=master" target="_blank">Refer here</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [x] Yes - [ ] No
112 lines
2.9 KiB
TypeScript
112 lines
2.9 KiB
TypeScript
import React from "react";
|
|
import type { CollapsibleTabProps } from "design-system-old";
|
|
import AnalyticsUtil from "@appsmith/utils/AnalyticsUtil";
|
|
import { DEBUGGER_TAB_KEYS } from "./Debugger/helpers";
|
|
import { Tab, TabPanel, Tabs, TabsList } from "design-system";
|
|
import styled from "styled-components";
|
|
import { LIST_HEADER_HEIGHT, FOOTER_MARGIN } from "./Debugger/DebuggerLogs";
|
|
|
|
const TabPanelWrapper = styled(TabPanel)`
|
|
margin-top: 0;
|
|
height: calc(100% - ${LIST_HEADER_HEIGHT});
|
|
&.ads-v2-tabs__panel {
|
|
overflow: auto;
|
|
}
|
|
& .t--code-editor-wrapper.codeWrapper {
|
|
height: calc(100% - ${FOOTER_MARGIN});
|
|
& .CodeMirror-scroll {
|
|
box-sizing: border-box;
|
|
}
|
|
}
|
|
`;
|
|
|
|
const TabsListWrapper = styled(TabsList)`
|
|
padding: calc(var(--ads-v2-spaces-1) + 2px) var(--ads-v2-spaces-7)
|
|
var(--ads-v2-spaces-1);
|
|
`;
|
|
|
|
export interface BottomTab {
|
|
key: string;
|
|
title: string;
|
|
count?: number;
|
|
panelComponent: React.ReactNode;
|
|
}
|
|
|
|
interface EntityBottomTabsProps {
|
|
className?: string;
|
|
tabs: Array<BottomTab>;
|
|
onSelect?: (tab: string) => void;
|
|
selectedTabKey: string;
|
|
isCollapsed?: boolean;
|
|
}
|
|
|
|
type CollapsibleEntityBottomTabsProps = EntityBottomTabsProps &
|
|
CollapsibleTabProps;
|
|
|
|
// Using this if there are debugger related tabs
|
|
function EntityBottomTabs(
|
|
props: EntityBottomTabsProps | CollapsibleEntityBottomTabsProps,
|
|
) {
|
|
const onTabSelect = (key: string) => {
|
|
const tab = props.tabs.find((tab) => tab.key === key);
|
|
if (tab) {
|
|
props.onSelect && props.onSelect(tab.key);
|
|
|
|
if (Object.values<string>(DEBUGGER_TAB_KEYS).includes(tab.key)) {
|
|
AnalyticsUtil.logEvent("DEBUGGER_TAB_SWITCH", {
|
|
tabName: tab.key,
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
// if (props.isCollapsed) {
|
|
// return (
|
|
// <Flex alignItems="center" gap="spaces-3" height="100%" pl="spaces-5">
|
|
// {props.tabs.map((tab) => (
|
|
// <Button
|
|
// key={tab.key}
|
|
// kind="tertiary"
|
|
// onClick={() => onTabSelect(tab.key)}
|
|
// size="md"
|
|
// >
|
|
// {tab.title}
|
|
// </Button>
|
|
// ))}
|
|
// </Flex>
|
|
// );
|
|
// }
|
|
|
|
return (
|
|
<Tabs
|
|
className="h-full"
|
|
defaultValue={props.selectedTabKey}
|
|
onValueChange={onTabSelect}
|
|
value={props.isCollapsed ? "" : props.selectedTabKey}
|
|
>
|
|
<TabsListWrapper>
|
|
{props.tabs.map((tab) => {
|
|
return (
|
|
<Tab
|
|
data-testid={"t--tab-" + tab.key}
|
|
id={`debugger-tab-${tab.key}`}
|
|
key={tab.key}
|
|
notificationCount={tab.count}
|
|
value={tab.key}
|
|
>
|
|
{tab.title}
|
|
</Tab>
|
|
);
|
|
})}
|
|
</TabsListWrapper>
|
|
{props.tabs.map((tab) => (
|
|
<TabPanelWrapper key={tab.key} value={tab.key}>
|
|
{tab.panelComponent}
|
|
</TabPanelWrapper>
|
|
))}
|
|
</Tabs>
|
|
);
|
|
}
|
|
|
|
export default EntityBottomTabs;
|