Files
Gildas Garcia 243e079a2c chore: remove _Shadcn_ suffix from Command components (#46153)
## Problem

The `_Shadcn_` suffix isn't needed anymore on `Command` components

## Solution

- Remove the `_Shadcn_` suffix
- Simplify UI package exports
- Apply prettier

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Simplified command component imports and exports across the UI library
by removing internal naming aliases and adopting direct component
references. Updated the public UI package barrel export to use wildcard
re-exports for cleaner API surface.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46153?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-20 15:45:32 +02:00

59 lines
1.5 KiB
TypeScript

import { Check } from 'lucide-react'
import { ReactNode } from 'react'
import { cn, CommandItem } from 'ui'
import type { OrgProject } from '@/data/projects/org-projects-infinite-query'
export interface ProjectCommandItemProps {
project: OrgProject
selectedRef: string | undefined
onSelect?: (project: OrgProject) => void
onClose: () => void
renderRow?: (project: OrgProject) => ReactNode
checkPosition?: 'right' | 'left'
isOptionDisabled?: (project: OrgProject) => boolean
}
export function ProjectCommandItem({
project,
selectedRef,
onSelect,
onClose,
renderRow,
checkPosition = 'right',
isOptionDisabled,
}: ProjectCommandItemProps) {
const handleSelect = () => {
onSelect?.(project)
onClose()
}
const disabled = isOptionDisabled?.(project) ?? false
return (
<CommandItem
key={project.ref}
value={`${project.name.replaceAll('"', '')}-${project.ref}`}
className="cursor-pointer w-full"
onSelect={handleSelect}
disabled={disabled}
>
{renderRow ? (
renderRow(project)
) : (
<div
className={cn(
'w-full flex items-center',
checkPosition === 'left' ? 'gap-x-2' : 'justify-between',
project.ref !== selectedRef && checkPosition === 'left' && 'ml-6'
)}
>
{checkPosition === 'left' && project.ref === selectedRef && <Check size={16} />}
{project.name}
{checkPosition === 'right' && project.ref === selectedRef && <Check size={16} />}
</div>
)}
</CommandItem>
)
}