refactor: standardize code formatting and improve component structure across dashboard components

- Updated component props formatting for consistency.
- Refactored API query hooks and mutation calls for better readability.
- Enhanced tooltip descriptions for clarity in user actions.
- Maintained functionality for deploying, reloading, starting, and stopping applications, composes, and Postgres instances.
This commit is contained in:
Mauricio Siu
2025-03-16 19:50:04 -06:00
parent e97c8f42b3
commit 2405e5a93a
3 changed files with 694 additions and 703 deletions

View File

@@ -33,7 +33,7 @@ export const ShowGeneralApplication = ({ applicationId }: Props) => {
{ {
applicationId, applicationId,
}, },
{ enabled: !!applicationId } { enabled: !!applicationId },
); );
const { mutateAsync: update } = api.application.update.useMutation(); const { mutateAsync: update } = api.application.update.useMutation();
const { mutateAsync: start, isLoading: isStarting } = const { mutateAsync: start, isLoading: isStarting } =
@@ -68,7 +68,7 @@ export const ShowGeneralApplication = ({ applicationId }: Props) => {
toast.success("Application deployed successfully"); toast.success("Application deployed successfully");
refetch(); refetch();
router.push( router.push(
`/dashboard/project/${data?.projectId}/services/application/${applicationId}?tab=deployments` `/dashboard/project/${data?.projectId}/services/application/${applicationId}?tab=deployments`,
); );
}) })
.catch(() => { .catch(() => {
@@ -127,10 +127,7 @@ export const ShowGeneralApplication = ({ applicationId }: Props) => {
</TooltipTrigger> </TooltipTrigger>
<TooltipPrimitive.Portal> <TooltipPrimitive.Portal>
<TooltipContent sideOffset={5} className="z-[60]"> <TooltipContent sideOffset={5} className="z-[60]">
<p> <p>Reload the application without rebuilding it</p>
Reload the application when you change configuration or
environment variables
</p>
</TooltipContent> </TooltipContent>
</TooltipPrimitive.Portal> </TooltipPrimitive.Portal>
</Tooltip> </Tooltip>

View File

@@ -23,7 +23,7 @@ export const ComposeActions = ({ composeId }: Props) => {
{ {
composeId, composeId,
}, },
{ enabled: !!composeId } { enabled: !!composeId },
); );
const { mutateAsync: update } = api.compose.update.useMutation(); const { mutateAsync: update } = api.compose.update.useMutation();
const { mutateAsync: deploy } = api.compose.deploy.useMutation(); const { mutateAsync: deploy } = api.compose.deploy.useMutation();
@@ -47,7 +47,7 @@ export const ComposeActions = ({ composeId }: Props) => {
toast.success("Compose deployed successfully"); toast.success("Compose deployed successfully");
refetch(); refetch();
router.push( router.push(
`/dashboard/project/${data?.project.projectId}/services/compose/${composeId}?tab=deployments` `/dashboard/project/${data?.project.projectId}/services/compose/${composeId}?tab=deployments`,
); );
}) })
.catch(() => { .catch(() => {
@@ -103,10 +103,7 @@ export const ComposeActions = ({ composeId }: Props) => {
</TooltipTrigger> </TooltipTrigger>
<TooltipPrimitive.Portal> <TooltipPrimitive.Portal>
<TooltipContent sideOffset={5} className="z-[60]"> <TooltipContent sideOffset={5} className="z-[60]">
<p> <p>Reload the compose without rebuilding it</p>
Reload the compose when you change configuration or
environment variables
</p>
</TooltipContent> </TooltipContent>
</TooltipPrimitive.Portal> </TooltipPrimitive.Portal>
</Tooltip> </Tooltip>

View File

@@ -25,7 +25,7 @@ export const ShowGeneralPostgres = ({ postgresId }: Props) => {
{ {
postgresId: postgresId, postgresId: postgresId,
}, },
{ enabled: !!postgresId } { enabled: !!postgresId },
); );
const { mutateAsync: reload, isLoading: isReloading } = const { mutateAsync: reload, isLoading: isReloading } =
@@ -61,7 +61,7 @@ export const ShowGeneralPostgres = ({ postgresId }: Props) => {
console.error("Deployment logs error:", error); console.error("Deployment logs error:", error);
setIsDeploying(false); setIsDeploying(false);
}, },
} },
); );
return ( return (
@@ -132,10 +132,7 @@ export const ShowGeneralPostgres = ({ postgresId }: Props) => {
</TooltipTrigger> </TooltipTrigger>
<TooltipPrimitive.Portal> <TooltipPrimitive.Portal>
<TooltipContent sideOffset={5} className="z-[60]"> <TooltipContent sideOffset={5} className="z-[60]">
<p> <p>Reload the PostgreSQL without rebuilding it</p>
Reload the PostgreSQL when you change configuration or
environment variables
</p>
</TooltipContent> </TooltipContent>
</TooltipPrimitive.Portal> </TooltipPrimitive.Portal>
</Tooltip> </Tooltip>