mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-15 07:25:25 +02:00
✨ Use new Pay-Wall Dialog in layout
This commit is contained in:
parent
92f294f40f
commit
db78ad01b1
5 changed files with 101 additions and 89 deletions
|
@ -5,6 +5,7 @@ import { MobileNavigation } from "@/app/[locale]/(admin)/mobile-navigation";
|
||||||
import { ProBadge } from "@/app/[locale]/(admin)/pro-badge";
|
import { ProBadge } from "@/app/[locale]/(admin)/pro-badge";
|
||||||
import { Sidebar } from "@/app/[locale]/(admin)/sidebar";
|
import { Sidebar } from "@/app/[locale]/(admin)/sidebar";
|
||||||
import { LogoLink } from "@/app/components/logo-link";
|
import { LogoLink } from "@/app/components/logo-link";
|
||||||
|
import { PayWallDialog } from "@/components/pay-wall-dialog";
|
||||||
|
|
||||||
export default async function Layout({
|
export default async function Layout({
|
||||||
children,
|
children,
|
||||||
|
@ -12,6 +13,7 @@ export default async function Layout({
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
|
<PayWallDialog>
|
||||||
<div className="flex flex-col pb-16 md:pb-0">
|
<div className="flex flex-col pb-16 md:pb-0">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
|
@ -31,5 +33,6 @@ export default async function Layout({
|
||||||
<MobileNavigation />
|
<MobileNavigation />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</PayWallDialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import { cn } from "@rallly/ui";
|
import { cn } from "@rallly/ui";
|
||||||
import { Button } from "@rallly/ui/button";
|
import { Button } from "@rallly/ui/button";
|
||||||
|
import { DialogTrigger } from "@rallly/ui/dialog";
|
||||||
import { Icon } from "@rallly/ui/icon";
|
import { Icon } from "@rallly/ui/icon";
|
||||||
import {
|
import {
|
||||||
ArrowUpRightIcon,
|
ArrowUpRightIcon,
|
||||||
|
@ -19,6 +20,7 @@ import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
|
|
||||||
import { CurrentUserAvatar } from "@/components/current-user-avatar";
|
import { CurrentUserAvatar } from "@/components/current-user-avatar";
|
||||||
|
import { PayWallDialog } from "@/components/pay-wall-dialog";
|
||||||
import { ProBadge } from "@/components/pro-badge";
|
import { ProBadge } from "@/components/pro-badge";
|
||||||
import { Trans } from "@/components/trans";
|
import { Trans } from "@/components/trans";
|
||||||
import { IfGuest, useUser } from "@/components/user-provider";
|
import { IfGuest, useUser } from "@/components/user-provider";
|
||||||
|
@ -102,10 +104,9 @@ export function Sidebar() {
|
||||||
<ul role="list" className="-mx-2 space-y-1">
|
<ul role="list" className="-mx-2 space-y-1">
|
||||||
<IfFreeUser>
|
<IfFreeUser>
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<PayWallDialog>
|
||||||
href="/settings/billing"
|
<DialogTrigger asChild>
|
||||||
className="mb-4 grid rounded-md border bg-gray-50 px-4 py-3 focus:border-gray-300 focus:bg-gray-200"
|
<button className="mb-4 flex w-full flex-col rounded-md border bg-gray-50 px-4 py-3 focus:border-gray-300 focus:bg-gray-200">
|
||||||
>
|
|
||||||
<span className="mb-2 flex items-center gap-x-2">
|
<span className="mb-2 flex items-center gap-x-2">
|
||||||
<SparklesIcon className="size-5 text-gray-400" />
|
<SparklesIcon className="size-5 text-gray-400" />
|
||||||
<span className="text-sm font-bold">
|
<span className="text-sm font-bold">
|
||||||
|
@ -119,7 +120,9 @@ export function Sidebar() {
|
||||||
defaults="Unlock all Pro features."
|
defaults="Unlock all Pro features."
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</button>
|
||||||
|
</DialogTrigger>
|
||||||
|
</PayWallDialog>
|
||||||
</li>
|
</li>
|
||||||
</IfFreeUser>
|
</IfFreeUser>
|
||||||
<IfGuest>
|
<IfGuest>
|
||||||
|
|
|
@ -13,7 +13,6 @@ import {
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
import { DuplicateForm } from "@/app/[locale]/poll/[urlId]/duplicate-form";
|
import { DuplicateForm } from "@/app/[locale]/poll/[urlId]/duplicate-form";
|
||||||
import { PayWallDialogContent } from "@/app/[locale]/poll/[urlId]/pay-wall-dialog-content";
|
|
||||||
import { trpc } from "@/app/providers";
|
import { trpc } from "@/app/providers";
|
||||||
import { Trans } from "@/components/trans";
|
import { Trans } from "@/components/trans";
|
||||||
import { usePostHog } from "@/utils/posthog";
|
import { usePostHog } from "@/utils/posthog";
|
||||||
|
@ -30,7 +29,6 @@ export function DuplicateDialog({
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
return (
|
return (
|
||||||
<Dialog {...props}>
|
<Dialog {...props}>
|
||||||
<PayWallDialogContent>
|
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
|
@ -77,7 +75,6 @@ export function DuplicateDialog({
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</PayWallDialogContent>
|
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
import { pricingData } from "@rallly/billing/pricing";
|
import { pricingData } from "@rallly/billing/pricing";
|
||||||
import { Badge } from "@rallly/ui/badge";
|
import { Badge } from "@rallly/ui/badge";
|
||||||
import { Dialog, DialogContent, DialogProps } from "@rallly/ui/dialog";
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogProps,
|
||||||
|
useDialog,
|
||||||
|
} from "@rallly/ui/dialog";
|
||||||
import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group";
|
import { RadioGroup, RadioGroupItem } from "@rallly/ui/radio-group";
|
||||||
import { m } from "framer-motion";
|
import { m } from "framer-motion";
|
||||||
import { CheckIcon } from "lucide-react";
|
import { CheckIcon } from "lucide-react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useState } from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { Trans } from "@/components/trans";
|
import { Trans } from "@/components/trans";
|
||||||
import { UpgradeButton } from "@/components/upgrade-button";
|
import { UpgradeButton } from "@/components/upgrade-button";
|
||||||
|
@ -22,11 +29,13 @@ const monthlyPriceAnnualRate = (pricingData.yearly.amount / 100 / 12).toFixed(
|
||||||
2,
|
2,
|
||||||
);
|
);
|
||||||
|
|
||||||
export function PayWallDialogContent(props: DialogProps) {
|
export function PayWallDialog({ children, ...forwardedProps }: DialogProps) {
|
||||||
const [period, setPeriod] = useState("yearly");
|
const dialog = useDialog();
|
||||||
|
const [period, setPeriod] = React.useState("yearly");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog {...props}>
|
<Dialog {...dialog.dialogProps} {...forwardedProps}>
|
||||||
|
{children}
|
||||||
<DialogContent className="w-[600px] p-4">
|
<DialogContent className="w-[600px] p-4">
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<header className="pt-4">
|
<header className="pt-4">
|
|
@ -27,8 +27,8 @@ import Link from "next/link";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
import { DuplicateDialog } from "@/app/[locale]/poll/[urlId]/duplicate-dialog";
|
import { DuplicateDialog } from "@/app/[locale]/poll/[urlId]/duplicate-dialog";
|
||||||
import { PayWallDialogContent } from "@/app/[locale]/poll/[urlId]/pay-wall-dialog-content";
|
|
||||||
import { trpc } from "@/app/providers";
|
import { trpc } from "@/app/providers";
|
||||||
|
import { PayWallDialog } from "@/components/pay-wall-dialog";
|
||||||
import { FinalizePollDialog } from "@/components/poll/manage-poll/finalize-poll-dialog";
|
import { FinalizePollDialog } from "@/components/poll/manage-poll/finalize-poll-dialog";
|
||||||
import { ProFeatureBadge } from "@/components/pro-feature-badge";
|
import { ProFeatureBadge } from "@/components/pro-feature-badge";
|
||||||
import { Trans } from "@/components/trans";
|
import { Trans } from "@/components/trans";
|
||||||
|
@ -274,7 +274,7 @@ const ManagePoll: React.FunctionComponent<{
|
||||||
{...duplicateDialog.dialogProps}
|
{...duplicateDialog.dialogProps}
|
||||||
/>
|
/>
|
||||||
<FinalizePollDialog {...finalizeDialog.dialogProps} />
|
<FinalizePollDialog {...finalizeDialog.dialogProps} />
|
||||||
<PayWallDialogContent {...paywallDialog.dialogProps} />
|
<PayWallDialog {...paywallDialog.dialogProps} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue