Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: add error status to progressbar
Marc Seitz3333ebe9d885
diff --git a/components/documents/process-status-bar.tsx b/components/documents/process-status-bar.tsxindex c72fc995..c44b7f45 100644--- a/components/documents/process-status-bar.tsx+++ b/components/documents/process-status-bar.tsx@@ -27,7 +27,10 @@ export default function ProcessStatusBar({<Progressvalue={0}text={error.message}- className={cn("w-full rounded-none", className)}+ className={cn(+ "w-full text-[8px] font-semibold rounded-none",+ className,+ )}/>);}@@ -39,6 +42,20 @@ export default function ProcessStatusBar({const progress = Number(statuses[0].data?.progress) * 100 || 0;const text = String(statuses[0].data?.text) || "";+ if (run.status === "FAILURE") {+ return (+ <Progress+ value={progress}+ text={`Error processing document page ${Number(statuses[0].data?.currentPage)}`}+ error={true}+ className={cn(+ "w-full text-[8px] font-semibold rounded-none",+ className,+ )}+ />+ );+ }+return (<Progressvalue={progress}diff --git a/components/ui/progress.tsx b/components/ui/progress.tsxindex f174a1f6..9963360c 100644--- a/components/ui/progress.tsx+++ b/components/ui/progress.tsx@@ -1,49 +1,60 @@-import * as React from "react"-import * as ProgressPrimitive from "@radix-ui/react-progress"+import * as React from "react";+import * as ProgressPrimitive from "@radix-ui/react-progress";-import { cn } from "@/lib/utils"+import { cn } from "@/lib/utils";+import { HelpCircleIcon } from "lucide-react";const Progress = React.forwardRef<React.ElementRef<typeof ProgressPrimitive.Root>,React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> & {text?: string;+ error?: boolean;}->(({ className, value, text, ...props }, ref) => {--const textColor = `linear-gradient(to right,+>(({ className, value, text, error, ...props }, ref) => {+ const textColor = `linear-gradient(to right,text-background ${value || 0}%,text-foreground ${value || 0}%)`;--return (- <ProgressPrimitive.Root- ref={ref}- className={cn(- "relative h-4 w-full overflow-hidden rounded-full bg-secondary",- className- )}- {...props}- >- <ProgressPrimitive.Indicator- className="h-full w-full flex-1 bg-primary transition-all"- style={{ transform: `translateX(-${100 - (value || 0)}%)` }}- />- {text ? (- <div className="absolute inset-0 flex py-2 items-center justify-center">- <div className="overflow-hidden absolute inset-0 flex items-center justify-center">- <span className="text-xs text-foreground">{text}</span>+ return (+ <ProgressPrimitive.Root+ ref={ref}+ className={cn(+ "relative h-4 w-full overflow-hidden rounded-full bg-secondary",+ className,+ )}+ {...props}+ >+ <ProgressPrimitive.Indicator+ className="h-full w-full flex-1 bg-primary transition-all"+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}+ />+ {text && !error ? (+ <div className="absolute inset-0 flex py-2 items-center justify-center">+ <div className="overflow-hidden absolute inset-0 flex items-center justify-center">+ <span className="text-xs text-foreground">{text}</span>+ </div>+ <div+ className="absolute inset-0 flex items-center justify-center"+ style={{ clipPath: `inset(0 ${100 - (value || 0)}% 0 0)` }}+ >+ <span className="text-xs text-background">{text}</span>+ </div></div>- <div- className="absolute inset-0 flex items-center justify-center"- style={{ clipPath: `inset(0 ${100 - (value || 0)}% 0 0)` }}- >- <span className="text-xs text-background">{text}</span>+ ) : null}+ {text && error ? (+ <div className="absolute inset-0 flex py-2 items-center justify-center">+ <div className="overflow-hidden absolute inset-0 flex items-center justify-center gap-x-2 bg-destructive text-destructive-foreground">+ <span className="text-xs">{text}</span>+ <a href="mailto:[email protected]" title="Contact Support">+ <HelpCircleIcon className="size-4" />+ </a>+ </div></div>- </div>- ) : null}- </ProgressPrimitive.Root>-);});-Progress.displayName = ProgressPrimitive.Root.displayName+ ) : null}+ </ProgressPrimitive.Root>+ );+});+Progress.displayName = ProgressPrimitive.Root.displayName;-export { Progress }+export { Progress };