ApiAuthorization.Approved.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import dayjs from 'dayjs'
  2. import type { ReactNode } from 'react'
  3. import { Alert, AlertDescription, AlertTitle, Card, CardContent, CardHeader, CheckIcon } from 'ui'
  4. import { AuthorizeRequesterDetails } from '@/components/interfaces/Organization/OAuthApps/AuthorizeRequesterDetails'
  5. import type { ApiAuthorizationResponse } from '@/data/api-authorization/api-authorization-query'
  6. import type { Organization } from '@/types'
  7. export interface ApiAuthorizationApprovedScreenProps {
  8. requester: ApiAuthorizationResponse
  9. organization: Organization | undefined
  10. }
  11. export function ApiAuthorizationApprovedScreen({
  12. requester,
  13. organization,
  14. }: ApiAuthorizationApprovedScreenProps): ReactNode {
  15. return (
  16. <Card>
  17. <CardHeader>Authorize API access for {requester.name}</CardHeader>
  18. <CardContent className="p-0">
  19. <Alert className="border-0 rounded-t-none">
  20. <CheckIcon />
  21. <AlertTitle>This authorization request has been approved</AlertTitle>
  22. <AlertDescription>
  23. <p>
  24. {requester.name} has been approved access to the organization "
  25. {organization?.name ?? 'Unknown'}" and all of its projects for the following scopes:
  26. </p>
  27. <AuthorizeRequesterDetails
  28. showOnlyScopes
  29. icon={requester.icon}
  30. name={requester.name}
  31. domain={requester.domain}
  32. scopes={requester.scopes}
  33. />
  34. <p className="mt-2">
  35. Approved on: {dayjs(requester.approved_at).format('DD MMM YYYY HH:mm:ss (ZZ)')}
  36. </p>
  37. </AlertDescription>
  38. </Alert>
  39. </CardContent>
  40. </Card>
  41. )
  42. }