NewOAuthAppBanner.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import type { OAuthClient } from '@supabase/supabase-js'
  2. import { X } from 'lucide-react'
  3. import { toast } from 'sonner'
  4. import { Button } from 'ui'
  5. import { Admonition } from 'ui-patterns/admonition'
  6. import { Input } from 'ui-patterns/DataInputs/Input'
  7. interface NewOAuthAppBannerProps {
  8. oauthApp: OAuthClient
  9. onClose: () => void
  10. }
  11. export const NewOAuthAppBanner = ({ oauthApp, onClose }: NewOAuthAppBannerProps) => {
  12. return (
  13. <Admonition
  14. type="default"
  15. className="relative mb-6"
  16. title={`Successfully generated credentials for your ${oauthApp.client_name} OAuth app!`}
  17. description={
  18. <div className="w-full space-y-2">
  19. <p className="text-sm">
  20. Do copy this client id and client secret and store it in a secure place - you will not
  21. be able to see it again.
  22. </p>
  23. <div className="">
  24. <Input
  25. copy
  26. readOnly
  27. size="small"
  28. className="input-mono"
  29. value={oauthApp?.client_id}
  30. onChange={() => {}}
  31. onCopy={() => toast.success('Client Id copied to clipboard')}
  32. />
  33. </div>
  34. <div className="">
  35. <Input
  36. copy
  37. readOnly
  38. size="small"
  39. className=" input-mono"
  40. value={oauthApp?.client_secret}
  41. onChange={() => {}}
  42. onCopy={() => toast.success('Client secret copied to clipboard')}
  43. />
  44. </div>
  45. </div>
  46. }
  47. >
  48. <Button
  49. type="text"
  50. icon={<X />}
  51. className="w-7 h-7 absolute top-0 right-0"
  52. onClick={onClose}
  53. />
  54. </Admonition>
  55. )
  56. }