mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
This PR migrates the whole monorepo to use Tailwind v4: - Removed `@tailwindcss/container-queries` plugin since it's included by default in v4, - Bump all instances of Tailwind to v4. Made minimal changes to the shared config to remove non-supported features (`alpha` mentions), - Migrate all apps to be compatible with v4 configs, - Fix the `typography.css` import in 3 apps, - Add missing rules which were included by default in v3, - Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot of classes - Rename all misnamed classes according to https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all apps. --------- Co-authored-by: Jordi Enric <jordi.err@gmail.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { ChevronDown, ChevronRight } from 'lucide-react'
|
|
import { useState } from 'react'
|
|
import {
|
|
Button,
|
|
Collapsible_Shadcn_ as Collapsible,
|
|
CollapsibleContent_Shadcn_ as CollapsibleContent,
|
|
CollapsibleTrigger_Shadcn_ as 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>
|
|
)
|
|
}
|