Files
Gildas Garcia 0713a1efc1 chore: remove shadcn suffix for Input, Textarea, Alert and Collapsible (#45867)
## Problem

Now that we migrated old components to their new shadcn alternatives, we
don't need the `_Shadcn_` suffix anymore.

## Solution

Remove it

<img width="659" height="609" alt="image"
src="https://github.com/user-attachments/assets/2d7271a9-066a-4dcc-92fe-729b106d2c2f"
/>
2026-05-15 14:55:37 +02:00

52 lines
1.8 KiB
TypeScript

import { ChevronDown, ChevronRight } from 'lucide-react'
import { useState } from 'react'
import { Button, Collapsible, CollapsibleContent, CollapsibleTrigger } from 'ui'
import { PermissionsList } from './PermissionList'
const PERMISSIONS_COLLAPSE_THRESHOLD = 5
interface TokenPermissionsSectionProps {
groupedPermissions: Record<string, string[]>
totalCount: number
}
export const TokenPermissionsSection = ({
groupedPermissions,
totalCount,
}: TokenPermissionsSectionProps) => {
const [permissionsOpen, setPermissionsOpen] = useState(false)
const shouldCollapse = totalCount > PERMISSIONS_COLLAPSE_THRESHOLD
if (totalCount === 0) return null
return (
<div className="pt-4 border-t border-default">
{shouldCollapse ? (
<Collapsible open={permissionsOpen} onOpenChange={setPermissionsOpen}>
<CollapsibleTrigger asChild>
<Button
type="text"
size="tiny"
className="w-full justify-start px-0.5 h-auto text-sm font-medium text-foreground-light hover:text-foreground"
>
<div className="flex items-center gap-1.5">
{permissionsOpen ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
<span>Permissions assigned to this token ({totalCount})</span>
</div>
</Button>
</CollapsibleTrigger>
<CollapsibleContent className="pt-3 transition-all data-closed:animate-collapsible-up data-open:animate-collapsible-down">
<PermissionsList groupedPermissions={groupedPermissions} />
</CollapsibleContent>
</Collapsible>
) : (
<>
<h3 className="text-sm font-medium mb-3">Permissions assigned to this token:</h3>
<PermissionsList groupedPermissions={groupedPermissions} />
</>
)}
</div>
)
}