Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪟 🎨 Updating design for BulkEditPanel component #18912

Merged
merged 26 commits into from
Nov 30, 2022

Conversation

YatsukBogdan1
Copy link
Contributor

@YatsukBogdan1 YatsukBogdan1 commented Nov 3, 2022

What

Related to #18188

How

This PR continues the development of the BulkEditPanel component. Initial PR #18262
This PR implements the latest Figma design updates. Still working on hiding action buttons for connections form, and need to implement tests for this component

Screenshot 2022-11-03 at 16 53 52

@YatsukBogdan1 YatsukBogdan1 requested a review from a team as a code owner November 3, 2022 14:54
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Nov 3, 2022
@YatsukBogdan1 YatsukBogdan1 marked this pull request as draft November 4, 2022 13:54
@@ -28,7 +28,7 @@ export const Cell = styled.div<{
lighter?: boolean;
ellipsis?: boolean;
}>`
flex: ${({ flex }) => flex || 1} 0 0;
flex: ${({ flex }) => (flex !== undefined ? flex : 1)} 0 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when flex is passed as 0 it will be still 1 since 0 || 1 will result in 1, but my intention was to pass exactly 0


const Context = React.createContext<EditControlsServiceContext | null>(null);

export interface EditControlsServiceContext {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably use the world Connection (for example, ConnectionEditControlsService), and the filename should also have this name over BulkEditService

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, I found that both EditControls and BulkEditPanel both inside Formik, and also Formik have something called status object, where you can basically pass anything you want that helps you work with form
https://formik.org/docs/api/formik#status-any

A top-level status object that you can use to represent a form state that can't otherwise be expressed/stored with other methods. This is useful for capturing and passing through API responses to your inner component.

so I decided we can use it

@@ -57,6 +60,9 @@ export const BulkEditServiceProvider: React.FC<
};

const isActive = selectedBatchNodes.size > 0;
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This effect should be moved above line 43 so that it's below the existing hooks and above non-hooks.

isActive: boolean;
}

const SchemaHeader = styled(Header)<SchemaHeaderProps>`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still exists over SCSS because Header is a styled component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢


.headerCell {
margin-right: variables.$spacing-xl;
padding-right: 0 !important;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These !important in the file are because of styled components?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@edmundito
Copy link
Contributor

edmundito commented Nov 8, 2022

Looks like the unit tests are failing because of recent changes.

Tested locally, I noticed one more thing in regards to when there is no primary key or cursor. Looks like the design has changed to provide an "not available" state
https://www.figma.com/file/liLQhcbpVHiEDW18kiXQe3/01_03_CONNECTIONS?node-id=2732%3A60474

image

The field count doesn't have the same width as the design:
Screen Shot 2022-11-07 at 20 17 53
image

@YatsukBogdan1 YatsukBogdan1 marked this pull request as ready for review November 8, 2022 09:47
…ons to use Formik state object instead of EditControlsServiceContext; Moves useEffect inside BulkEditServiceProvider; Fixes design of streams count number
…anel in case if pkType or cursorType are null, to show StreamPathSelect in case these values are null
@YatsukBogdan1
Copy link
Contributor Author

@edmundito I updated BulkEditPanel to show StreamPathSelect in cases cursorType and pkType values are null, but we still need to update PillSelect styles, since according to Figma PillSelect with variant strong-blue and disabled: true should look like this:

Screenshot 2022-11-09 at 23 26 36

currently, it looks like this in BulkEditPanel:

Screenshot 2022-11-09 at 23 23 35

and what we need is this:

Screenshot 2022-11-09 at 23 33 09


another case is when we have <source defined>:

Screenshot 2022-11-09 at 23 23 28

should we have the same styles as when select is not available? just didn't find it in Figma

export const pathDisplayName = (path: Path): string => path.join(".");

export type IndexerType = null | "required" | "sourceDefined";

interface StreamPathSelectBaseProps {
paths: Path[];
pathType: "required" | "sourceDefined";
pathType: "required" | "sourceDefined" | null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pathType: "required" | "sourceDefined" | null;
pathType?: "required" | "sourceDefined";

Copy link
Contributor

@edmundito edmundito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. Discussed over Zoom that the state of the dropdowns will be updated separately. I left a couple of small notes, one should be fixed before merge.

const [selectedBatchNodes, { reset, toggle, add }] = useSet<string | undefined>(new Set());
const [options, setOptions] = useState<Partial<AirbyteStreamConfiguration>>(defaultOptions);

const isActive = selectedBatchNodes.size > 0;
useEffect(() => {
setStatus({ editControlsVisible: !isActive });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be safe, the current status should be merge in case it's ever expanded.

    setStatus({ ...status, editControlsVisible: !isActive });

# Conflicts:
#	airbyte-webapp/src/components/SimpleTableComponents/SimpleTableComponents.tsx
#	airbyte-webapp/src/components/connection/CatalogTree/next/StreamPathSelect.module.scss
#	airbyte-webapp/src/components/connection/CatalogTree/next/StreamPathSelect.tsx
# Conflicts:
#	airbyte-webapp/src/components/SimpleTableComponents/SimpleTableComponents.tsx
#	airbyte-webapp/src/components/connection/CatalogTree/next/StreamPathSelect.module.scss
#	airbyte-webapp/src/components/connection/CatalogTree/next/StreamPathSelect.tsx
# Conflicts:
#	airbyte-webapp/src/components/SimpleTableComponents/SimpleTableComponents.tsx
#	airbyte-webapp/src/components/connection/CatalogTree/next/StreamPathSelect.module.scss
#	airbyte-webapp/src/components/connection/CatalogTree/next/StreamPathSelect.tsx
Copy link
Contributor

@dizel852 dizel852 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall - LGTM 👍
Need to fix some comments before merge.

Comment on lines 181 to 191
const renderBulkEditPanel = async (): Promise<RenderResult> => {
let renderResult: RenderResult;
await act(async () => {
renderResult = render(
<IntlProvider locale="en" messages={en}>
<BulkEditPanel />
</IntlProvider>
);
});
return renderResult!;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified and doesn't throw any errors, so comment on the top can be removed

Suggested change
const renderBulkEditPanel = async (): Promise<RenderResult> => {
let renderResult: RenderResult;
await act(async () => {
renderResult = render(
<IntlProvider locale="en" messages={en}>
<BulkEditPanel />
</IntlProvider>
);
});
return renderResult!;
};
const renderBulkEditPanel = () =>
render(
<IntlProvider locale="en" messages={en}>
<BulkEditPanel />
</IntlProvider>
);

@@ -0,0 +1,230 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed after updating the renderBulkEditPanel function

isActive: boolean;
}

const SchemaHeader = styled(Header)<SchemaHeaderProps>`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

@YatsukBogdan1 YatsukBogdan1 merged commit 975f1be into master Nov 30, 2022
@YatsukBogdan1 YatsukBogdan1 deleted the byatsuk/feature-bulk-edit-panel-design-update branch November 30, 2022 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants