diff --git a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx index c4940bac..3c964344 100644 --- a/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx +++ b/packages/frontend/src/components/projects/project/deployments/DeploymentDetailsCard.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useCallback } from 'react'; import { Deployment, DeploymentStatus, @@ -60,85 +60,114 @@ const DeploymentDetailsCard = ({ } }; - return ( -
-
- {/* DEPLOYMENT URL */} - {deployment.url && ( - - - {deployment.url} - - - )} - - {deployment.environment === Environment.Production - ? `Production ${deployment.isCurrent ? '(Current)' : ''}` - : 'Preview'} - -
- - {/* DEPLOYMENT STATUS */} -
- - {deployment.status} - -
- - {/* DEPLOYMENT COMMIT DETAILS */} -
- - - {deployment.branch} - - - - - {deployment.commitHash.substring(0, SHORT_COMMIT_HASH_LENGTH)}{' '} - {deployment.commitMessage} - - -
- - {/* DEPLOYMENT INFOs */} -
-
- - - {relativeTimeMs(deployment.createdAt)} - -
- -
- - - {formatAddress(deployment.createdBy.name ?? '')} - -
+ const renderDeploymentMenu = useCallback( + (className?: string) => { + return ( + ); + }, + [deployment, currentDeployment, onUpdate, project, prodBranchDomains], + ); + + const renderDeploymentStatus = useCallback( + (className?: string) => { + return ( +
+ + {deployment.status} + +
+ ); + }, + [deployment.status, deployment.commitHash], + ); + + return ( +
+
+
+ {/* DEPLOYMENT URL */} + {deployment.url && ( + + + {deployment.url} + + + )} + + {deployment.environment === Environment.Production + ? `Production ${deployment.isCurrent ? '(Current)' : ''}` + : 'Preview'} + +
+ {/* MENU ON MOBILE */} + {renderDeploymentMenu('flex md:hidden ml-auto')} +
+ + {/* DEPLOYMENT STATUS */} + {renderDeploymentStatus('w-[10%] max-w-[110px] hidden md:flex h-fit')} + + {/* DEPLOYMENT COMMIT DETAILS */} +
+
+ + + + {deployment.branch} + + + + + + {deployment.commitHash.substring(0, SHORT_COMMIT_HASH_LENGTH)}{' '} + {deployment.commitMessage} + + +
+ {renderDeploymentStatus('flex md:hidden h-fit')} +
+ + {/* DEPLOYMENT INFOs */} +
+
+
+ + + {relativeTimeMs(deployment.createdAt)} + +
+
+
+ +
+ + {formatAddress(deployment.createdBy.name ?? '')} + +
+
+ {renderDeploymentMenu('ml-auto hidden md:flex')}
);