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

style(preview-deployment): better preview deployment card #938

Merged
merged 6 commits into from
Dec 23, 2024

Conversation

190km
Copy link
Contributor

@190km 190km commented Dec 19, 2024

Dark

{0092DFCC-8FBA-4223-AD2C-FDE4C0338984}

Light

{5E4A797E-429A-4C4F-9F80-167866918524}

@190km 190km requested a review from Siumauricio as a code owner December 19, 2024 00:25
@190km 190km changed the title style: better preview deployment card style(preview-deployment): better preview deployment card Dec 19, 2024
Comment on lines 33 to 51
export function PreviewDeploymentCard({
appName,
serverId,

onDeploymentDelete,
deploymentId,
deployments,

domainId,
domainHost,

pullRequestTitle,
pullRequestUrl,
isLoading,
status,
branch,
date,
}: PreviewDeploymentCardProps) {
return (
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel is better to just pass the deploymentId and the serverId, and then inside the component use this hook

const { data: previewDeployment } = api.previewDeployment.one.useQuery({ previewDeploymentId: previewDeploymentId, });
In this way we avoid passing too many props, and thus isolate the component in a more elegant way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think we must left onDeploymentDelete because we need the to refetch deployments when deleting one & isLoading on deleting.

Copy link
Contributor

@Siumauricio Siumauricio Dec 21, 2024

Choose a reason for hiding this comment

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

I think we can also abstract and put the handleDeletePreviewDeployment inside the preview-deployment-card.tsx

in this case we reduce the props we need to pass, we remove the isLoading and the onDeploymentDelete prop

@190km
Copy link
Contributor Author

190km commented Dec 23, 2024

I preferred to put the component directly into PreviewDeployemtsView, because with a separate component, there were too many problems with the View Builds & View Logs not working, and that's how it was written in the first place.

Copy link
Contributor

@Siumauricio Siumauricio left a comment

Choose a reason for hiding this comment

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

Don't worry, I think it's easier to understand this way thanks!

@Siumauricio Siumauricio merged commit 455cae6 into Dokploy:canary Dec 23, 2024
3 checks passed
@Siumauricio Siumauricio mentioned this pull request Dec 27, 2024
@190km 190km deleted the preview-deployment-view branch December 27, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants