Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Enhance CreateOrganizationDialog and UI components for improved user experience

Bill Yang5a96a91f2154
diff --git a/client/src/app/settings/organization/layout.tsx b/client/src/app/settings/organization/layout.tsx
index cc73eaa02..d2d864a18 100644
--- a/client/src/app/settings/organization/layout.tsx
+++ b/client/src/app/settings/organization/layout.tsx
@@ -1,6 +1,6 @@
"use client";
-import { CreditCard, Users } from "lucide-react";
+import { CreditCard, Plus, Users } from "lucide-react";
import { usePathname, useRouter } from "next/navigation";
import { useState } from "react";
import { CreateOrganizationDialog } from "../../../components/CreateOrganizationDialog";
@@ -38,7 +38,11 @@ export default function OrganizationLayout({ children }: { children: React.React
<CreateOrganizationDialog
open={createOrgDialogOpen}
onOpenChange={setCreateOrgDialogOpen}
- trigger={<Button>New Organization</Button>}
+ trigger={
+ <Button variant="secondary" size="icon">
+ <Plus className="h-4 w-4" />
+ </Button>
+ }
/>
</div>
diff --git a/client/src/components/CreateOrganizationDialog.tsx b/client/src/components/CreateOrganizationDialog.tsx
index 22d5bf368..9771de2a3 100644
--- a/client/src/components/CreateOrganizationDialog.tsx
+++ b/client/src/components/CreateOrganizationDialog.tsx
@@ -11,12 +11,13 @@ import { DialogFooter } from "./ui/dialog";
import { DialogDescription } from "./ui/dialog";
import { Input } from "./ui/input";
import { Label } from "./ui/label";
-import { AlertCircle, Building2 } from "lucide-react";
+import { AlertCircle, AlertTriangle, Building2 } from "lucide-react";
import { authClient } from "../lib/auth";
import { toast } from "sonner";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { USER_ORGANIZATIONS_QUERY_KEY } from "../api/admin/hooks/useOrganizations";
import { Alert, AlertDescription, AlertTitle } from "./ui/alert";
+import { useStripeSubscription } from "../lib/subscription/useStripeSubscription";
interface CreateOrganizationDialogProps {
open: boolean;
@@ -31,6 +32,8 @@ export function CreateOrganizationDialog({ open, onOpenChange, onSuccess, trigge
const [error, setError] = useState<string>("");
const queryClient = useQueryClient();
+ const { data: subscription } = useStripeSubscription();
+
// Generate slug from name when name changes
const handleNameChange = (value: string) => {
setName(value);
@@ -104,9 +107,9 @@ export function CreateOrganizationDialog({ open, onOpenChange, onSuccess, trigge
<DialogHeader>
<DialogTitle className="text-2xl flex items-center gap-2">
<Building2 className="h-6 w-6" />
- Create Your Organization
+ Create Organization
</DialogTitle>
- <DialogDescription>Set up your organization to get started with Rybbit</DialogDescription>
+ <DialogDescription>Set up a new organization to add websites and users</DialogDescription>
</DialogHeader>
<form onSubmit={handleSubmit} className="space-y-6">
<div className="space-y-4">
@@ -156,6 +159,16 @@ export function CreateOrganizationDialog({ open, onOpenChange, onSuccess, trigge
<AlertDescription>{error}</AlertDescription>
</Alert>
)}
+ {subscription?.status === "active" && (
+ <Alert variant="warning">
+ <AlertTriangle className="h-4 w-4" />
+ <AlertTitle>Subscription Will Not Carry Over</AlertTitle>
+ <AlertDescription>
+ You can create another organization, but your current subscription only applies to your current
+ organization.
+ </AlertDescription>
+ </Alert>
+ )}
</div>
<DialogFooter>
diff --git a/client/src/components/ui/alert.tsx b/client/src/components/ui/alert.tsx
index 031aabfdd..bf07c43ee 100644
--- a/client/src/components/ui/alert.tsx
+++ b/client/src/components/ui/alert.tsx
@@ -11,6 +11,12 @@ const alertVariants = cva(
default: "bg-white text-neutral-950 dark:bg-neutral-950 dark:text-neutral-50",
destructive:
"border-red-500/50 text-red-500 dark:border-red-500 [&>svg]:text-red-500 dark:bg-red-950/70 dark:border-red-900/50 dark:text-red-400 dark:dark:border-red-900 dark:[&>svg]:text-red-400",
+ success:
+ "border-green-500/50 text-green-600 dark:border-green-500 [&>svg]:text-green-600 dark:bg-green-950/70 dark:border-green-900/50 dark:text-green-400 dark:[&>svg]:text-green-400",
+ warning:
+ "border-yellow-500/50 text-yellow-600 dark:border-yellow-500 [&>svg]:text-yellow-600 dark:bg-yellow-950/70 dark:border-yellow-900/50 dark:text-yellow-400 dark:[&>svg]:text-yellow-400",
+ info:
+ "border-blue-500/50 text-blue-600 dark:border-blue-500 [&>svg]:text-blue-600 dark:bg-blue-950/70 dark:border-blue-900/50 dark:text-blue-400 dark:[&>svg]:text-blue-400",
},
},
defaultVariants: {