Skip to content

Commit 70f3fb3

Browse files
committed
refactor: replace <ScrollContainer /> with <ScrollParent /> component (#14613)
1 parent d9154a9 commit 70f3fb3

25 files changed

+109
-151
lines changed

airbyte-webapp/src/components/ScrollableContainer/ScrollableContainer.module.scss

-6
This file was deleted.

airbyte-webapp/src/components/ScrollableContainer/ScrollableContainer.tsx

-17
This file was deleted.

airbyte-webapp/src/components/ScrollableContainer/index.ts

-1
This file was deleted.

airbyte-webapp/src/components/connection/CreateConnectionForm/CreateConnectionForm.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { useNavigate } from "react-router-dom";
66

77
import { Form } from "components/forms";
88
import LoadingSchema from "components/LoadingSchema";
9+
import { ScrollParent } from "components/ui/ScrollParent";
910

1011
import { useGetDestinationFromSearchParams, useGetSourceFromSearchParams } from "area/connector/utils";
1112
import { connectionsKeys, HttpError, HttpProblem, useCreateConnection, useDiscoverSchema } from "core/api";
@@ -23,7 +24,6 @@ import { SchemaError } from "./SchemaError";
2324
import { SimplifiedConnectionConfiguration } from "./SimplifiedConnectionCreation/SimplifiedConnectionConfiguration";
2425
import { I18N_KEY_UNDER_ONE_HOUR_NOT_ALLOWED } from "./SimplifiedConnectionCreation/SimplifiedConnectionScheduleFormField";
2526
import { useAnalyticsTrackFunctions } from "./useAnalyticsTrackFunctions";
26-
import { ScrollableContainer } from "../../ScrollableContainer";
2727
import {
2828
FormConnectionFormValues,
2929
useConnectionValidationSchema,
@@ -152,9 +152,9 @@ export const CreateConnectionForm: React.FC = () => {
152152

153153
if (schemaErrorStatus) {
154154
return (
155-
<ScrollableContainer>
155+
<ScrollParent>
156156
<SchemaError schemaError={schemaErrorStatus} refreshSchema={onDiscoverSchema} />
157-
</ScrollableContainer>
157+
</ScrollParent>
158158
);
159159
}
160160
if (!schema) {

airbyte-webapp/src/components/connection/CreateConnectionForm/SimplifiedConnectionCreation/SimplifiedConnectionConfiguration.module.scss

-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
@use "scss/variables";
33
@use "scss/mixins";
44

5-
.container {
6-
height: 100%;
7-
padding: variables.$spacing-xl;
8-
}
9-
105
.nextLink {
116
@include mixins.base-button;
127

airbyte-webapp/src/components/connection/CreateConnectionForm/SimplifiedConnectionCreation/SimplifiedConnectionConfiguration.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { ConnectionRoutePaths, RoutePaths } from "pages/routePaths";
2727
import styles from "./SimplifiedConnectionConfiguration.module.scss";
2828
import { SimplifiedConnectionsSettingsCard } from "./SimplifiedConnectionSettingsCard";
2929
import { SimplifiedSchemaQuestionnaire } from "./SimplifiedSchemaQuestionnaire";
30-
import { ScrollableContainer } from "../../../ScrollableContainer";
3130
import { SyncCatalogTable } from "../../SyncCatalogTable";
3231
import { CREATE_CONNECTION_FORM_ID } from "../CreateConnectionForm";
3332

@@ -69,7 +68,7 @@ const SimplifiedConnectionCreationReplication: React.FC = () => {
6968
});
7069

7170
return (
72-
<ScrollParent props={{ className: styles.container }}>
71+
<ScrollParent>
7372
<FlexContainer direction="column" gap="lg">
7473
<Card
7574
title={formatMessage({ id: "connectionForm.selectSyncMode" })}
@@ -102,14 +101,14 @@ const SimplifiedConnectionCreationConfigureConnection: React.FC = () => {
102101
});
103102

104103
return (
105-
<ScrollableContainer className={styles.container}>
104+
<ScrollParent>
106105
<SimplifiedConnectionsSettingsCard
107106
title={formatMessage({ id: "connectionForm.configureConnection" })}
108107
source={source}
109108
destination={destination}
110109
isCreating
111110
/>
112-
</ScrollableContainer>
111+
</ScrollParent>
113112
);
114113
};
115114

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.container {
2+
padding-top: 0;
3+
}

airbyte-webapp/src/components/destination/DestinationConnectionTable/DestinationConnectionTable.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,22 @@ import React from "react";
22

33
import { ConnectionTable } from "components/EntityTable";
44
import { getConnectionTableData } from "components/EntityTable/utils";
5-
import { Box } from "components/ui/Box";
65
import { ScrollParent } from "components/ui/ScrollParent";
76

87
import { WebBackendConnectionListItem } from "core/api/types/AirbyteClient";
98

10-
interface IProps {
9+
import styles from "./DestinationConnectionTable.module.scss";
10+
11+
interface DestinationConnectionTableProps {
1112
connections: WebBackendConnectionListItem[];
1213
}
1314

14-
export const DestinationConnectionTable: React.FC<IProps> = ({ connections }) => {
15+
export const DestinationConnectionTable: React.FC<DestinationConnectionTableProps> = ({ connections }) => {
1516
const data = getConnectionTableData(connections, "destination");
1617

1718
return (
18-
<ScrollParent>
19-
<Box m="xl" mt="none">
20-
<ConnectionTable data={data} entity="destination" />
21-
</Box>
19+
<ScrollParent props={{ className: styles.container }}>
20+
<ConnectionTable data={data} entity="destination" />
2221
</ScrollParent>
2322
);
2423
};
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
@use "scss/variables";
2+
13
.container {
4+
height: 100%;
25
overflow-y: auto;
6+
padding: variables.$spacing-xl;
37
}

airbyte-webapp/src/pages/connections/AllConnectionsPage/AllConnectionsPage.module.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
.pageBody {
99
grid-area: page-content;
10-
overflow-y: auto;
10+
padding-top: 0;
1111
}
1212

1313
.alignSelfStart {

airbyte-webapp/src/pages/connections/AllConnectionsPage/AllConnectionsPage.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useNavigate } from "react-router-dom";
55
import { LoadingPage } from "components";
66
import { ConnectionOnboarding } from "components/connection/ConnectionOnboarding";
77
import { HeadTitle } from "components/HeadTitle";
8-
import { Box } from "components/ui/Box";
98
import { Button } from "components/ui/Button";
109
import { FlexContainer, FlexItem } from "components/ui/Flex";
1110
import { Heading } from "components/ui/Heading";
@@ -72,9 +71,7 @@ export const AllConnectionsPage: React.FC = () => {
7271
}
7372
/>
7473
<ScrollParent props={{ className: styles.pageBody }}>
75-
<Box m="xl" mt="none">
76-
<ConnectionsListCard />
77-
</Box>
74+
<ConnectionsListCard />
7875
</ScrollParent>
7976
</PageGridContainer>
8077
) : (

airbyte-webapp/src/pages/connections/ConnectionMappingsPage/ConnectionMappingsPage.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PageContainer } from "components/PageContainer";
2-
import { ScrollableContainer } from "components/ScrollableContainer";
2+
import { ScrollParent } from "components/ui/ScrollParent";
33

44
import { FeatureItem, IfFeatureDisabled, IfFeatureEnabled } from "core/services/features";
55

@@ -10,7 +10,7 @@ export const ConnectionMappingsPage = () => {
1010
const existingMappings = [];
1111

1212
return (
13-
<ScrollableContainer>
13+
<ScrollParent>
1414
<PageContainer centered>
1515
{existingMappings.length === 0 && (
1616
<>
@@ -23,6 +23,6 @@ export const ConnectionMappingsPage = () => {
2323
</>
2424
)}
2525
</PageContainer>
26-
</ScrollableContainer>
26+
</ScrollParent>
2727
);
2828
};

airbyte-webapp/src/pages/connections/ConnectionReplicationPage/ConnectionReplicationPage.module.scss

-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@
1313
height: 100%;
1414
}
1515
}
16-
17-
.scrollableContainer {
18-
height: 100%;
19-
padding: variables.$spacing-xl;
20-
}

airbyte-webapp/src/pages/connections/ConnectionReplicationPage/ConnectionReplicationPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export const ConnectionReplicationPage: React.FC = () => {
239239

240240
return (
241241
<div className={styles.container}>
242-
<ScrollParent props={{ className: styles.scrollableContainer }}>
242+
<ScrollParent>
243243
<Form<RelevantConnectionValues>
244244
defaultValues={initialValues}
245245
reinitializeDefaultValues

airbyte-webapp/src/pages/connections/ConnectionSettingsPage/ConnectionSettingsPage.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import { ConnectionSyncContextProvider } from "components/connection/ConnectionS
1313
import { I18N_KEY_UNDER_ONE_HOUR_NOT_ALLOWED } from "components/connection/CreateConnectionForm/SimplifiedConnectionCreation/SimplifiedConnectionScheduleFormField";
1414
import { SimplifiedConnectionsSettingsCard } from "components/connection/CreateConnectionForm/SimplifiedConnectionCreation/SimplifiedConnectionSettingsCard";
1515
import { Form } from "components/forms";
16-
import { ScrollableContainer } from "components/ScrollableContainer";
1716
import { Button } from "components/ui/Button";
1817
import { FlexContainer } from "components/ui/Flex";
18+
import { ScrollParent } from "components/ui/ScrollParent";
1919
import { Spinner } from "components/ui/Spinner";
2020

2121
import { ConnectionActionsBlock } from "area/connection/components/ConnectionActionsBlock";
@@ -85,7 +85,7 @@ export const ConnectionSettingsPage: React.FC = () => {
8585
connection.geography !== Geography.auto;
8686

8787
return (
88-
<ScrollableContainer>
88+
<ScrollParent>
8989
<FlexContainer direction="column">
9090
<Form<FormConnectionFormValues>
9191
trackDirtyChanges
@@ -140,6 +140,6 @@ export const ConnectionSettingsPage: React.FC = () => {
140140
)}
141141
</Disclosure>
142142
</FlexContainer>
143-
</ScrollableContainer>
143+
</ScrollParent>
144144
);
145145
};

airbyte-webapp/src/pages/connections/ConnectionTimelinePage/ConnectionTimelineAllEventsList.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTMLAttributes, Ref, forwardRef, useEffect, useMemo } from "react";
1+
import { HTMLAttributes, Ref, forwardRef, useContext, useEffect, useMemo } from "react";
22
import { FormattedMessage } from "react-intl";
33
import { Virtuoso } from "react-virtuoso";
44
import { InferType } from "yup";
@@ -9,6 +9,7 @@ import { EmptyState } from "components/EmptyState";
99
import { Box } from "components/ui/Box";
1010
import { FlexContainer } from "components/ui/Flex";
1111
import { LoadingSpinner } from "components/ui/LoadingSpinner";
12+
import { ScrollParentContext } from "components/ui/ScrollParent";
1213

1314
import { useCurrentConnection, useGetConnectionSyncProgress, useListConnectionEventsInfinite } from "core/api";
1415
import { ConnectionEvent, ConnectionSyncStatus } from "core/api/types/AirbyteClient";
@@ -135,8 +136,8 @@ UlList.displayName = "UlList";
135136

136137
export const ConnectionTimelineAllEventsList: React.FC<{
137138
filterValues: TimelineFilterValues;
138-
scrollElement: HTMLDivElement | null;
139-
}> = ({ filterValues, scrollElement }) => {
139+
}> = ({ filterValues }) => {
140+
const customScrollParent = useContext(ScrollParentContext);
140141
const connection = useCurrentConnection();
141142
const { status } = useConnectionStatus(connection.connectionId);
142143
const { data: syncProgressData } = useGetConnectionSyncProgress(
@@ -243,7 +244,7 @@ export const ConnectionTimelineAllEventsList: React.FC<{
243244
<>
244245
<Virtuoso
245246
data={validatedEvents}
246-
customScrollParent={scrollElement ?? undefined}
247+
customScrollParent={customScrollParent ?? undefined}
247248
useWindowScroll
248249
endReached={handleEndReached}
249250
components={{

airbyte-webapp/src/pages/connections/ConnectionTimelinePage/ConnectionTimelinePage.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { useState } from "react";
21
import { FormattedMessage } from "react-intl";
32

43
import { ConnectionSyncContextProvider } from "components/connection/ConnectionSync/ConnectionSyncContext";
54
import { PageContainer } from "components/PageContainer";
6-
import { ScrollableContainer } from "components/ScrollableContainer";
75
import { Box } from "components/ui/Box";
86
import { Card } from "components/ui/Card";
97
import { FlexContainer } from "components/ui/Flex";
108
import { Heading } from "components/ui/Heading";
9+
import { ScrollParent } from "components/ui/ScrollParent";
1110

1211
import { useCurrentConnection, useFilters, useGetConnectionEvent } from "core/api";
1312
import { PageTrackingCodes, useTrackPage } from "core/services/analytics";
@@ -29,7 +28,6 @@ const OneEventItem: React.FC<{ eventId: string; connectionId: string }> = ({ eve
2928
};
3029

3130
export const ConnectionTimelinePage = () => {
32-
const [scrollElement, setScrollElement] = useState<HTMLDivElement | null>(null);
3331
useTrackPage(PageTrackingCodes.CONNECTIONS_ITEM_TIMELINE);
3432
const connection = useCurrentConnection();
3533
const { openModal } = useModalService();
@@ -61,7 +59,7 @@ export const ConnectionTimelinePage = () => {
6159
}
6260

6361
return (
64-
<ScrollableContainer ref={setScrollElement}>
62+
<ScrollParent>
6563
<PageContainer centered>
6664
<ConnectionSyncContextProvider>
6765
<Box pb="xl">
@@ -84,12 +82,12 @@ export const ConnectionTimelinePage = () => {
8482
{filterValues.eventId ? (
8583
<OneEventItem eventId={filterValues.eventId} connectionId={connection.connectionId} />
8684
) : (
87-
<ConnectionTimelineAllEventsList filterValues={filterValues} scrollElement={scrollElement} />
85+
<ConnectionTimelineAllEventsList filterValues={filterValues} />
8886
)}
8987
</Card>
9088
</Box>
9189
</ConnectionSyncContextProvider>
9290
</PageContainer>
93-
</ScrollableContainer>
91+
</ScrollParent>
9492
);
9593
};
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from "react";
22

33
import { PageContainer } from "components/PageContainer";
4-
import { ScrollableContainer } from "components/ScrollableContainer";
54
import { FlexContainer } from "components/ui/Flex";
5+
import { ScrollParent } from "components/ui/ScrollParent";
66

77
import { useTrackPage, PageTrackingCodes } from "core/services/analytics";
88

@@ -12,12 +12,12 @@ export const ConnectionTransformationPage: React.FC = () => {
1212
useTrackPage(PageTrackingCodes.CONNECTIONS_ITEM_TRANSFORMATION);
1313

1414
return (
15-
<ScrollableContainer>
15+
<ScrollParent>
1616
<PageContainer centered>
1717
<FlexContainer direction="column" gap="lg">
1818
<DbtCloudTransformations />
1919
</FlexContainer>
2020
</PageContainer>
21-
</ScrollableContainer>
21+
</ScrollParent>
2222
);
2323
};

airbyte-webapp/src/pages/connections/StreamStatusPage/StreamStatusPage.module.scss

-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
.container {
44
grid-area: connection-page-content;
5-
overflow-y: auto;
65
display: flex;
76
gap: variables.$spacing-md;
87
flex-direction: column;
9-
padding: variables.$spacing-xl;
108
}

airbyte-webapp/src/pages/destination/AllDestinationsPage/AllDestinationsPage.module.scss

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ $filters-fixed-height: 108px;
1212
.pageBody {
1313
grid-area: page-content;
1414
overflow-y: auto;
15+
padding-top: 0;
1516
}
1617

1718
.card {

0 commit comments

Comments
 (0)