Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(web): Cleanup `Progress` component (#15366)

Ben Bachem1c1a9d36395a
diff --git a/web/.storybook/main.ts b/web/.storybook/main.ts
index 64ffc6e9cb..252542adee 100644
--- a/web/.storybook/main.ts
+++ b/web/.storybook/main.ts
@@ -11,6 +11,7 @@ import {
const STORY_EXTENSIONS = "@(js|jsx|mjs|ts|tsx)";
const DESIGN_COMPONENT_STORIES = [
"LangfuseIcon/LangfuseIcon",
+ "Progress/Progress",
"Spinner/Spinner",
"Switch/Switch",
] as const;
diff --git a/web/src/components/design-system/Progress/Progress.stories.tsx b/web/src/components/design-system/Progress/Progress.stories.tsx
new file mode 100644
index 0000000000..6dc853c960
--- /dev/null
+++ b/web/src/components/design-system/Progress/Progress.stories.tsx
@@ -0,0 +1,24 @@
+import preview from "../../../../.storybook/preview";
+import { Progress } from "./Progress";
+
+const meta = preview.meta({
+ component: Progress,
+});
+
+export const Empty = meta.story({
+ args: {
+ value: 0,
+ },
+});
+
+export const InProgress = meta.story({
+ args: {
+ value: 50,
+ },
+});
+
+export const Complete = meta.story({
+ args: {
+ value: 100,
+ },
+});
diff --git a/web/src/components/ui/progress.tsx b/web/src/components/design-system/Progress/Progress.tsx
similarity index 65%
rename from web/src/components/ui/progress.tsx
rename to web/src/components/design-system/Progress/Progress.tsx
index c8cf572f93..84b659926f 100644
--- a/web/src/components/ui/progress.tsx
+++ b/web/src/components/design-system/Progress/Progress.tsx
@@ -3,19 +3,18 @@
import * as React from "react";
import * as ProgressPrimitive from "@radix-ui/react-progress";
-import { cn } from "@/src/utils/tailwind";
+type ProgressProps = Required<
+ Pick<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>, "value">
+>;
const Progress = React.forwardRef<
React.ComponentRef<typeof ProgressPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
->(({ className, value, ...props }, ref) => (
+ ProgressProps
+>(({ value }, ref) => (
<ProgressPrimitive.Root
ref={ref}
- className={cn(
- "bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",
- className,
- )}
- {...props}
+ value={value}
+ className="bg-primary/20 relative h-2 w-full overflow-hidden rounded-full"
>
<ProgressPrimitive.Indicator
className="bg-primary h-full w-full flex-1 transition-all"
diff --git a/web/src/features/batch-actions/components/AddObservationsToDatasetDialog/StatusStep.tsx b/web/src/features/batch-actions/components/AddObservationsToDatasetDialog/StatusStep.tsx
index d4637eec88..dd62d1e901 100644
--- a/web/src/features/batch-actions/components/AddObservationsToDatasetDialog/StatusStep.tsx
+++ b/web/src/features/batch-actions/components/AddObservationsToDatasetDialog/StatusStep.tsx
@@ -1,5 +1,5 @@
import { Button } from "@/src/components/ui/button";
-import { Progress } from "@/src/components/ui/progress";
+import { Progress } from "@/src/components/design-system/Progress/Progress";
import { api } from "@/src/utils/api";
import { StatusBadge } from "@/src/components/layouts/status-badge";
import { BatchActionStatus } from "@langfuse/shared";
@@ -134,7 +134,7 @@ export function StatusStep({
</span>
<span className="font-bold">{progressPercent}%</span>
</div>
- <Progress value={progressPercent} className="h-2" />
+ <Progress value={progressPercent} />
</div>
<div className="bg-muted/50 grid grid-cols-2 gap-4 rounded-lg p-3 text-sm">
diff --git a/web/src/features/datasets/components/PreviewCsvImport.tsx b/web/src/features/datasets/components/PreviewCsvImport.tsx
index a034848845..2a7fae4e63 100644
--- a/web/src/features/datasets/components/PreviewCsvImport.tsx
+++ b/web/src/features/datasets/components/PreviewCsvImport.tsx
@@ -9,7 +9,7 @@ import {
import { useState, useEffect } from "react";
import { Button } from "@/src/components/ui/button";
import { api } from "@/src/utils/api";
-import { Progress } from "@/src/components/ui/progress";
+import { Progress } from "@/src/components/design-system/Progress/Progress";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { DialogBody, DialogFooter } from "@/src/components/ui/dialog";
import { CsvImportValidationError } from "./CsvImportValidationError";
@@ -281,7 +281,6 @@ export function PreviewCsvImport({
csvImport.progress.totalItems) *
100
}
- className="w-full"
/>
</div>
)}