-
Notifications
You must be signed in to change notification settings - Fork 4.6k
🪟 🔧 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
🪟 🔧 Refactor FrequentlyUsedDestinations component #19019
Conversation
|
||
interface FrequentlyUsedDestinationsProps { | ||
export interface FrequentlyUsedConnectorsProps { |
There was a problem hiding this comment.
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
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
d9ae8dd
to
5040772
Compare
There was a problem hiding this 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 🙂
...bapp/src/views/Connector/ConnectorForm/components/FrequentlyUsedConnectors/index.stories.tsx
Outdated
Show resolved
Hide resolved
...bapp/src/views/Connector/ConnectorForm/components/FrequentlyUsedConnectors/index.stories.tsx
Outdated
Show resolved
Hide resolved
airbyte-webapp/src/test-utils/mock-data/mockFrequentlyUsedDestinations.ts
Outdated
Show resolved
Hide resolved
...Connector/ConnectorForm/components/FrequentlyUsedConnectors/FrequentlyUsedConnectorsCard.tsx
Outdated
Show resolved
Hide resolved
…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)
There was a problem hiding this 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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface Props { | |
interface useSuggestedConnectorsProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer to use the full name of the interface: https://github.com/airbytehq/airbyte/blob/master/airbyte-webapp/STYLEGUIDE.md#component-props
.../views/Connector/ConnectorForm/components/FrequentlyUsedConnectors/useSuggestedConnectors.ts
Show resolved
Hide resolved
"sourceDefinitionId" | "name" | "icon" | "releaseStage" | ||
>; | ||
|
||
export type ConnectorCard = (DestinationConnectorCard | SourceConnectorCard) & { id: string }; |
There was a problem hiding this comment.
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)
export type ConnectorCard = (DestinationConnectorCard | SourceConnectorCard) & { id: string }; | |
export type SuggestedConnector = ( | |
| Omit<DestinationConnectorCard, "destinationDefinitionId"> | |
| Omit<SourceConnectorCard, "sourceDefinitionId"> | |
) & { connectorDefinitionId: string }; |
There was a problem hiding this comment.
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!!
@dizel852 sorry for merging so fast before your review. I will include your changes on my next PR which will be using this component. |
@letiescanciano Thanks! 🙏 |
@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 |
* 🪟 🔧 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
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 beused later on.
Demo: https://www.loom.com/share/c207ab2a53c146bd8e4fe57a57660a6b
How
Recommended reading order
I separated the changes in 2 commits to facilitate the review.