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

View File

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

View File

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