|
| 1 | +import * as React from 'react'; |
| 2 | + |
| 3 | +import { DocumentTitleSegment } from 'src/components/DocumentTitle'; |
| 4 | +import { LandingHeader } from 'src/components/LandingHeader'; |
| 5 | +import { ProductInformationBanner } from 'src/components/ProductInformationBanner/ProductInformationBanner'; |
| 6 | +import { SuspenseLoader } from 'src/components/SuspenseLoader'; |
| 7 | +import { SafeTabPanel } from 'src/components/Tabs/SafeTabPanel'; |
| 8 | +import { TabPanels } from 'src/components/Tabs/TabPanels'; |
| 9 | +import { Tabs } from 'src/components/Tabs/Tabs'; |
| 10 | +import { TanStackTabLinkList } from 'src/components/Tabs/TanStackTabLinkList'; |
| 11 | +import { useTabs } from 'src/hooks/useTabs'; |
| 12 | + |
| 13 | +const Destinations = React.lazy(() => |
| 14 | + import('./Destinations/Destinations').then((module) => ({ |
| 15 | + default: module.Destinations, |
| 16 | + })) |
| 17 | +); |
| 18 | + |
| 19 | +const Streams = React.lazy(() => |
| 20 | + import('./Streams/Streams').then((module) => ({ |
| 21 | + default: module.Streams, |
| 22 | + })) |
| 23 | +); |
| 24 | + |
| 25 | +export const DataStreamLanding = React.memo(() => { |
| 26 | + const landingHeaderProps = { |
| 27 | + breadcrumbProps: { |
| 28 | + pathname: '/datastream', |
| 29 | + }, |
| 30 | + entity: 'DataStream', |
| 31 | + title: 'DataStream', |
| 32 | + }; |
| 33 | + |
| 34 | + const { handleTabChange, tabIndex, tabs } = useTabs([ |
| 35 | + { |
| 36 | + to: '/datastream/streams', |
| 37 | + title: 'Streams', |
| 38 | + }, |
| 39 | + { |
| 40 | + to: '/datastream/destinations', |
| 41 | + title: 'Destinations', |
| 42 | + }, |
| 43 | + ]); |
| 44 | + |
| 45 | + return ( |
| 46 | + <> |
| 47 | + <ProductInformationBanner bannerLocation="DataStream" /> |
| 48 | + <DocumentTitleSegment segment="DataStream" /> |
| 49 | + <LandingHeader {...landingHeaderProps} spacingBottom={4} /> |
| 50 | + |
| 51 | + <Tabs index={tabIndex} onChange={handleTabChange}> |
| 52 | + <TanStackTabLinkList tabs={tabs} /> |
| 53 | + |
| 54 | + <React.Suspense fallback={<SuspenseLoader />}> |
| 55 | + <TabPanels> |
| 56 | + <SafeTabPanel index={0}> |
| 57 | + <Streams /> |
| 58 | + </SafeTabPanel> |
| 59 | + <SafeTabPanel index={1}> |
| 60 | + <Destinations /> |
| 61 | + </SafeTabPanel> |
| 62 | + </TabPanels> |
| 63 | + </React.Suspense> |
| 64 | + </Tabs> |
| 65 | + </> |
| 66 | + ); |
| 67 | +}); |
0 commit comments