Skip to content

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

chore(cloud): color of upgrade notification (#7508)

Marc Klingen339633e8de87
diff --git a/web/src/ee/features/billing/components/UsageTracker.tsx b/web/src/ee/features/billing/components/UsageTracker.tsx
index 121efc1ee4..96d11fbfe4 100644
--- a/web/src/ee/features/billing/components/UsageTracker.tsx
+++ b/web/src/ee/features/billing/components/UsageTracker.tsx
@@ -11,6 +11,9 @@ import {
CardTitle,
} from "@/src/components/ui/card";
import { ActionButton } from "@/src/components/ActionButton";
+import { cn } from "@/src/utils/tailwind";
+import { AlertTriangle } from "lucide-react";
+import { useSidebar } from "@/src/components/ui/sidebar";
export const UsageTracker = () => {
const { organization } = useQueryProjectOrOrganization();
@@ -20,6 +23,7 @@ export const UsageTracker = () => {
organizationId: organization?.id,
scope: "langfuseCloudBilling:CRUD",
});
+ const { setOpen } = useSidebar();
const usageQuery = api.cloudBilling.getUsage.useQuery(
{
@@ -51,24 +55,46 @@ export const UsageTracker = () => {
return null;
}
+ const isCritical = percentage > 200;
+
return (
- <Card className="relative max-h-48 overflow-hidden rounded-md bg-opacity-50 shadow-none group-data-[collapsible=icon]:hidden">
- <CardHeader className="p-4 pb-0">
- <CardTitle className="text-sm">Hobby Plan Usage Limit</CardTitle>
- <CardDescription>
- {`${usage.toLocaleString()} / ${MAX_EVENTS_FREE_PLAN.toLocaleString()} (${percentage.toFixed(0)}%) ${usageType} in last 30 days. Please upgrade your plan to avoid interruptions.`}
- </CardDescription>
- </CardHeader>
- <CardContent className="p-4 pt-2">
- <ActionButton
- variant="secondary"
- size="sm"
- href={`/organization/${organization?.id}/settings/billing`}
- hasAccess={hasAccess}
- >
- Upgrade plan
- </ActionButton>
- </CardContent>
- </Card>
+ <>
+ {/* icon when critical and sidebar is collapsed */}
+ {isCritical && (
+ <AlertTriangle
+ className="hidden h-4 w-4 cursor-pointer self-center text-destructive group-data-[collapsible=icon]:inline-block"
+ onClick={() => setOpen(true)}
+ />
+ )}
+ {/* card when sidebar is not collapsed */}
+ <Card
+ className={cn(
+ "relative max-h-48 overflow-hidden rounded-md bg-opacity-50 shadow-none group-data-[collapsible=icon]:hidden",
+ isCritical && "border-destructive",
+ )}
+ >
+ <CardHeader className="p-4 pb-0">
+ <CardTitle className="flex items-center gap-2 text-sm">
+ {isCritical && (
+ <AlertTriangle className="inline-block h-4 w-4 text-destructive" />
+ )}
+ Plan Usage Limit
+ </CardTitle>
+ <CardDescription>
+ {`${usage.toLocaleString()} / ${MAX_EVENTS_FREE_PLAN.toLocaleString()} (${percentage.toFixed(0)}%) ${usageType} in last 30 days. Please upgrade your plan to avoid interruptions.`}
+ </CardDescription>
+ </CardHeader>
+ <CardContent className="p-4 pt-2">
+ <ActionButton
+ variant={isCritical ? "default" : "secondary"}
+ size="sm"
+ href={`/organization/${organization?.id}/settings/billing`}
+ hasAccess={hasAccess}
+ >
+ Upgrade plan
+ </ActionButton>
+ </CardContent>
+ </Card>
+ </>
);
};