fix(ui): improve server schedule responsiveness for mobile

This commit is contained in:
Tam Nguyen
2025-08-31 10:25:09 +10:00
parent 7273c636a0
commit 468feaa092
2 changed files with 442 additions and 440 deletions
@@ -58,7 +58,7 @@ export const ShowDeployments = ({
{ {
enabled: !!id, enabled: !!id,
refetchInterval: 1000, refetchInterval: 1000,
}, }
); );
const { mutateAsync: rollback, isLoading: isRollingBack } = const { mutateAsync: rollback, isLoading: isRollingBack } =
@@ -77,7 +77,7 @@ export const ShowDeployments = ({
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<CardTitle className="text-xl">Deployments</CardTitle> <CardTitle className="text-xl">Deployments</CardTitle>
<CardDescription> <CardDescription>
See all the 10 last deployments for this {type} See the last 10 deployments for this {type}
</CardDescription> </CardDescription>
</div> </div>
<div className="flex flex-row items-center gap-2"> <div className="flex flex-row items-center gap-2">
@@ -104,7 +104,9 @@ export const ShowDeployments = ({
<span>Webhook URL: </span> <span>Webhook URL: </span>
<div className="flex flex-row items-center gap-2"> <div className="flex flex-row items-center gap-2">
<span className="break-all text-muted-foreground"> <span className="break-all text-muted-foreground">
{`${url}/api/deploy${type === "compose" ? "/compose" : ""}/${refreshToken}`} {`${url}/api/deploy${
type === "compose" ? "/compose" : ""
}/${refreshToken}`}
</span> </span>
{(type === "application" || type === "compose") && ( {(type === "application" || type === "compose") && (
<RefreshToken id={id} type={type} /> <RefreshToken id={id} type={type} />
@@ -165,8 +167,8 @@ export const ShowDeployments = ({
Math.floor( Math.floor(
(new Date(deployment.finishedAt).getTime() - (new Date(deployment.finishedAt).getTime() -
new Date(deployment.startedAt).getTime()) / new Date(deployment.startedAt).getTime()) /
1000, 1000
), )
)} )}
</Badge> </Badge>
)} )}
@@ -220,7 +222,7 @@ export const ShowDeployments = ({
}) })
.then(() => { .then(() => {
toast.success( toast.success(
"Rollback initiated successfully", "Rollback initiated successfully"
); );
}) })
.catch(() => { .catch(() => {
@@ -44,7 +44,7 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
}, },
{ {
enabled: !!id, enabled: !!id,
}, }
); );
const utils = api.useUtils(); const utils = api.useUtils();
@@ -58,7 +58,7 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
return ( return (
<Card className="border px-6 shadow-none bg-transparent h-full min-h-[50vh]"> <Card className="border px-6 shadow-none bg-transparent h-full min-h-[50vh]">
<CardHeader className="px-0"> <CardHeader className="px-0">
<div className="flex justify-between items-center"> <div className="flex justify-between items-center gap-y-2 flex-wrap">
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<CardTitle className="text-xl font-bold flex items-center gap-2"> <CardTitle className="text-xl font-bold flex items-center gap-2">
Scheduled Tasks Scheduled Tasks
@@ -91,15 +91,15 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
return ( return (
<div <div
key={schedule.scheduleId} key={schedule.scheduleId}
className="flex items-center justify-between rounded-lg border p-3 transition-colors bg-muted/50" className="flex items-center flex-wrap sm:flex-nowrap gap-y-2 justify-between rounded-lg border p-3 transition-colors bg-muted/50"
> >
<div className="flex items-start gap-3"> <div className="flex items-start gap-3">
<div className="flex h-9 w-9 items-center justify-center rounded-full bg-primary/5"> <div className="flex flex-shrink-0 h-9 w-9 items-center justify-center rounded-full bg-primary/5">
<Clock className="size-4 text-primary/70" /> <Clock className="size-4 text-primary/70" />
</div> </div>
<div className="space-y-1.5"> <div className="space-y-1.5">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<h3 className="text-sm font-medium leading-none"> <h3 className="text-sm font-medium leading-none [overflow-wrap:anywhere] line-clamp-3">
{schedule.name} {schedule.name}
</h3> </h3>
<Badge <Badge
@@ -142,7 +142,7 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
</div> </div>
</div> </div>
<div className="flex items-center gap-1.5"> <div className="flex items-center gap-0.5 md:gap-1.5">
<ShowDeploymentsModal <ShowDeploymentsModal
id={schedule.scheduleId} id={schedule.scheduleId}
type="schedule" type="schedule"
@@ -169,7 +169,7 @@ export const ShowSchedules = ({ id, scheduleType = "application" }: Props) => {
}) })
.then(async () => { .then(async () => {
await new Promise((resolve) => await new Promise((resolve) =>
setTimeout(resolve, 1500), setTimeout(resolve, 1500)
); );
refetchSchedules(); refetchSchedules();
}) })