Files
tweakcn/components/get-pro-dialog-wrapper.tsx
Sameer Singh a3c4c6c8e8 feat: replace all Dialog usage with Revola for responsive behavior (Responsive Dialog) (#208)
* chore: add @base-ui-components/react dependency and update pnpm-lock.yaml

* feat: add custom hook useMediaQuery for responsive design

* refactor: streamline button component code for improved readability

* refactor: enhance ScrollArea component with viewport className prop and improve className organization

* refactor: replace Dialog component with ResponsiveDialog for improved responsiveness and UI consistency

* feat: introduce ResponsiveDialog component for enhanced mobile and desktop dialog handling

* refactor: update Next.js configuration to use TypeScript type for NextConfig

* refactor: replace Dialog with ResponsiveDialog in CardsChat component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in ShareDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in FigmaExportDialog component for improved UI consistency and responsiveness.

- Use `Scrollarea` for cleaner scrollbar and structure it a bit different, so scrollbar's doesn't overflow beyond dialog.

* refactor: replace Dialog with ResponsiveDialog in ThemeSaveDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in PodcastEmptyPlaceholder component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in ChatImagePreview component for improved UI consistency and responsiveness

* feat: add Tabs component based on BaseUI with customizable TabsList, TabsTrigger, TabsContent, and TabsIndicator for improved UI navigation

* refactor: replace Dialog with ResponsiveDialog in CssImportDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in AuthDialog component for improved UI consistency and responsiveness

* refactor: replace Dialog with ResponsiveDialog in MCPDialog component for improved UI consistency and responsiveness

- Replace `Tabs` component with new Base UI based `Tabs` component

* refactor: update Tabs and Select components in CodePanel for improved UI consistency

- Replace old Tabs component with new Base UI based Tabs component
- Add TabsIndicator for enhanced visual feedback
- Adjust SelectContent z-index for better layering

* refactor: replace Dialog with ResponsiveDialog in CodePanelDialog component for improved UI consistency and responsiveness

- fix: accessibility issue cased by missing title and description for dialog

* refactor: replace Dialog with ResponsiveDialog in ContrastChecker component for improved UI consistency and responsiveness

- Disable `Issues` button, when there's no issue
- Sticky Header for each section for better messaging for each section especially on mobile

* refactor: adjust layout and spacing in FigmaExportDialog for improved visual consistency

- Update margin and padding for better alignment of elements
- Remove unnecessary line breaks to streamline the code

* refactor: adjust layout and spacing in GetProDialog and AIChatDemo components for improved visual consistency

- Update positioning of elements in GetProDialog for better alignment
- Remove unnecessary inset from AIChatDemo for cleaner layout

* refactor: enhance layout in CodePanelDialog for improved responsiveness

- Adjust max-height for better display on smaller screens
- Maintain overall visual consistency with other dialog components

* refactor: enhance CodePanel layout with additional ScrollBar orientations

- Add horizontal and vertical ScrollBars for improved navigation within code panels
- Adjust padding in CodePanelDialog for better spacing and visual consistency

* refactor: clean up TabsIndicator component by removing commented code

- Remove unnecessary commented-out code for better readability
- Streamline TabsIndicator implementation for improved clarity

* refactor: update ResponsiveDialog components to use isDesktop for breakpoint detection

- Replace isMobile with isDesktop in ResponsiveDialog components for improved clarity
- Ensure consistent behavior across dialog and drawer implementations based on desktop view

* refactor: enhance ResponsiveDialogContent with additional props for customization (v1.4) update

- Introduce closeButtonClassName and dragHandleClassName props for better styling control
- Update context initialization to allow null values for improved type safety
- Refactor ResponsiveDialogContent to streamline rendering logic and improve readability

* refactor: reorganize imports and clean up AuthDialog component for improved readability

- Rearranged import statements for better structure
- Removed unnecessary props from ResponsiveDialogContent for cleaner layout
- Enhanced overall code clarity and maintainability

* refactor: reorganize imports in MCPDialog for improved clarity and consistency

- Rearranged import statements for better structure
- Cleaned up component imports to enhance readability
- Maintained overall code organization for future maintainability

* refactor: reorganize imports and enhance layout in various dialog components for improved readability

- Cleaned up and rearranged import statements for better structure
- Updated ResponsiveDialogContent and ResponsiveDialogHeader for consistent padding and spacing
- Enhanced overall layout and visual consistency across multiple dialog components

* refactor: add iOS detection to adjust repositioning of inputs in ResponsiveDialog
2025-08-30 18:28:31 +05:30

114 lines
4.8 KiB
TypeScript

"use client";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import { useGetProDialogStore } from "@/store/get-pro-dialog-store";
import { PRO_SUB_FEATURES } from "@/utils/subscription";
import { Calendar, Check } from "lucide-react";
import Link from "next/link";
import { NoiseEffect } from "./effects/noise-effect";
import { AIChatDemo } from "./examples/ai-chat-demo";
import {
ResponsiveDialog,
ResponsiveDialogContent,
ResponsiveDialogDescription,
ResponsiveDialogFooter,
ResponsiveDialogHeader,
ResponsiveDialogTitle,
} from "./ui/revola";
export function GetProDialogWrapper() {
const { isOpen, closeGetProDialog } = useGetProDialogStore();
return <GetProDialog isOpen={isOpen} onClose={closeGetProDialog} />;
}
interface GetProDialogProps {
isOpen: boolean;
onClose: () => void;
}
export function GetProDialog({ isOpen, onClose }: GetProDialogProps) {
return (
<ResponsiveDialog open={isOpen} onOpenChange={onClose}>
<ResponsiveDialogContent
closeButtonClassName="backdrop-blur-md bg-muted/15"
className="gap-0 overflow-hidden sm:max-w-lg md:w-[calc(100vw-2rem)] md:max-w-4xl"
>
<div className="flex flex-col md:flex-row">
{/* Left section: content */}
<section className="w-full space-y-8 border-r md:w-1/2">
<ResponsiveDialogHeader className="sm:p-6 sm:pb-0">
<ResponsiveDialogTitle>Get Pro</ResponsiveDialogTitle>
<ResponsiveDialogDescription>{`Unlock all of tweakcn's features`}</ResponsiveDialogDescription>
</ResponsiveDialogHeader>
<div className="space-y-6 px-6">
<ul className="space-y-3">
{PRO_SUB_FEATURES.map((feature, index) => (
<li key={index} className="flex items-start gap-3">
<div
className={cn(
"flex items-center justify-center rounded-full p-1",
feature.status === "done" ? "bg-primary/15" : "bg-muted"
)}
>
{feature.status === "done" ? (
<Check className="text-primary size-3 stroke-2" />
) : (
<Calendar className="text-muted-foreground size-3 stroke-2" />
)}
</div>
<span className={cn("text-sm", feature.status === "done" ? "" : "opacity-60")}>
{feature.description}
</span>
</li>
))}
</ul>
<p className="text-muted-foreground text-sm">{`Don't worry, full theme customization is still yours, for free. Upgrade to Pro to take it
to the next level, cancel anytime.`}</p>
</div>
<ResponsiveDialogFooter className="bg-muted/30 relative flex-col border-t p-6">
<Button asChild className="grow">
<Link href="/pricing" onNavigate={onClose}>
Upgrade to Pro
</Link>
</Button>
<Button variant="ghost" onClick={onClose}>
Maybe Later
</Button>
</ResponsiveDialogFooter>
</section>
{/* Right section: chat preview, only visible md+ */}
<section className="bg-muted/30 relative isolate hidden shrink-0 items-center justify-center overflow-hidden md:block md:w-1/2">
{/* ----Background effects---- */}
<div
className={cn(
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,rgba(from_var(--primary)_r_g_b_/_0.25)_1px,transparent_1px),linear-gradient(to_bottom,rgba(from_var(--primary)_r_g_b_/_0.25)_1px,transparent_1px)] bg-[size:2rem_2rem]",
"mask-r-from-80% mask-b-from-80% mask-radial-from-70% mask-radial-to-85%"
)}
/>
<NoiseEffect />
<div
className={cn(
"absolute inset-0 -z-10 bg-[linear-gradient(to_right,rgba(from_var(--muted-foreground)_r_g_b_/_0.025)_1px,transparent_1px),linear-gradient(to_bottom,rgba(from_var(--muted-foreground)_r_g_b_/_0.025)_1px,transparent_1px)] bg-[size:2rem_2rem]"
)}
/>
<div className="bg-foreground/10 absolute top-0 left-0 -z-10 size-35 -translate-x-1/2 -translate-y-1/2 animate-pulse rounded-full blur-3xl" />
<div className="bg-primary/15 absolute right-0 bottom-0 -z-10 size-70 translate-x-1/2 translate-y-1/2 rounded-full blur-3xl" />
{/* ----Background effects---- */}
<div className="absolute inset-4 top-4 z-10 flex items-center justify-center overflow-hidden rounded-lg border lg:inset-6">
<AIChatDemo />
</div>
</section>
</div>
</ResponsiveDialogContent>
</ResponsiveDialog>
);
}