Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 70 additions & 16 deletions web/components/templates/waitlist/FeatureWaitlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ interface FeatureWaitlistProps {
title?: string;
description?: string;
organizationId?: string;
variant?: "card" | "flat";
}

export function FeatureWaitlist({
feature,
title = "Join the Waitlist",
description = "Be the first to know when this feature becomes available.",
organizationId,
variant = "card",
}: FeatureWaitlistProps) {
const user = useHeliconeAuthClient();

Expand Down Expand Up @@ -80,32 +82,84 @@ export function FeatureWaitlist({
};

if (isOnWaitlist?.data?.isOnWaitlist) {
const content = (
<div className="flex flex-col items-center gap-4 py-8 text-center">
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30">
<CheckIcon className="h-6 w-6 text-green-600 dark:text-green-400" />
</div>
<div>
<H3 className="mb-2">You&lsquo;re on the list!</H3>
<P className="text-muted-foreground">
We&lsquo;ll notify you at <strong>{email}</strong> when this feature
is available.
</P>
</div>
</div>
);

if (variant === "flat") {
return <div className="w-full">{content}</div>;
}

return (
<Card className="w-full">
<CardContent className="pt-6">
<div className="flex flex-col items-center gap-4 py-8 text-center">
<div className="flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30">
<CheckIcon className="h-6 w-6 text-green-600 dark:text-green-400" />
</div>
<div>
<H3 className="mb-2">You&lsquo;re on the list!</H3>
<P className="text-muted-foreground">
We&lsquo;ll notify you at <strong>{email}</strong> when this
feature is available.
</P>
</div>
</div>
</CardContent>
<CardContent className="pt-6">{content}</CardContent>
</Card>
);
}

const content = (
<>
<div className="mb-4 flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg border border-border">
<Mail className="h-5 w-5 text-muted-foreground" />
</div>
<div>
<H3>{title}</H3>
<Small className="text-muted-foreground">{description}</Small>
</div>
</div>
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
<div className="flex flex-col gap-2">
<Input
type="email"
placeholder="Enter your email"
value={email}
disabled={true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Email input is always disabled, preventing user input. This means users cannot join the waitlist unless they're already authenticated with a valid email.

className="w-full"
aria-label="Email address"
/>
{error && <Small className="text-destructive">{error}</Small>}
</div>
<Button
type="submit"
variant="secondary"
disabled={isPending || !email}
className="w-full"
>
{isPending ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Joining...
</>
) : (
"Join Waitlist"
)}
</Button>
</form>
</>
);

if (variant === "flat") {
return <div className="w-full">{content}</div>;
}

return (
<Card className="w-full">
<CardHeader>
<div className="flex items-center gap-3">
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/30">
<Mail className="h-5 w-5 text-blue-600 dark:text-blue-400" />
<div className="flex h-10 w-10 items-center justify-center rounded-lg border border-border">
<Mail className="h-5 w-5 text-muted-foreground" />
</div>
<div>
<H3>{title}</H3>
Expand Down
Loading
Loading