Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Slight update to hooks layout

Joshen Lim3929b934cc1c
diff --git a/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx b/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx
index bfd9c95b973..3e1f489da7c 100644
--- a/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx
+++ b/studio/components/interfaces/Database/Hooks/HooksList/HooksList.tsx
@@ -1,8 +1,9 @@
import { FC } from 'react'
+import Link from 'next/link'
import { includes, uniqBy, map as lodashMap } from 'lodash'
import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
-import { Button, Input, IconSearch, IconLoader } from 'ui'
+import { Button, Input, IconSearch, IconLoader, IconExternalLink } from 'ui'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useStore, checkPermissions } from 'hooks'
@@ -12,6 +13,7 @@ import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { useDatabaseHooks } from 'data/database-triggers/database-triggers-query'
+import { FormHeader } from 'components/ui/Forms'
function isHooksEnabled(schemas: any): boolean {
return schemas.some((schema: any) => schema.name === 'supabase_functions')
@@ -88,6 +90,12 @@ const HooksList: FC<any> = ({
return (
<>
+ <div className="flex items-center justify-between">
+ <FormHeader
+ title="Database Webhooks"
+ description="Send real-time data from your database to another system whenever a table event occurs"
+ />
+ </div>
{(hooks || []).length == 0 ? (
<div className="flex h-full w-full items-center justify-center">
<ProductEmptyState
@@ -105,40 +113,49 @@ const HooksList: FC<any> = ({
</ProductEmptyState>
</div>
) : (
- <div className="w-full space-y-4 py-4">
- <div className="flex items-center justify-between px-6">
+ <div className="w-full space-y-4">
+ <div className="flex items-center justify-between">
<Input
- placeholder="Filter by name"
+ placeholder="Search for a webhook"
size="small"
icon={<IconSearch size="tiny" />}
value={filterString}
onChange={(e) => setFilterString(e.target.value)}
/>
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <Button disabled={!canCreateWebhooks} onClick={() => createHook()}>
- Create a new hook
- </Button>
- </Tooltip.Trigger>
- {!canCreateWebhooks && (
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
- >
- <span className="text-xs text-scale-1200">
- You need additional permissions to create webhooks
- </span>
- </div>
- </Tooltip.Content>
- )}
- </Tooltip.Root>
+ <div className="flex items-center space-x-2">
+ <Link href="https://supabase.com/docs/guides/database/webhooks">
+ <a target="_blank">
+ <Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>
+ Documentation
+ </Button>
+ </a>
+ </Link>
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Button disabled={!canCreateWebhooks} onClick={() => createHook()}>
+ Create a new hook
+ </Button>
+ </Tooltip.Trigger>
+ {!canCreateWebhooks && (
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ You need additional permissions to create webhooks
+ </span>
+ </div>
+ </Tooltip.Content>
+ )}
+ </Tooltip.Root>
+ </div>
</div>
{filteredHooks.length <= 0 && (
- <div className="mx-auto flex max-w-lg items-center justify-center space-x-3 rounded border p-6 shadow-md dark:border-dark">
+ <div className="mx-auto flex max-w-lg items-center justify-center space-x-3 rounded border py-6 shadow-md dark:border-dark">
<p>No results match your filter query</p>
<Button type="outline" onClick={() => setFilterString('')}>
Reset filter
diff --git a/studio/components/interfaces/Database/Hooks/HooksList/SchemaTable.tsx b/studio/components/interfaces/Database/Hooks/HooksList/SchemaTable.tsx
index fd8f1927aac..ff2b229556d 100644
--- a/studio/components/interfaces/Database/Hooks/HooksList/SchemaTable.tsx
+++ b/studio/components/interfaces/Database/Hooks/HooksList/SchemaTable.tsx
@@ -20,13 +20,13 @@ const SchemaTable: FC<Props> = ({
return (
<div key={schema} className="">
<div className="sticky top-0 backdrop-blur backdrop-filter">
- <div className="flex items-baseline space-x-1 py-2 px-6">
+ <div className="flex items-baseline space-x-1 py-2">
<h5 className="text-scale-1000">schema</h5>
<h4>{schema}</h4>
</div>
</div>
<Table
- className="table-fixed px-6"
+ className="table-fixed"
head={
<>
<Table.th key="name" className="space-x-4">
diff --git a/studio/components/interfaces/Database/Roles/RolesList.tsx b/studio/components/interfaces/Database/Roles/RolesList.tsx
index fd7a2acfd87..62a1d4cdce2 100644
--- a/studio/components/interfaces/Database/Roles/RolesList.tsx
+++ b/studio/components/interfaces/Database/Roles/RolesList.tsx
@@ -62,7 +62,7 @@ const RolesList = ({}) => {
/>
</div>
- <div className="mb-4 -mt-2 flex items-center justify-between">
+ <div className="mb-4 flex items-center justify-between">
<div className="flex items-center space-x-4">
<Input
size="small"
diff --git a/studio/pages/project/[ref]/database/backups/scheduled.tsx b/studio/pages/project/[ref]/database/backups/scheduled.tsx
index 18cd5658a7b..71694a0c630 100644
--- a/studio/pages/project/[ref]/database/backups/scheduled.tsx
+++ b/studio/pages/project/[ref]/database/backups/scheduled.tsx
@@ -8,6 +8,7 @@ import { checkPermissions, useStore } from 'hooks'
import { DatabaseLayout } from 'components/layouts'
import { BackupsList } from 'components/interfaces/Database'
import NoPermission from 'components/ui/NoPermission'
+import { FormsContainer } from 'components/ui/Forms'
const DatabaseScheduledBackups: NextPageWithLayout = () => {
const { ui } = useStore()
@@ -17,33 +18,35 @@ const DatabaseScheduledBackups: NextPageWithLayout = () => {
const canReadScheduledBackups = checkPermissions(PermissionAction.READ, 'back_ups')
return (
- <div className="mx-auto max-w-4xl space-y-6 px-5 pt-12 pb-20">
- <h3 className="text-xl text-scale-1200">Backups</h3>
-
- <Tabs
- type="underlined"
- size="small"
- activeId="scheduled"
- onChange={(id: any) => {
- if (id === 'pitr') router.push(`/project/${ref}/database/backups/pitr`)
- }}
- >
- <Tabs.Panel id="scheduled" label="Scheduled backups" />
- <Tabs.Panel id="pitr" label="Point in Time" />
- </Tabs>
-
- <div className="space-y-4">
- <p className="text-sm text-scale-1100">
- Projects are backed up daily around midnight of your project's region and can be restored
- at any time.
- </p>
- {canReadScheduledBackups ? (
- <BackupsList />
- ) : (
- <NoPermission resourceText="view scheduled backups" />
- )}
+ <FormsContainer>
+ <div className="space-y-6">
+ <h3 className="text-xl text-scale-1200">Backups</h3>
+
+ <Tabs
+ type="underlined"
+ size="small"
+ activeId="scheduled"
+ onChange={(id: any) => {
+ if (id === 'pitr') router.push(`/project/${ref}/database/backups/pitr`)
+ }}
+ >
+ <Tabs.Panel id="scheduled" label="Scheduled backups" />
+ <Tabs.Panel id="pitr" label="Point in Time" />
+ </Tabs>
+
+ <div className="space-y-4">
+ <p className="text-sm text-scale-1100">
+ Projects are backed up daily around midnight of your project's region and can be
+ restored at any time.
+ </p>
+ {canReadScheduledBackups ? (
+ <BackupsList />
+ ) : (
+ <NoPermission resourceText="view scheduled backups" />
+ )}
+ </div>
</div>
- </div>
+ </FormsContainer>
)
}
diff --git a/studio/pages/project/[ref]/database/hooks/index.tsx b/studio/pages/project/[ref]/database/hooks/index.tsx
index 67f796cd866..7bc00657760 100644
--- a/studio/pages/project/[ref]/database/hooks/index.tsx
+++ b/studio/pages/project/[ref]/database/hooks/index.tsx
@@ -1,3 +1,4 @@
+import clsx from 'clsx'
import { useEffect, useState } from 'react'
import { useRouter } from 'next/router'
import { observer } from 'mobx-react-lite'
@@ -69,7 +70,12 @@ const HooksPage: NextPageWithLayout = () => {
}
return (
- <>
+ <div
+ className={clsx(
+ 'mx-auto flex flex-col px-5 pt-6 pb-14',
+ 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32'
+ )}
+ >
<HooksList
hooksEnabled={hooksEnabled}
filterString={filterString}
@@ -89,7 +95,7 @@ const HooksPage: NextPageWithLayout = () => {
visible={showDeleteHookForm}
setVisible={setShowDeleteHookForm}
/>
- </>
+ </div>
)
}
diff --git a/studio/pages/project/[ref]/database/roles/index.tsx b/studio/pages/project/[ref]/database/roles/index.tsx
index 4a85543cf2f..ef584cc1668 100644
--- a/studio/pages/project/[ref]/database/roles/index.tsx
+++ b/studio/pages/project/[ref]/database/roles/index.tsx
@@ -2,13 +2,18 @@ import { observer } from 'mobx-react-lite'
import { DatabaseLayout } from 'components/layouts'
import { RolesList } from 'components/interfaces/Database'
import { NextPageWithLayout } from 'types'
-import { FormsContainer } from 'components/ui/Forms'
+import clsx from 'clsx'
const DatabaseRoles: NextPageWithLayout = () => {
return (
- <FormsContainer>
+ <div
+ className={clsx(
+ 'mx-auto flex flex-col px-5 pt-6 pb-14',
+ 'lg:pt-8 lg:px-14 1xl:px-28 2xl:px-32'
+ )}
+ >
<RolesList />
- </FormsContainer>
+ </div>
)
}
diff --git a/studio/pages/project/[ref]/database/wrappers/index.tsx b/studio/pages/project/[ref]/database/wrappers/index.tsx
index d8df5feae34..c5454dff1ff 100644
--- a/studio/pages/project/[ref]/database/wrappers/index.tsx
+++ b/studio/pages/project/[ref]/database/wrappers/index.tsx
@@ -1,3 +1,4 @@
+import clsx from 'clsx'
import { observer } from 'mobx-react-lite'
import { PermissionAction } from '@supabase/shared-types/out/constants'