The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
import { Flex } from "metabase/ui";
import type {
DependencyNode,
SourceReplacementColumnMapping,
} from "metabase-types/api";
import type { EntityItem, TabType } from "../types";
import { ColumnComparisonTable } from "./ColumnMappingTable";
import { DependentsTable } from "./DependentsTable";
import { EmptyState } from "./EmptyState";
import { TabPanel } from "./TabPanel";
type ModalBodyProps = {
sourceItem: EntityItem | undefined;
targetItem: EntityItem | undefined;
selectedTab: TabType;
canReplace: boolean;
dependents: DependencyNode[] | undefined;
columnMappings: SourceReplacementColumnMapping[] | undefined;
onTabChange: (tab: TabType) => void;
};
export function ModalBody({
sourceItem,
targetItem,
selectedTab,
canReplace,
dependents = [],
columnMappings = [],
onTabChange,
}: ModalBodyProps) {
if (columnMappings.length === 0) {
return (
<Flex flex={1} direction="column" p="xl" bg="background_page-secondary">
<EmptyState />
</Flex>
);
}
return (
<Flex
flex={1}
direction="column"
miw={0}
mih={0}
bg="background_page-secondary"
>
<TabPanel
selectedTab={selectedTab}
canReplace={canReplace}
dependentsCount={dependents.length}
onTabChange={onTabChange}
/>
<Flex flex={1} direction="column" p="xl" miw={0} mih={0}>
{selectedTab === "column-mappings" && (
<ColumnComparisonTable
sourceItem={sourceItem}
targetItem={targetItem}
columnMappings={columnMappings}
/>
)}
{selectedTab === "dependents" && (
<DependentsTable dependents={dependents} />
)}
</Flex>
</Flex>
);
}