NewProjectPanel.tsx 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. import { useParams } from 'common'
  2. import { Auth, EdgeFunctions, Realtime, SqlEditor, Storage, TableEditor } from 'icons'
  3. import { ExternalLink, Settings } from 'lucide-react'
  4. import Link from 'next/link'
  5. import { Button } from 'ui'
  6. import { APIKeys } from './APIKeys'
  7. import { GetStartedHero } from './GetStartedHero'
  8. import { DocsButton } from '@/components/ui/DocsButton'
  9. import { InlineLink } from '@/components/ui/InlineLink'
  10. import Panel from '@/components/ui/Panel'
  11. import { EditorIndexPageLink } from '@/data/prefetchers/project.$ref.editor'
  12. import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
  13. import { DOCS_URL } from '@/lib/constants'
  14. export const NewProjectPanel = () => {
  15. const { ref } = useParams()
  16. const {
  17. projectAuthAll: authEnabled,
  18. projectEdgeFunctionAll: edgeFunctionsEnabled,
  19. projectStorageAll: storageEnabled,
  20. } = useIsFeatureEnabled(['project_auth:all', 'project_edge_function:all', 'project_storage:all'])
  21. return (
  22. <div className="grid grid-cols-12 gap-4 lg:gap-20">
  23. <div className="col-span-12">
  24. <div className="flex flex-col space-y-12 md:space-y-20">
  25. <div className="flex h-full flex-col justify-between">
  26. <div className="space-y-2">
  27. <h2>Welcome to your new project</h2>
  28. <p className="text-base text-foreground-light">
  29. Your project has been deployed on its own instance, with its own API all set up and
  30. ready to use.
  31. </p>
  32. </div>
  33. </div>
  34. <div className="grid grid-cols-12 gap-4">
  35. <div className="col-span-12 flex flex-col justify-center space-y-8 lg:col-span-7">
  36. <div className="space-y-2">
  37. <h2>Build out your database</h2>
  38. <p className="text-base text-foreground-light">
  39. Start building your app by creating tables and inserting data. Our Table Editor
  40. makes Postgres as easy to use as a spreadsheet, but there's also our SQL Editor if
  41. you need something more.
  42. </p>
  43. </div>
  44. <div className="flex flex-wrap items-center gap-2">
  45. <Button asChild type="default" icon={<TableEditor strokeWidth={1.5} />}>
  46. <EditorIndexPageLink projectRef={ref}>Table Editor</EditorIndexPageLink>
  47. </Button>
  48. <Button asChild type="default" icon={<SqlEditor strokeWidth={1.5} />}>
  49. <Link href={`/project/${ref}/sql/new`}>SQL Editor</Link>
  50. </Button>
  51. <Button asChild type="default" icon={<ExternalLink />}>
  52. <Link href={`${DOCS_URL}/guides/database`} target="_blank" rel="noreferrer">
  53. About Database
  54. </Link>
  55. </Button>
  56. </div>
  57. </div>
  58. <div className="col-span-12 lg:col-span-5">
  59. <GetStartedHero />
  60. </div>
  61. </div>
  62. {authEnabled && edgeFunctionsEnabled && storageEnabled && (
  63. <div className="flex h-full flex-col justify-between space-y-6">
  64. <div className="max-w-2xl space-y-2">
  65. <h2>Explore our other products</h2>
  66. <p className="text-base text-foreground-light">
  67. Briven provides all the backend features you need to build a product. You can
  68. use it completely, or just the features you need.
  69. </p>
  70. </div>
  71. <div className="grid grid-cols-1 md:grid-cols-2 md:gap-4 md:gap-y-0 xl:grid-cols-4">
  72. <Panel>
  73. <Panel.Content className="flex flex-col space-y-4 md:px-3">
  74. <div className="flex items-center space-x-3">
  75. <div className="rounded-sm bg-surface-300 p-1.5 text-foreground-light shadow-xs">
  76. <Auth size={16} strokeWidth={1.5} />
  77. </div>
  78. <h5>Authentication</h5>
  79. </div>
  80. <div className="flex grow md:min-h-[50px] xl:min-h-[75px]">
  81. <p className="text-sm text-foreground-light">
  82. A complete user management system that works without any additional tools.
  83. </p>
  84. </div>
  85. <div className="flex items-center space-x-2">
  86. <Button type="default" asChild>
  87. <Link href={`/project/${ref}/auth/users`}>Explore Auth</Link>
  88. </Button>
  89. <Button
  90. className="translate-y-px"
  91. icon={<ExternalLink />}
  92. type="default"
  93. asChild
  94. >
  95. <Link href={`${DOCS_URL}/guides/auth`} target="_blank" rel="noreferrer">
  96. About Auth
  97. </Link>
  98. </Button>
  99. </div>
  100. </Panel.Content>
  101. </Panel>
  102. <Panel>
  103. <Panel.Content className="flex flex-col space-y-4 md:px-3">
  104. <div className="flex items-center space-x-3">
  105. <div className="rounded-sm bg-surface-300 p-1.5 text-foreground-light shadow-xs">
  106. <Storage size={16} strokeWidth={1.5} />
  107. </div>
  108. <h5>Storage</h5>
  109. </div>
  110. <div className="flex md:min-h-[50px] xl:min-h-[75px]">
  111. <p className="text-sm text-foreground-light">
  112. Store, organize, and serve any file types of any size from multiple buckets.
  113. </p>
  114. </div>
  115. <div className="flex items-center space-x-2">
  116. <Button type="default" asChild>
  117. <Link href={`/project/${ref}/storage/buckets`}>Explore Storage</Link>
  118. </Button>
  119. <Button
  120. className="translate-y-px"
  121. icon={<ExternalLink />}
  122. type="default"
  123. asChild
  124. >
  125. <Link href={`${DOCS_URL}/guides/storage`} target="_blank" rel="noreferrer">
  126. About Storage
  127. </Link>
  128. </Button>
  129. </div>
  130. </Panel.Content>
  131. </Panel>
  132. <Panel>
  133. <Panel.Content className="flex flex-col space-y-4 md:px-3">
  134. <div className="flex items-center space-x-3">
  135. <div className="rounded-sm bg-surface-300 p-1.5 text-foreground-light shadow-xs">
  136. <EdgeFunctions size={16} strokeWidth={1.5} />
  137. </div>
  138. <h5>Edge Functions</h5>
  139. </div>
  140. <div className="flex md:min-h-[50px] xl:min-h-[75px]">
  141. <p className="text-sm text-foreground-light">
  142. Write custom code without deploying or scaling servers, with fast deploy
  143. times and low latency.
  144. </p>
  145. </div>
  146. <div className="flex items-center space-x-2">
  147. <Button type="default" asChild>
  148. <Link href={`/project/${ref}/functions`}>Explore Functions</Link>
  149. </Button>
  150. <Button
  151. className="translate-y-px"
  152. icon={<ExternalLink />}
  153. type="default"
  154. asChild
  155. >
  156. <Link
  157. href={`${DOCS_URL}/guides/functions`}
  158. target="_blank"
  159. rel="noreferrer"
  160. >
  161. About Functions
  162. </Link>
  163. </Button>
  164. </div>
  165. </Panel.Content>
  166. </Panel>
  167. <Panel>
  168. <Panel.Content className="flex flex-col space-y-4 md:px-3">
  169. <div className="flex items-center space-x-4">
  170. <div className="rounded-sm bg-surface-300 p-1.5 text-foreground-light shadow-xs">
  171. <Realtime size={16} strokeWidth={1.5} />
  172. </div>
  173. <h5>Realtime</h5>
  174. </div>
  175. <div className="flex md:min-h-[50px] xl:min-h-[75px]">
  176. <p className="text-sm text-foreground-light">
  177. Listen to your PostgreSQL database in realtime via websockets.
  178. </p>
  179. </div>
  180. <div className="flex items-center space-x-2">
  181. <Button type="default" asChild>
  182. <Link href={`/project/${ref}/realtime/inspector`}>Explore Realtime</Link>
  183. </Button>
  184. <Button
  185. className="translate-y-px"
  186. icon={<ExternalLink />}
  187. type="default"
  188. asChild
  189. >
  190. <Link href={`${DOCS_URL}/guides/realtime`} target="_blank" rel="noreferrer">
  191. About Realtime
  192. </Link>
  193. </Button>
  194. </div>
  195. </Panel.Content>
  196. </Panel>
  197. </div>
  198. </div>
  199. )}
  200. </div>
  201. </div>
  202. <div className="col-span-12 lg:col-span-4">
  203. <div className="space-y-6">
  204. <div className="space-y-2">
  205. <h2>Connect to your project</h2>
  206. <p className="text-base text-foreground-light text-balance">
  207. Interact with your database through the{' '}
  208. <InlineLink href={`${DOCS_URL}/reference`}>Briven client libraries</InlineLink> and
  209. your API keys.
  210. </p>
  211. </div>
  212. <div className="flex items-center space-x-2">
  213. <Button asChild type="default" icon={<Settings size={16} strokeWidth={1.5} />}>
  214. <Link href={`/project/${ref}/settings/api-keys`}>API Keys settings</Link>
  215. </Button>
  216. <DocsButton href={`${DOCS_URL}/guides/database/api`} />
  217. </div>
  218. </div>
  219. </div>
  220. <div className="col-span-12 lg:col-span-8">
  221. <APIKeys />
  222. </div>
  223. </div>
  224. )
  225. }