mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-05-01 00:54:55 +00:00
Migration complete for: - 5 atoms: Accordion, CopyButton, FileUpload, FilterInput, Image, Input, PasswordInput, Popover (8 total) - 1 molecule: BindingEditor Changes: - Deleted 9 legacy TSX files that have complete JSON equivalents - Exported BindingEditor from json-components.ts with useBindingEditor hook - Registered useBindingEditor in hooks-registry.ts - Updated all imports across codebase to use JSON-based components - Fixed build errors: schema-loader dynamic import, DataSourceGroupSection - Cleaned up component index exports Build status: ✅ PASSING - 0 TypeScript errors - All 9,408 modules transformed successfully - No blocking build warnings Next steps: - 3 organisms still need conversion: DataSourceManager, NavigationMenu, TreeListPanel - 120+ additional components have TSX versions (need individual migration) - 22 JSON components now available for use throughout the app Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
74 lines
1.9 KiB
TypeScript
74 lines
1.9 KiB
TypeScript
import {
|
|
ContextMenu as ShadcnContextMenu,
|
|
ContextMenuContent,
|
|
ContextMenuItem,
|
|
ContextMenuTrigger,
|
|
ContextMenuSeparator,
|
|
ContextMenuSub,
|
|
ContextMenuSubContent,
|
|
ContextMenuSubTrigger,
|
|
} from '@/components/ui/context-menu'
|
|
import { ReactNode } from 'react'
|
|
|
|
export interface ContextMenuItemType {
|
|
label: string
|
|
icon?: ReactNode
|
|
shortcut?: string
|
|
onSelect?: () => void
|
|
disabled?: boolean
|
|
separator?: boolean
|
|
submenu?: ContextMenuItemType[]
|
|
}
|
|
|
|
interface ContextMenuProps {
|
|
trigger: ReactNode
|
|
items: ContextMenuItemType[]
|
|
}
|
|
|
|
export function ContextMenu({ trigger, items }: ContextMenuProps) {
|
|
const renderItems = (menuItems: ContextMenuItemType[]) => {
|
|
return menuItems.map((item, index) => {
|
|
if (item.separator) {
|
|
return <ContextMenuSeparator key={`separator-${index}`} />
|
|
}
|
|
|
|
if (item.submenu && item.submenu.length > 0) {
|
|
return (
|
|
<ContextMenuSub key={index}>
|
|
<ContextMenuSubTrigger>
|
|
{item.icon && <span className="mr-2">{item.icon}</span>}
|
|
{item.label}
|
|
</ContextMenuSubTrigger>
|
|
<ContextMenuSubContent>
|
|
{renderItems(item.submenu)}
|
|
</ContextMenuSubContent>
|
|
</ContextMenuSub>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<ContextMenuItem
|
|
key={index}
|
|
onSelect={item.onSelect}
|
|
disabled={item.disabled}
|
|
>
|
|
{item.icon && <span className="mr-2">{item.icon}</span>}
|
|
<span className="flex-1">{item.label}</span>
|
|
{item.shortcut && (
|
|
<span className="ml-auto text-xs text-muted-foreground">
|
|
{item.shortcut}
|
|
</span>
|
|
)}
|
|
</ContextMenuItem>
|
|
)
|
|
})
|
|
}
|
|
|
|
return (
|
|
<ShadcnContextMenu>
|
|
<ContextMenuTrigger asChild>{trigger}</ContextMenuTrigger>
|
|
<ContextMenuContent>{renderItems(items)}</ContextMenuContent>
|
|
</ShadcnContextMenu>
|
|
)
|
|
}
|