AuthorizedAppRow.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { Trash } from 'lucide-react'
  2. import { Button, TableCell, TableRow } from 'ui'
  3. import { TimestampInfo } from 'ui-patterns'
  4. import CopyButton from '@/components/ui/CopyButton'
  5. import type { AuthorizedApp } from '@/data/oauth/authorized-apps-query'
  6. export interface AuthorizedAppRowProps {
  7. app: AuthorizedApp
  8. onSelectRevoke: () => void
  9. }
  10. export const AuthorizedAppRow = ({ app, onSelectRevoke }: AuthorizedAppRowProps) => {
  11. return (
  12. <TableRow>
  13. <TableCell className="w-[62px] min-w-[62px] max-w-[62px]">
  14. <div
  15. className="w-[30px] h-[30px] rounded-full bg-no-repeat bg-cover bg-center border border-control flex items-center justify-center text-xs"
  16. style={{ backgroundImage: app.icon ? `url('${app.icon}')` : 'none' }}
  17. >
  18. {!!app.icon ? '' : `${app.name[0]}`}
  19. </div>
  20. </TableCell>
  21. <TableCell>
  22. <p className="truncate" title={app.name}>
  23. {app.name}
  24. </p>
  25. </TableCell>
  26. <TableCell>{app.created_by}</TableCell>
  27. <TableCell>
  28. <div className="flex items-center gap-x-2">
  29. <p className="text-xs font-mono truncate" title={app.app_id}>
  30. {app.app_id}
  31. </p>
  32. <CopyButton iconOnly type="default" text={app.app_id} className="px-1" />
  33. </div>
  34. </TableCell>
  35. <TableCell>
  36. <TimestampInfo
  37. utcTimestamp={app.authorized_at ?? ''}
  38. labelFormat="DD/MM/YYYY, HH:mm:ss"
  39. className="text-sm"
  40. />
  41. </TableCell>
  42. <TableCell className="text-right">
  43. <Button type="default" icon={<Trash />} className="px-1" onClick={() => onSelectRevoke()} />
  44. </TableCell>
  45. </TableRow>
  46. )
  47. }