From 3d01928290750f324a6f67396e47e2ce5d874b72 Mon Sep 17 00:00:00 2001 From: Enes Date: Tue, 17 Dec 2024 15:10:55 +0300 Subject: [PATCH] chore: add alert if not connected to wallet features section (#3483) --- .../configuration-sections/section-design.tsx | 3 +- .../section-wallet-features.tsx | 30 ++++++++--- apps/builder/components/ui/alert.tsx | 54 +++++++++++++++++++ 3 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 apps/builder/components/ui/alert.tsx diff --git a/apps/builder/components/configuration-sections/section-design.tsx b/apps/builder/components/configuration-sections/section-design.tsx index 9192553209..b0ca33ae7b 100644 --- a/apps/builder/components/configuration-sections/section-design.tsx +++ b/apps/builder/components/configuration-sections/section-design.tsx @@ -163,10 +163,9 @@ export function SectionDesign() { Color picker icon +
+ + {!caipAddress ? ( + +
+ + + + Connect to a wallet to view feature customization +
+
+ ) : null} +
) } diff --git a/apps/builder/components/ui/alert.tsx b/apps/builder/components/ui/alert.tsx new file mode 100644 index 0000000000..64da49db2c --- /dev/null +++ b/apps/builder/components/ui/alert.tsx @@ -0,0 +1,54 @@ +import * as React from 'react' +import { cva, type VariantProps } from 'class-variance-authority' + +import { cn } from '@/lib/utils' + +const alertVariants = cva( + 'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7', + { + variants: { + variant: { + default: 'bg-fg-secondary text-text-primary', + destructive: + 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive' + } + }, + defaultVariants: { + variant: 'default' + } + } +) + +const Alert = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes & VariantProps +>(({ className, variant, ...props }, ref) => ( +
+)) +Alert.displayName = 'Alert' + +const AlertTitle = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +AlertTitle.displayName = 'AlertTitle' + +const AlertDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertDescription.displayName = 'AlertDescription' + +export { Alert, AlertTitle, AlertDescription }