Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(desktop): match usage limit dialog to app alert pop-ups (#89802)

Charles Vien94f65cb9fe5e
diff --git a/products/desktop/packages/ui/src/features/billing/UsageLimitModal.stories.tsx b/products/desktop/packages/ui/src/features/billing/UsageLimitModal.stories.tsx
index 9951e6534611..dbbbf2197d96 100644
--- a/products/desktop/packages/ui/src/features/billing/UsageLimitModal.stories.tsx
+++ b/products/desktop/packages/ui/src/features/billing/UsageLimitModal.stories.tsx
@@ -37,3 +37,15 @@ export const OrganizationMember: Story = {
},
},
};
+
+export const ProviderRateLimit: Story = {
+ args: {
+ content: {
+ title: "Usage limit reached",
+ description:
+ "This app hit a usage limit. Resets in 12 minutes. Please try again shortly.",
+ actionLabel: null,
+ dismissLabel: "Got it",
+ },
+ },
+};
diff --git a/products/desktop/packages/ui/src/features/billing/UsageLimitModal.tsx b/products/desktop/packages/ui/src/features/billing/UsageLimitModal.tsx
index 69f9cdd4f9c9..df44e730821b 100644
--- a/products/desktop/packages/ui/src/features/billing/UsageLimitModal.tsx
+++ b/products/desktop/packages/ui/src/features/billing/UsageLimitModal.tsx
@@ -1,14 +1,15 @@
-import { WarningCircle } from "@phosphor-icons/react";
+import { Warning } from "@phosphor-icons/react";
import { formatResetTime } from "@posthog/core/billing/usageDisplay";
import type { UsageLimitContent } from "@posthog/core/billing/usageLimitContent";
import { usageLimitContent } from "@posthog/core/billing/usageLimitContent";
import {
+ AlertDialog,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
Button,
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogTitle,
} from "@posthog/quill";
import { ANALYTICS_EVENTS } from "@posthog/shared/analytics-events";
import { useEffect } from "react";
@@ -77,32 +78,39 @@ export function UsageLimitModalContent({
onAction: () => void;
}) {
return (
- <Dialog open={open} onOpenChange={(nextOpen) => !nextOpen && onDismiss()}>
- <DialogContent className="sm:max-w-[400px]">
- <div className="flex flex-col gap-3">
- <div className="flex items-center gap-2">
- <WarningCircle size={20} weight="bold" color="var(--red-9)" />
- <DialogTitle className="mb-0">{content.title}</DialogTitle>
- </div>
- <DialogDescription className="text-(--gray-11) text-sm">
- {content.description}
- </DialogDescription>
- <DialogFooter className="border-t-0 bg-transparent">
- <Button
- type="button"
- variant={content.actionLabel ? "outline" : "primary"}
- onClick={onDismiss}
- >
- {content.dismissLabel}
- </Button>
- {content.actionLabel && (
- <Button type="button" onClick={onAction}>
+ <AlertDialog
+ open={open}
+ onOpenChange={(nextOpen) => {
+ if (!nextOpen) onDismiss();
+ }}
+ >
+ <AlertDialogContent>
+ <AlertDialogHeader>
+ <AlertDialogTitle>
+ <span className="flex items-center gap-2">
+ <Warning size={18} weight="fill" color="var(--orange-9)" />
+ {content.title}
+ </span>
+ </AlertDialogTitle>
+ <AlertDialogDescription>{content.description}</AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter>
+ {content.actionLabel ? (
+ <>
+ <Button variant="outline" onClick={onDismiss}>
+ {content.dismissLabel}
+ </Button>
+ <Button variant="primary" onClick={onAction}>
{content.actionLabel}
</Button>
- )}
- </DialogFooter>
- </div>
- </DialogContent>
- </Dialog>
+ </>
+ ) : (
+ <Button variant="primary" onClick={onDismiss}>
+ {content.dismissLabel}
+ </Button>
+ )}
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
);
}