Skip to content

🪟 🔧 Refactor FrequentlyUsedDestinations component #19019

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

Merged

Conversation

letiescanciano
Copy link
Contributor

What

We need to reuse this component in an experiment to suggest sources.
This PR covers the refactor of FrequentlyUsedDestinations component so it's not destination-dependant and can be
used later on.

Demo: https://www.loom.com/share/c207ab2a53c146bd8e4fe57a57660a6b

How

  • Refactor component to be reused
  • Rename files

Recommended reading order

I separated the changes in 2 commits to facilitate the review.

  1. Starts with the first commit which only include changes inside files, mainly components name and logic extraction into hook.
  2. File rename

@letiescanciano letiescanciano requested a review from a team as a code owner November 7, 2022 10:30
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp team/growth labels Nov 7, 2022

interface FrequentlyUsedDestinationsProps {
export interface FrequentlyUsedConnectorsProps {
Copy link
Contributor Author

@letiescanciano letiescanciano Nov 7, 2022

Choose a reason for hiding this comment

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

This export isn't needed, will be removed in the last commit

@letiescanciano letiescanciano changed the title Leti/refactor suggested destinations component 🪟 🔧 Refactor FrequentlyUsedDestinations component Nov 7, 2022
We need to reuse this component in an experiment to suggest sources.
This PR covers the refactor so it's not destination-dependant and can be
used later on.

Demo: https://www.loom.com/share/c207ab2a53c146bd8e4fe57a57660a6b 
@letiescanciano letiescanciano force-pushed the leti/refactor-suggested-destinations-component branch from d9ae8dd to 5040772 Compare November 7, 2022 18:15
Copy link
Contributor

@joeykmh joeykmh left a comment

Choose a reason for hiding this comment

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

Code looks good to me! Tested locally and it works as expected. I did notice the storybook doesn't seem to work - would be nice to fix that 🙂

…nent

* master:
  🪟 🎉 Enable frontend validation for <1hr syncs (cloud) #19028
  Stream returns AirbyteMessages (#18572)
  🎉 New Source - Recruitee [low-code SDK] (#18671)
  🎉 New source: Breezometer [low-code cdk] (#18650)
  Check disabled connections after protocol update (#18990)
  Simple default replication worker refactor (#19002)
  🎉 New Source: Visma e-conomic (#18595)
  🎉 New Source: Fastbill (#18593)
  Bmoric/extract state api (#18980)
  🎉 New Source: Zapier Supported Storage (#18442)
  🎉 New source: Klarna (#18385)
  `AirbyteEstimateTraceMessage` (#18875)
  Extract source definition api (#18977)
  [low-code cdk] Allow for spec file to be defined in the yaml manifest instead of an external file (#18411)
  🐛 Source HubSpot: fix property scopes (#18624)
  Ensure that only 6-character hex values are passed to monaco editor (#18943)
@letiescanciano letiescanciano merged commit c1a8169 into master Nov 8, 2022
@letiescanciano letiescanciano deleted the leti/refactor-suggested-destinations-component branch November 8, 2022 10:47
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.

Did a review, overall - happy to see one more reusable component. 🥳
But still need to polish some parts, left a comments.


import { ConnectorCard } from "../../types";

interface Props {
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
interface Props {
interface useSuggestedConnectorsProps {

Copy link
Contributor

Choose a reason for hiding this comment

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

"sourceDefinitionId" | "name" | "icon" | "releaseStage"
>;

export type ConnectorCard = (DestinationConnectorCard | SourceConnectorCard) & { id: string };
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure ConnectorCard it's the best name for this kind of interface, since we already have the ConnectorCard component.
I guess would be better to rely on the return type of the useSuggestedConnectors hook, and name it as is - SuggestedConnector. Also, we can omit destinationDefinitionId and sourceDefinitionId since we use just id(connectorDefinitionId in a comment above)

Suggested change
export type ConnectorCard = (DestinationConnectorCard | SourceConnectorCard) & { id: string };
export type SuggestedConnector = (
| Omit<DestinationConnectorCard, "destinationDefinitionId">
| Omit<SourceConnectorCard, "sourceDefinitionId">
) & { connectorDefinitionId: string };

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Love it! Thanks for the suggestion!!

@letiescanciano
Copy link
Contributor Author

@dizel852 sorry for merging so fast before your review. I will include your changes on my next PR which will be using this component.
Thanks a lot for the review!

@dizel852
Copy link
Contributor

dizel852 commented Nov 8, 2022

@letiescanciano Thanks! 🙏

@timroes
Copy link
Contributor

timroes commented Nov 8, 2022

@letiescanciano since the next PR using it will be an experimentation PR, could you please make the changes in a separate one, so that we have the experimentation PR scoped to only the experiment

carlonuccio pushed a commit to carlonuccio/airbyte that referenced this pull request Nov 8, 2022
* 🪟 🔧 Refactor FrequentlyUsedDestinations

We need to reuse this component in an experiment to suggest sources.
This PR covers the refactor so it's not destination-dependant and can be
used later on.

Demo: https://www.loom.com/share/c207ab2a53c146bd8e4fe57a57660a6b 

* PR comments
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 team/growth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants