From 177cbe8911609ead0a6b04591f708a9f37a1740e Mon Sep 17 00:00:00 2001 From: hasanharman Date: Sun, 27 Sep 2026 19:17:17 +0300 Subject: [PATCH 01/35] chore: delete unreachable modules Remove files no route reaches through static imports: legacy *-form docs demos, unused templates (login, register, code-viewer), components/blocks, DropdownContext, the Radix toast stack, and unused ui primitives (context-menu, progress, sonner wrapper). Drop the three Radix packages only those files used. Co-Authored-By: Claude Opus 5.5 --- components/animated-tooltip.tsx | 97 --------- components/blocks/checkbox.tsx | 61 ------ components/blocks/schema.ts | 14 -- components/components/autocomplete-form.tsx | 62 ------ components/components/credit-card-form.tsx | 211 ------------------- components/components/location-form.tsx | 81 ------- components/components/signature-form.tsx | 67 ------ components/components/signature-pad-form.tsx | 95 --------- components/magicui/border-beam.tsx | 49 ----- components/magicui/dot-pattern.tsx | 51 ----- components/templates/code-viewer.tsx | 90 -------- components/templates/login.tsx | 133 ------------ components/templates/register.tsx | 189 ----------------- components/ui/context-menu.tsx | 204 ------------------ components/ui/json-schema-export.tsx | 97 --------- components/ui/progress.tsx | 28 --- components/ui/sonner.tsx | 31 --- components/ui/toast.tsx | 129 ------------ components/ui/toaster.tsx | 35 --- components/use-raised-shadow.ts | 28 --- constants/array-utils.ts | 17 -- context/DropdownContext.tsx | 50 ----- hooks/use-toast.ts | 191 ----------------- lib/validation-utils.ts | 29 --- package.json | 3 - pnpm-lock.yaml | 91 -------- screens/form-wrapper/index.tsx | 80 ------- 27 files changed, 2213 deletions(-) delete mode 100644 components/animated-tooltip.tsx delete mode 100644 components/blocks/checkbox.tsx delete mode 100644 components/blocks/schema.ts delete mode 100644 components/components/autocomplete-form.tsx delete mode 100644 components/components/credit-card-form.tsx delete mode 100644 components/components/location-form.tsx delete mode 100644 components/components/signature-form.tsx delete mode 100644 components/components/signature-pad-form.tsx delete mode 100644 components/magicui/border-beam.tsx delete mode 100644 components/magicui/dot-pattern.tsx delete mode 100644 components/templates/code-viewer.tsx delete mode 100644 components/templates/login.tsx delete mode 100644 components/templates/register.tsx delete mode 100644 components/ui/context-menu.tsx delete mode 100644 components/ui/json-schema-export.tsx delete mode 100644 components/ui/progress.tsx delete mode 100644 components/ui/sonner.tsx delete mode 100644 components/ui/toast.tsx delete mode 100644 components/ui/toaster.tsx delete mode 100644 components/use-raised-shadow.ts delete mode 100644 constants/array-utils.ts delete mode 100644 context/DropdownContext.tsx delete mode 100644 hooks/use-toast.ts delete mode 100644 lib/validation-utils.ts delete mode 100644 screens/form-wrapper/index.tsx diff --git a/components/animated-tooltip.tsx b/components/animated-tooltip.tsx deleted file mode 100644 index ad76c32..0000000 --- a/components/animated-tooltip.tsx +++ /dev/null @@ -1,97 +0,0 @@ -'use client' -import Image from 'next/image' -import React, { useState } from 'react' -import { - motion, - useTransform, - AnimatePresence, - useMotionValue, - useSpring, -} from 'framer-motion' - -export const AnimatedTooltip = ({ - items, - size = 40, - spacingClass = '-mr-4', -}: { - items: { - id: number - name: string - designation: string - image: string - }[] - size?: number - spacingClass?: string -}) => { - const [hoveredIndex, setHoveredIndex] = useState(null) - const springConfig = { stiffness: 100, damping: 5 } - const x = useMotionValue(0) // going to set this value on mouse move - // rotate the tooltip - const rotate = useSpring( - useTransform(x, [-100, 100], [-45, 45]), - springConfig, - ) - // translate the tooltip - const translateX = useSpring( - useTransform(x, [-100, 100], [-50, 50]), - springConfig, - ) - const handleMouseMove = (event: any) => { - const halfWidth = event.target.offsetWidth / 2 - x.set(event.nativeEvent.offsetX - halfWidth) // set the x value, which is then used in transform and rotate - } - - return ( - <> - {items.map((item, idx) => ( -
setHoveredIndex(item.id)} - onMouseLeave={() => setHoveredIndex(null)} - > - - {hoveredIndex === item.id && ( - -
-
-
- {item.name} -
-
{item.designation}
- - )} - - {item.name} -
- ))} - - ) -} diff --git a/components/blocks/checkbox.tsx b/components/blocks/checkbox.tsx deleted file mode 100644 index dcb8ced..0000000 --- a/components/blocks/checkbox.tsx +++ /dev/null @@ -1,61 +0,0 @@ -// components/editor/blocks/checkbox.tsx -import { defaultProps } from '@blocknote/core' -import { createReactBlockSpec } from '@blocknote/react' -import * as CheckboxPrimitive from '@radix-ui/react-checkbox' -import { CheckIcon } from '@radix-ui/react-icons' -import { cn } from '@/lib/utils' - -export const checkboxTypes = [ - { - title: 'Default', - value: 'default', - }, - { - title: 'Checked', - value: 'checked', - }, -] as const - -export const Checkbox = createReactBlockSpec( - { - type: 'checkbox', - propSchema: { - textAlignment: defaultProps.textAlignment, - textColor: defaultProps.textColor, - checked: { - default: false, - }, - label: { - default: '', - }, - }, - content: 'inline', - }, - { - render: (props) => { - return ( -
- { - const isChecked = checked === true - props.editor.updateBlock(props.block, { - props: { checked: isChecked }, - }) - }} - className={cn( - 'peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground', - )} - > - - - - -
-
- ) - }, - }, -) diff --git a/components/blocks/schema.ts b/components/blocks/schema.ts deleted file mode 100644 index 314907e..0000000 --- a/components/blocks/schema.ts +++ /dev/null @@ -1,14 +0,0 @@ -// components/editor/schema.ts -import { z } from 'zod' - -export const editorFormSchema = z.object({ - title: z.string().min(2, { - message: 'Title must be at least 2 characters.', - }), - content: z.array(z.any()).min(1, { - message: 'Content cannot be empty.', - }), - description: z.string().optional(), -}) - -export type EditorFormValues = z.infer diff --git a/components/components/autocomplete-form.tsx b/components/components/autocomplete-form.tsx deleted file mode 100644 index 65ebae4..0000000 --- a/components/components/autocomplete-form.tsx +++ /dev/null @@ -1,62 +0,0 @@ -'use client' - -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { z } from 'zod' -import { toast } from 'sonner' - -import { Button } from '@/components/ui/button' -import { - Form, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import Autocomplete from '@/components/ui/autocomplete' - -const FormSchema = z.object({ - framework: z.string().min(1, { message: 'Please select a framework' }), -}) - -type AutocompleteFormData = z.infer - -export function AutocompleteForm() { - const form = useForm({ - resolver: zodResolver(FormSchema), - }) - - const onSubmit = (data: AutocompleteFormData) => { - console.log('HEY', data) - toast( -
-        {JSON.stringify(data, null, 2)}
-      
, - ) - } - - return ( -
- - ( - -
- What is your favorite framework? -
- - - Please type and select your favorite framework? - - -
- )} - /> - - - - ) -} diff --git a/components/components/credit-card-form.tsx b/components/components/credit-card-form.tsx deleted file mode 100644 index 440bce5..0000000 --- a/components/components/credit-card-form.tsx +++ /dev/null @@ -1,211 +0,0 @@ -'use client' - -import React, { useState } from 'react' -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { z } from 'zod' -import { toast } from 'sonner' - -import { Button } from '@/components/ui/button' -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import { CreditCard, type CreditCardValue } from '@/components/ui/credit-card' - -// Enhanced validation schema -const FormSchema = z - .object({ - cardholderName: z - .string() - .min(2, 'Cardholder name must be at least 2 characters') - .max(50, 'Cardholder name must be less than 50 characters'), - - cardNumber: z - .string() - .min(1, 'Card number is required') - .refine((value) => { - const cleanNumber = value.replace(/\s/g, '') - return /^\d{13,19}$/.test(cleanNumber) - }, 'Invalid card number format'), - - expiryMonth: z - .string() - .min(1, 'Expiry month is required') - .refine((value) => { - const month = parseInt(value) - return month >= 1 && month <= 12 - }, 'Invalid month'), - - expiryYear: z - .string() - .min(1, 'Expiry year is required') - .refine((value) => { - const year = parseInt(value) - const currentYear = new Date().getFullYear() - return year >= currentYear && year <= currentYear + 20 - }, 'Invalid year'), - - cvv: z - .string() - .min(3, 'CVV must be at least 3 digits') - .max(4, 'CVV must be at most 4 digits') - .refine((value) => /^\d+$/.test(value), 'CVV must contain only digits'), - }) - - // Add expiry date validation - .refine( - (data) => { - if (!data.expiryMonth || !data.expiryYear) return true // Let individual field validation handle this - - const currentDate = new Date() - const currentYear = currentDate.getFullYear() - const currentMonth = currentDate.getMonth() + 1 - const expiryYear = parseInt(data.expiryYear) - const expiryMonth = parseInt(data.expiryMonth) - - return ( - expiryYear > currentYear || - (expiryYear === currentYear && expiryMonth >= currentMonth) - ) - }, - { - message: 'Card has expired', - path: ['expiryYear'], // Show error on year field - }, - ) - -type CreditCardFormData = z.infer - -export function CreditCardForm() { - const [creditCard, setCreditCard] = useState({ - cardholderName: '', - cardNumber: '', - expiryMonth: '', - expiryYear: '', - cvv: '', - }) - - const [isCardValid, setIsCardValid] = useState(false) - - const form = useForm({ - resolver: zodResolver(FormSchema), - defaultValues: { - cardholderName: '', - cardNumber: '', - expiryMonth: '', - expiryYear: '', - cvv: '', - }, - mode: 'onChange', // Enable real-time validation - }) - - const handleCreditCardChange = (value: CreditCardValue) => { - setCreditCard(value) - - // Update form values - form.setValue('cardholderName', value.cardholderName, { - shouldValidate: true, - }) - form.setValue('cardNumber', value.cardNumber, { shouldValidate: true }) - form.setValue('expiryMonth', value.expiryMonth, { shouldValidate: true }) - form.setValue('expiryYear', value.expiryYear, { shouldValidate: true }) - form.setValue('cvv', value.cvv, { shouldValidate: true }) - } - - const handleValidationChange = (isValid: boolean, errors: any) => { - setIsCardValid(isValid) - } - - const onSubmit = (data: CreditCardFormData) => { - console.log('Form submitted:', data) - toast.success( -
-

Payment Information Submitted

-
-          {JSON.stringify(data, null, 2)}
-        
-
, - ) - } - - return ( -
-
-

Payment Information

-

Enter your credit card details

-
- -
- - ( - - Credit Card Information - - - - - All fields are required. Your information is secure and - encrypted. - - - - )} - /> - - {/* Hidden fields to capture validation errors */} -
- } - /> - } - /> - } - /> - } - /> -
- -
- -
- - -
- ) -} diff --git a/components/components/location-form.tsx b/components/components/location-form.tsx deleted file mode 100644 index a307671..0000000 --- a/components/components/location-form.tsx +++ /dev/null @@ -1,81 +0,0 @@ -'use client' - -import { useState } from 'react' -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { z } from 'zod' -import { toast } from 'sonner' - -import { Button } from '@/components/ui/button' -import { - Form, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import LocationSelector from '@/components/ui/location-input' - -const FormSchema = z.object({ - location: z.tuple([ - z.string().min(1, { message: 'Country is required' }), - z.string().optional(), // State name, optional - ]), -}) - -export function LocationForm() { - const [countryName, setCountryName] = useState('') - const [stateName, setStateName] = useState('') - - const form = useForm>({ - resolver: zodResolver(FormSchema), - }) - - function onSubmit(data: z.infer) { - toast( -
-        {JSON.stringify(data, null, 2)}
-      
, - ) - } - - return ( -
- - ( - -
- Country Selector -
- { - setCountryName(country?.name || '') - form.setValue(field.name, [ - country?.name || '', - stateName || '', - ]) - }} - onStateChange={(state) => { - setStateName(state?.name || '') - form.setValue(field.name, [ - countryName || '', - state?.name || '', - ]) - }} - /> - - Please select state after selecting your country - - -
- )} - /> - - - - ) -} diff --git a/components/components/signature-form.tsx b/components/components/signature-form.tsx deleted file mode 100644 index 0e599f9..0000000 --- a/components/components/signature-form.tsx +++ /dev/null @@ -1,67 +0,0 @@ -'use client' - -import { useRef } from 'react' -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { z } from 'zod' -import { toast } from 'sonner' - -import { Button } from '@/components/ui/button' -import { - Form, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import SignatureInput from '@/components/ui/signature-input' - -const FormSchema = z.object({ - signature: z.string().min(1, { message: 'Please sign the form' }), -}) - -type SignatureFormData = z.infer - -export function SignatureForm() { - const canvasRef = useRef(null) - const form = useForm({ - resolver: zodResolver(FormSchema), - }) - - const onSubmit = (data: SignatureFormData) => { - // console.log('Signature Data URL:', data.signature) - toast( -
-        {JSON.stringify(data, null, 2)}
-      
, - ) - } - - return ( -
- - ( - -
- Sign here -
- - - Please provide your signature above - - -
- )} - /> - - - - ) -} diff --git a/components/components/signature-pad-form.tsx b/components/components/signature-pad-form.tsx deleted file mode 100644 index 3cf9f3f..0000000 --- a/components/components/signature-pad-form.tsx +++ /dev/null @@ -1,95 +0,0 @@ -'use client' - -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { z } from 'zod' -import { toast } from 'sonner' - -import { Button } from '@/components/ui/button' -import { - Form, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import SignaturePad from '@/components/ui/signature-pad' - -const FormSchema = z.object({ - signature: z - .string() - .min(1, { message: 'Please sign the form' }) - .nullable() - .refine((val) => val !== null && val.length > 0, { - message: 'Please sign the form', - }), -}) - -type SignaturePadFormData = z.infer - -export function SignaturePadForm() { - const form = useForm({ - resolver: zodResolver(FormSchema), - defaultValues: { - signature: null, - }, - }) - - const onSubmit = (data: SignaturePadFormData) => { - // The signature is a base64 data URL that can be: - // 1. Stored directly in a database as a string - // 2. Converted to a Blob/File for upload to cloud storage - // 3. Sent to an API endpoint - - // Example: Convert to Blob for file upload - // const blob = await fetch(data.signature!).then(r => r.blob()) - // const file = new File([blob], 'signature.png', { type: 'image/png' }) - - toast( -
-

Signature captured!

-

- Data URL length: {data.signature?.length} characters -

- {data.signature && ( - // eslint-disable-next-line @next/next/no-img-element - Captured signature - )} -
, - ) - } - - return ( -
- - ( - - Your Signature - - - Click the pen button to open the signature pad. Draw your - signature, then hold the confirm button to save. - - - - )} - /> - - - - ) -} diff --git a/components/magicui/border-beam.tsx b/components/magicui/border-beam.tsx deleted file mode 100644 index a720307..0000000 --- a/components/magicui/border-beam.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { cn } from "@/lib/utils"; - -interface BorderBeamProps { - className?: string; - size?: number; - duration?: number; - borderWidth?: number; - anchor?: number; - colorFrom?: string; - colorTo?: string; - delay?: number; -} - -export const BorderBeam = ({ - className, - size = 200, - duration = 15, - anchor = 90, - borderWidth = 1.5, - colorFrom = "#ffaa40", - colorTo = "#9c40ff", - delay = 0, -}: BorderBeamProps) => { - return ( -
- ); -}; diff --git a/components/magicui/dot-pattern.tsx b/components/magicui/dot-pattern.tsx deleted file mode 100644 index f950287..0000000 --- a/components/magicui/dot-pattern.tsx +++ /dev/null @@ -1,51 +0,0 @@ -interface DotPatternProps { - width?: any; - height?: any; - x?: any; - y?: any; - cx?: any; - cy?: any; - cr?: any; - className?: string; - [key: string]: any; -} -export function DotPattern({ - width = 16, - height = 16, - x = 0, - y = 0, - cx = 1, - cy = 1, - cr = 1, - className, - ...props -}: DotPatternProps) { - const id = "pattern-circle"; - - return ( - - ); -} - -export default DotPattern; diff --git a/components/templates/code-viewer.tsx b/components/templates/code-viewer.tsx deleted file mode 100644 index bdd908b..0000000 --- a/components/templates/code-viewer.tsx +++ /dev/null @@ -1,90 +0,0 @@ -'use client' - -import { useEffect, useState } from 'react' -import { Highlight, themes } from 'prism-react-renderer' -import { toast } from 'sonner' -import { Files } from 'lucide-react' - -import { Button } from '@/components/ui/button' - -interface CodeViewerProps { - filename: string -} - -export function CodeViewer({ filename }: CodeViewerProps) { - const [code, setCode] = useState('') - const [error, setError] = useState('') - const [isLoading, setIsLoading] = useState(true) - - useEffect(() => { - async function fetchCode() { - try { - setIsLoading(true) - const response = await fetch(`/api/file/${filename}`) - const data = await response.json() - - if (response.ok) { - setCode(data.content) - } else { - setError(data.error || 'Failed to load code') - } - } catch (err) { - setError('Failed to fetch code') - } finally { - setIsLoading(false) - } - } - - if (filename) { - fetchCode() - } - }, [filename]) - - if (error) { - return ( -
-

Error Loading Code

-

{error}

-
- ) - } - - if (isLoading) { - return ( -
Loading code for {filename}...
- ) - } - - return ( -
- - - {({ className, style, tokens, getLineProps, getTokenProps }: any) => ( -
-            {tokens.map((line: any, i: number) => (
-              
- {line.map((token: any, key: any) => ( - - ))} -
- ))} -
- )} -
-
- ) -} diff --git a/components/templates/login.tsx b/components/templates/login.tsx deleted file mode 100644 index 7a8162a..0000000 --- a/components/templates/login.tsx +++ /dev/null @@ -1,133 +0,0 @@ -'use client' - -import Link from 'next/link' -import { z } from 'zod' -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { toast } from 'sonner' - -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import { Button } from '@/components/ui/button' -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/components/ui/card' -import { Input } from '@/components/ui/input' -import { PasswordInput } from '@/components/ui/password-input' - -import { loginFormSchema } from '@/lib/validation-schemas' - -const formSchema = loginFormSchema - -export default function LoginPreview() { - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - email: '', - password: '', - }, - }) - - async function onSubmit(values: z.infer) { - try { - // Assuming an async login function - console.log(values) - toast( -
-          {JSON.stringify(values, null, 2)}
-        
, - ) - } catch (error) { - console.error('Form submission error', error) - toast.error('Failed to submit the form. Please try again.') - } - } - - return ( -
- - - Login - - Enter your email and password to login to your account. - - - -
- -
- ( - - Email - - - - - - )} - /> - ( - -
- Password - - Forgot your password? - -
- - - - -
- )} - /> - - -
-
- -
- Don't have an account?{' '} - - Sign up - -
-
-
-
- ) -} diff --git a/components/templates/register.tsx b/components/templates/register.tsx deleted file mode 100644 index eaac39b..0000000 --- a/components/templates/register.tsx +++ /dev/null @@ -1,189 +0,0 @@ -'use client' - -import Link from 'next/link' -import { z } from 'zod' -import { zodResolver } from '@hookform/resolvers/zod' -import { useForm } from 'react-hook-form' -import { toast } from 'sonner' - -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import { Button } from '@/components/ui/button' -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/components/ui/card' -import { Input } from '@/components/ui/input' -import { PasswordInput } from '@/components/ui/password-input' -import { PhoneInput } from '@/components/ui/phone-input' - -import { registerFormSchema } from '@/lib/validation-schemas' - -const formSchema = registerFormSchema - -export default function RegisterPreview() { - const form = useForm>({ - resolver: zodResolver(formSchema), - defaultValues: { - name: '', - email: '', - phone: '', - password: '', - confirmPassword: '', - }, - }) - - async function onSubmit(values: z.infer) { - try { - // Assuming an async registration function - console.log(values) - toast( -
-          {JSON.stringify(values, null, 2)}
-        
, - ) - } catch (error) { - console.error('Form submission error', error) - toast.error('Failed to submit the form. Please try again.') - } - } - - return ( -
- - - Register - - Create a new account by filling out the form below. - - - -
- -
- {/* Name Field */} - ( - - Full Name - - - - - - )} - /> - - {/* Email Field */} - ( - - Email - - - - - - )} - /> - - {/* Phone Field */} - ( - - Phone Number - - - {/* */} - - - - )} - /> - - {/* Password Field */} - ( - - Password - - - - - - )} - /> - - {/* Confirm Password Field */} - ( - - - Confirm Password - - - - - - - )} - /> - - -
-
- -
- Already have an account?{' '} - - Login - -
-
-
-
- ) -} diff --git a/components/ui/context-menu.tsx b/components/ui/context-menu.tsx deleted file mode 100644 index 654810a..0000000 --- a/components/ui/context-menu.tsx +++ /dev/null @@ -1,204 +0,0 @@ -"use client" - -import * as React from "react" -import * as ContextMenuPrimitive from "@radix-ui/react-context-menu" -import { - CheckIcon, - ChevronRightIcon, - DotFilledIcon, -} from "@radix-ui/react-icons" - -import { cn } from "@/lib/utils" - -const ContextMenu = ContextMenuPrimitive.Root - -const ContextMenuTrigger = ContextMenuPrimitive.Trigger - -const ContextMenuGroup = ContextMenuPrimitive.Group - -const ContextMenuPortal = ContextMenuPrimitive.Portal - -const ContextMenuSub = ContextMenuPrimitive.Sub - -const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup - -const ContextMenuSubTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, children, ...props }, ref) => ( - - {children} - - -)) -ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName - -const ContextMenuSubContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName - -const ContextMenuContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - -)) -ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName - -const ContextMenuItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, ...props }, ref) => ( - -)) -ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName - -const ContextMenuCheckboxItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, checked, ...props }, ref) => ( - - - - - - - {children} - -)) -ContextMenuCheckboxItem.displayName = - ContextMenuPrimitive.CheckboxItem.displayName - -const ContextMenuRadioItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - - - - {children} - -)) -ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName - -const ContextMenuLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & { - inset?: boolean - } ->(({ className, inset, ...props }, ref) => ( - -)) -ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName - -const ContextMenuSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)) -ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName - -const ContextMenuShortcut = ({ - className, - ...props -}: React.HTMLAttributes) => { - return ( - - ) -} -ContextMenuShortcut.displayName = "ContextMenuShortcut" - -export { - ContextMenu, - ContextMenuTrigger, - ContextMenuContent, - ContextMenuItem, - ContextMenuCheckboxItem, - ContextMenuRadioItem, - ContextMenuLabel, - ContextMenuSeparator, - ContextMenuShortcut, - ContextMenuGroup, - ContextMenuPortal, - ContextMenuSub, - ContextMenuSubContent, - ContextMenuSubTrigger, - ContextMenuRadioGroup, -} diff --git a/components/ui/json-schema-export.tsx b/components/ui/json-schema-export.tsx deleted file mode 100644 index 20bb6a7..0000000 --- a/components/ui/json-schema-export.tsx +++ /dev/null @@ -1,97 +0,0 @@ -'use client' - -import React, { useState } from 'react' -import { Button } from '@/components/ui/button' -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' -import { Textarea } from '@/components/ui/textarea' -import { Copy, Download } from 'lucide-react' -import { toast } from 'sonner' -import { generateFormJsonSchema, downloadJsonSchema } from '@/lib/json-schema-generator' - -interface JsonSchemaExportProps { - formFields: any[] - title?: string - description?: string -} - -export function JsonSchemaExport({ formFields, title = 'Form Schema', description = 'Generated JSON Schema' }: JsonSchemaExportProps) { - const [jsonSchema, setJsonSchema] = useState('') - const [isGenerated, setIsGenerated] = useState(false) - - const generateSchema = () => { - try { - const schema = generateFormJsonSchema(formFields, { title, description }) - const schemaString = JSON.stringify(schema, null, 2) - setJsonSchema(schemaString) - setIsGenerated(true) - toast.success('JSON Schema generated successfully!') - } catch (error) { - toast.error('Failed to generate JSON Schema') - console.error('Schema generation error:', error) - } - } - - const copyToClipboard = async () => { - try { - await navigator.clipboard.writeText(jsonSchema) - toast.success('JSON Schema copied to clipboard!') - } catch (error) { - toast.error('Failed to copy to clipboard') - } - } - - const downloadSchema = () => { - try { - const schema = JSON.parse(jsonSchema) - downloadJsonSchema(schema, `${title.toLowerCase().replace(/\s+/g, '-')}-schema.json`) - toast.success('JSON Schema downloaded!') - } catch (error) { - toast.error('Failed to download schema') - } - } - - return ( - - - JSON Schema Export - - Generate and export a JSON Schema representation of your form - - - -
- - {isGenerated && ( - <> - - - - )} -
- - {isGenerated && ( -