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

Show setup guide in side panel for Source and Destination creation #11985

Merged
merged 41 commits into from
May 19, 2022

Conversation

teallarson
Copy link
Contributor

@teallarson teallarson commented Apr 13, 2022

What

Closes #10644

Previously, users could only access the setup guide by clicking a link and viewing it in a modal that would block access to the form. We want users to have access to the relevant docs when completing Connector setup in a two-panel view.

There are future iterations of this including an open-by-default functionality. There is more work needed before we can move forward with that.

For now, users can access the documentation the same way as before, however it will now open in a side panel that allows them to continue to access the form.

How

  • Adds a new Context to track the state of the side panel and the docs url of the currently selected connector
  • Adds a two panel layout that takes two child React nodes and, depending on the state of the side panel, displays the first panel full screen or both of them side-by-side.
  • Applies the context and provider to all places we have a source or destination creation form
  • Connectors that only list external docs will continue to open in a new tab when a user clicks "Setup Guide"

Recommended reading order

  1. /src/views/Connector/ServiceForm/components/Controls/Instruction.tsx
  2. /src/views/Connector/ConnectorDocumentationLayout/ConnectorDocumentationContext.tsx
  3. /src/views/Connector/ConnectorDocumentationLayout/ConnectorDocumentationLayout.tsx
  4. Others

@github-actions github-actions bot added area/frontend area/platform issues related to the platform labels Apr 13, 2022
@CLAassistant
Copy link

CLAassistant commented May 5, 2022

CLA assistant check
All committers have signed the CLA.

@@ -29,6 +29,15 @@ export const MiddleBlock = styled.div`
justify-content: center;
`;

export const MiddleTitleBlock = styled(H3)`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While I'm not implementing all of the design changes for the main content of the Connector pages, centering the titles made things feel more natural with the docs panel.

@teallarson teallarson marked this pull request as ready for review May 9, 2022 07:30
@teallarson teallarson requested a review from a team as a code owner May 9, 2022 07:30
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.

Looking really good so far. I left a few comments for cleanup. My main concern is that I feel the layout component logic could be simplified and that resizing does not match the design yet.

return url.href;
};

const urlReplacerPlugin: PluggableList = [
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be memoized, including the sanitizeLinks function since it's only used by the result

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I hit a ts error, but I believe that's because of the library we're using. If there's a way to solve it so I can remove the ts-expect-error, would love to change whatever is needed.


const ConnectionPage: React.FC = () => (
export const ConnectionPage: React.FC = () => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Export fixes 🔥

@@ -1,6 +1,7 @@
import styled from "styled-components";

const FormPageContent = styled.div<{ big?: boolean }>`
width: 80%;
Copy link
Contributor

Choose a reason for hiding this comment

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

I tested but could not find the impact of this 80% width setting. What does it fix?

Copy link
Contributor Author

@teallarson teallarson May 9, 2022

Choose a reason for hiding this comment

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

It keeps the forms on Create Source and Create Destination from taking up the full panel width when the docs are open.

To see: go to "Sources", "Add a Source", select a connector, click "Setup Guide". Now if you comment out this line, you'll see the form takes up the full div (depending on screen size). Sounds like there are some other things to revisit with this form's styling when the docs are open though as well.

@teallarson teallarson changed the title WIP - show setup guide in side panel for Source and Destination creation Show setup guide in side panel for Source and Destination creation May 9, 2022
Comment on lines 26 to 28
<SideViewButton type="button" onClick={() => setDocumentationPanelOpen(!documentationPanelOpen)}>
<FormattedMessage id="form.setupGuide" />
</SideViewButton>
Copy link
Contributor Author

@teallarson teallarson May 11, 2022

Choose a reason for hiding this comment

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

This probably doesn't need to remain its own component now that it's so pared down... however I'm leaving it in place for two reasons:
(1) It's called by <ConnectorServiceTypeControls /> and to match the pattern in that file, each field/item should be separated out
(2) Trying not to re-architect any forms with this PR as there's a full redesign of these forms in a separate issue coming up

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.

Looking really good, just had some notes on code details

Copy link
Contributor

@krishnaglick krishnaglick left a comment

Choose a reason for hiding this comment

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

Looks good locally!
I wouldn't mind a button to open documentation floating on the right vs just the link/button we have now, but that's outside the current scope 👍

{currentStep === StepType.SET_UP_CONNECTION && (
<ConnectionStep onNextStep={() => setCurrentStep(StepType.FINAl)} />
)}
{currentStep === StepType.FINAl && <FinalStep />}
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be cleaner in a switch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This page could definitely be cleaned up. The only change I made here was to wrap it in the ConnectorDocumentationWrapper. I am hesitant to change other logic with this PR.

@teallarson
Copy link
Contributor Author

Looks good locally! I wouldn't mind a button to open documentation floating on the right vs just the link/button we have now, but that's outside the current scope 👍

The link goes away in the next iteration where it's open by default... which should be next week now that designs are finalized 🙌

@@ -40,7 +41,13 @@ const SourceFormComponent: React.FC<IProps> = ({ afterSubmit }) => {
}, 2000);
};

const { setDocumentationPanelOpen } = useDocumentationPanelContext();

useEffect(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Documentation Panel auto-closes on route change. However, during Onboarding and Connection workflows we do not change routes. Ideally, I think we should change routes during these flows. For now, we can call "close" in this manner in these workflows.

@dizel852
Copy link
Contributor

At approximately 355px of side panel width, it starts blinking
CPT2205182008-1396x627

@dizel852
Copy link
Contributor

Overlay on left side doesn't fully cover the page if there is a scroll
image

@teallarson
Copy link
Contributor Author

teallarson commented May 18, 2022

At approximately 355px of side panel width, it starts blinking

@dizel852 can you tell me what browser you're on that you're able to produce this? I've tried in Firefox, Safari, and Chrome and can't seem to get any to reproduce that bug! I did push a change earlier today, but I don't think it would have solved that bug?

Overlay on left side doesn't fully cover the page if there is a scroll

Should be resolved now!

@dizel852
Copy link
Contributor

dizel852 commented May 19, 2022

@dizel852 can you tell me what browser you're on that you're able to produce this? I've tried in Firefox, Safari, and Chrome and can't seem to get any to reproduce that bug! I did push a change earlier today, but I don't think it would have solved that bug?

I use Chrome on Mac M1, probably that's why you can't reproduce it.
image

Also double-checked on other browsers:
Firefox - looks good, at least don't blink.
Safari - blinking.

I'm pretty this issue relates to 3rd package - react-reflex. I've found one of the sandboxes and the issue is reproduced:
https://www.loom.com/share/22931eeb526b4d6ba0f9d77aff2abac2
https://codesandbox.io/s/rough-water-mnbtw

It's barely noticeable since it blinks very fast.
I guess we can leave it as-is for now, since we can't do much with it.

Should be resolved now!

Confirm! The issue is gone 😄

@teallarson
Copy link
Contributor Author

I would say it was super noticeable! Was able to reproduce it and fix it by adding overflow: scroll. Now the library react-reflex uses to make panels size aware is able to do its job better.

@dizel852
Copy link
Contributor

dizel852 commented May 19, 2022

I would say it was super noticeable! Was able to reproduce it and fix it by adding overflow: scroll. Now the library react-reflex uses to make panels size aware is able to do its job better.

Yeap, confirm! It doesn't blink anymore. But I have one more concern 😅

During dragging resize button, looks like the browser tries to calculate scroll width and the whole UI is "twitches".
Can we somehow detect when the user starts dragging that resize button and set the appropriate CSS style to don't calculate the scroll width? That would allow us to make really smooth resize 😀

Here's an example:
https://www.loom.com/share/c5dfd68aced3458494d1abaf0a7121f4

@teallarson teallarson force-pushed the teal-side-panel-setup-guide branch from 303e0eb to ccd1009 Compare May 19, 2022 15:00
@teallarson
Copy link
Contributor Author

Merging in its current state after discussing with @edmundito if all checks pass.

@teallarson teallarson merged commit fce4dca into master May 19, 2022
@teallarson teallarson deleted the teal-side-panel-setup-guide branch May 19, 2022 17:19
ganpatagarwal pushed a commit to ganpatagarwal/airbyte that referenced this pull request May 20, 2022
…irbytehq#11985)

* Works on Sources and Destination create now

* styling for side panel

* side panel now reusable component

* works as expected in Connections flow

* move documentation url to context

* cleanup

* fix incorrect docs fetching

* move documentation panel into documentation layout

* move layout and provider to wrapper

* memoize the replaced urls

* cleanup unused props

* make panels size aware

* adjust min size of docs panel

* cleanup

* Show placeholder if no docs exist
* remove unneeded ternary

* use react.fc

* add context to settings pages for sources/destinations

* fix general documentation panel styling

* close on navigation

* rename context, close panel on step change

* fix scroll with dark overlay

* add overflow scroll to fix blinking

* fix merge bug
suhomud pushed a commit that referenced this pull request May 23, 2022
…11985)

* Works on Sources and Destination create now

* styling for side panel

* side panel now reusable component

* works as expected in Connections flow

* move documentation url to context

* cleanup

* fix incorrect docs fetching

* move documentation panel into documentation layout

* move layout and provider to wrapper

* memoize the replaced urls

* cleanup unused props

* make panels size aware

* adjust min size of docs panel

* cleanup

* Show placeholder if no docs exist
* remove unneeded ternary

* use react.fc

* add context to settings pages for sources/destinations

* fix general documentation panel styling

* close on navigation

* rename context, close panel on step change

* fix scroll with dark overlay

* add overflow scroll to fix blinking

* fix merge bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User should be able to go through source/destination setup, while setup guide is displayed
6 participants