From 44a21f9ea83edcb7254da7409c360017d99b2091 Mon Sep 17 00:00:00 2001 From: bluemoehre Date: Wed, 1 Jul 2026 00:18:29 +0200 Subject: [PATCH] add Jobs components --- src/components/JobList.tsx | 25 +++++++++++ src/components/JobListItem.tsx | 30 +++++++++++++ src/components/ui/label.tsx | 18 ++++++++ src/components/ui/progress.tsx | 81 ++++++++++++++++++++++++++++++++++ src/views/JobsView.tsx | 7 ++- 5 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 src/components/JobList.tsx create mode 100644 src/components/JobListItem.tsx create mode 100644 src/components/ui/label.tsx create mode 100644 src/components/ui/progress.tsx diff --git a/src/components/JobList.tsx b/src/components/JobList.tsx new file mode 100644 index 0000000..8993573 --- /dev/null +++ b/src/components/JobList.tsx @@ -0,0 +1,25 @@ +import { JobListItem, type JobListItemProps } from "@/components/JobListItem" +import { cn } from "@/lib/utils" + +export interface JobListProps { + jobs: JobListItemProps[] + className?: string +} + +export function JobList({ jobs, className }: JobListProps) { + if (jobs.length === 0) { + return ( +
+

No running jobs.

+
+ ) + } + + return ( +
+ {jobs.map((job, index) => ( + + ))} +
+ ) +} diff --git a/src/components/JobListItem.tsx b/src/components/JobListItem.tsx new file mode 100644 index 0000000..bee23dd --- /dev/null +++ b/src/components/JobListItem.tsx @@ -0,0 +1,30 @@ +import { Progress } from "@/components/ui/progress" +import { cn } from "@/lib/utils" +import { formatTime } from "@/utils/datetime" + +export interface JobListItemProps { + title: string + runningTime: string + progress: number + startTime?: string + eta?: string + className?: string +} + +export function JobListItem({ title, runningTime, progress, startTime, eta, className }: JobListItemProps) { + return ( +
+
+ {title} + {runningTime} +
+ + {(startTime || eta) && ( +
+ {startTime ? formatTime(startTime) : ""} started + {eta ? `ETA ${formatTime(eta)}` : ""} +
+ )} +
+ ) +} diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsx new file mode 100644 index 0000000..f162996 --- /dev/null +++ b/src/components/ui/label.tsx @@ -0,0 +1,18 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +function Label({ className, ...props }: React.ComponentProps<"label">) { + return ( +