## Description Updating analytics to pass the correct source information Fixes [#32266](https://github.com/appsmithorg/appsmith/issues/32266) ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 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/8750877755> > Commit: 6fedefebd3867aee79877b7ed105c90888005cfd > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8750877755&attempt=1" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results -->
94 lines
2.4 KiB
TypeScript
94 lines
2.4 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;
|
|
}
|
|
|
|
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,
|
|
});
|
|
}
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Tabs
|
|
className="h-full"
|
|
defaultValue={props.selectedTabKey}
|
|
onValueChange={onTabSelect}
|
|
value={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;
|