| 1 | import { |
| 2 | BookLock, |
| 3 | Building2, |
| 4 | Globe, |
| 5 | KeyRound, |
| 6 | Trash2, |
| 7 | UserRound, |
| 8 | } from "lucide-react"; |
| 9 | |
| 10 | import { describeScope, type |
| 11 | import { cn } |
| 12 | |
| 13 | const GROUP_ICONS: Record |
| 14 | repo: BookLock, |
| 15 | org: Building2, |
| 16 | user: UserRound, |
| 17 | key: KeyRound, |
| 18 | delete: Trash2, |
| 19 | other: Globe, |
| 20 | }; |
| 21 | |
| 22 | /** What OAuth scopes let an app do, in words, each with the scope's name beneath. No scope reads as public access only. */ |
| 23 | export function ScopeList({ |
| 24 | scopes, |
| 25 | className, |
| 26 | }: { |
| 27 | scopes: string |
| 28 | className?: string |
| 29 | }) { |
| 30 | if (scopes.length |
| 31 | return ( |
| 32 | <p className="text-sm text-muted-foreground |
| 33 | It can only see information that is already public. |
| 34 | </p> |
| 35 | ); |
| 36 | |
| 37 | return ( |
| 38 | <ul className={cn |
| 39 | {scopes.map(( |
| 40 | const { title, |
| 41 | const Icon = |
| 42 | return ( |
| 43 | <li key={scope |
| 44 | <span className="flex size-8 shrink-0 items-center justify-center rounded-md bg-muted |
| 45 | <Icon aria-hidden className |
| 46 | </span> |
| 47 | <div className="flex min-w-0 flex-col |
| 48 | <span className="text-sm font-medium |
| 49 | <span className="text-sm text-muted-foreground |
| 50 | <code className="mt-0.5 font-mono text-xs text-muted-foreground/80 |
| 51 | {scope} |
| 52 | </code> |
| 53 | </div> |
| 54 | </li> |
| 55 | ); |
| 56 | })} |
| 57 | </ul> |
| 58 | ); |
| 59 | } |