Skip to content

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

Fix tabs in guides/api

Joshen Limba1cfbfd89d2
diff --git a/apps/temp-docs/components/CodeBlock/CodeBlock.tsx b/apps/temp-docs/components/CodeBlock/CodeBlock.tsx
index bf3792274c0..d0c6208a054 100644
--- a/apps/temp-docs/components/CodeBlock/CodeBlock.tsx
+++ b/apps/temp-docs/components/CodeBlock/CodeBlock.tsx
@@ -18,7 +18,9 @@ interface Props {
className?: string
children?: string
size?: 'small' | 'medium' | 'large'
+ value?: string
}
+
function CodeBlock(props: Props) {
const { isDarkMode } = useTheme()
const monokaiTheme = monokaiCustomTheme(isDarkMode)
@@ -79,14 +81,14 @@ function CodeBlock(props: Props) {
paddingBottom: '4px',
}}
>
- {props.children?.trimEnd()}
+ {(props.value || props.children)?.trimEnd()}
</SyntaxHighlighter>
) : (
- <code>{props.children}</code>
+ <code>{props.value || props.children}</code>
)}
- {!props.hideCopy && props.children && props.className ? (
+ {!props.hideCopy && (props.value || props.children) && props.className ? (
<div className={`${isDarkMode ?? 'dark'} absolute right-2 top-2`}>
- <CopyToClipboard text={props.children}>
+ <CopyToClipboard text={props.value || props.children}>
<Button
type="default"
icon={copied ? <IconCheck /> : <IconCopy />}
diff --git a/apps/temp-docs/components/index.tsx b/apps/temp-docs/components/index.tsx
index 7762366c56e..7705cbe1efa 100644
--- a/apps/temp-docs/components/index.tsx
+++ b/apps/temp-docs/components/index.tsx
@@ -9,6 +9,7 @@ import { H3, H4 } from './CustomMDX'
const components = {
Alert,
ButtonCard,
+ CodeBlock,
Frameworks,
AuthProviders,
@@ -18,6 +19,7 @@ const components = {
h3: H3,
h4: H4,
code: (props: any) => <CodeBlock {...props} />,
+ mono: (props: any) => <code className="text-sm">{props.children}</code>,
}
export default components
diff --git a/apps/temp-docs/docs/guides/api.mdx b/apps/temp-docs/docs/guides/api.mdx
index fc10871a9e2..2250436d1a6 100644
--- a/apps/temp-docs/docs/guides/api.mdx
+++ b/apps/temp-docs/docs/guides/api.mdx
@@ -70,14 +70,13 @@ API route by creating a table called `todos` to store tasks.
This creates a corresponding route `todos` which can accept `GET`, `POST`, `PATCH`, & `DELETE` requests.
<Tabs
- groupId="dashboard-or-sql"
- defaultValue="dashboard"
- values={[
- {label: 'Dashboard', value: 'dashboard'},
- {label: 'SQL', value: 'sql'},
- ]}>
-
-<TabItem value="dashboard">
+ scrollable
+ size="small"
+ type="underlined"
+ listClassNames="px-8 pt-4"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
1. Go to the [Table editor](https://app.supabase.com/project/_/editor) page in the Dashboard.
1. Click **New Table** and create a table with the name `todos`.
@@ -89,8 +88,8 @@ This creates a corresponding route `todos` which can accept `GET`, `POST`, `PATC
<source src={'/docs/videos/api/api-create-table-sm.mp4'} type="video/mp4" muted playsInline />
</video>
-</TabItem>
-<TabItem value="sql">
+</TabPanel>
+<TabPanel id="sql" label="SQL">
```sql
-- Create a table called "todos" with a column to store tasks.
@@ -99,9 +98,10 @@ create table todos (
id bigint generated by default as identity primary key,
task text check (char_length(task) > 3)
);
+
```
-</TabItem>
+</TabPanel>
</Tabs>
### API URL and Keys
@@ -165,14 +165,13 @@ Let's see how to make a request to the `todos` table which we created in the fir
using the API URL (`SUPABASE_URL`) and Key (`SUPABASE_ANON_KEY`) we provided:
<Tabs
- groupId="language"
- defaultValue="javascript"
- values={[
- {label: 'JavaScript', value: 'javascript'},
- {label: 'cURL', value: 'curl'},
- ]}>
-
-<TabItem value="javascript">
+ scrollable
+ size="small"
+ type="underlined"
+ listClassNames="px-8 pt-4"
+ defaultActiveId="javascript"
+>
+<TabPanel id="javascript" label="Javascript">
```javascript
// Initialize the JS client
@@ -183,8 +182,8 @@ const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)
const { data: todos, error } = await supabase.from('todos').select('*')
```
-</TabItem>
-<TabItem value="curl">
+</TabPanel>
+<TabPanel id="curl" label="cURL">
```bash
# Append /rest/v1/ to your URL, and then use the table name as the route
@@ -193,7 +192,7 @@ curl '<SUPABASE_URL>/rest/v1/todos' \
-H "Authorization: Bearer <SUPABASE_ANON_KEY>"
```
-</TabItem>
+</TabPanel>
</Tabs>
JS Reference: [select()](../reference/javascript/select),
@@ -215,14 +214,13 @@ Be sure to rebuild the GraphQL schema after altering the SQL schema.
You can use any GraphQL client with the Supabase GraphQL API. For our GraphQL example we will use [urql](https://formidable.com/open-source/urql/docs/).
<Tabs
- groupId="language"
- defaultValue="javascript"
- values={[
- {label: 'JavaScript', value: 'javascript'},
- {label: 'cURL', value: 'curl'},
- ]}>
-
-<TabItem value="javascript">
+ scrollable
+ size="small"
+ type="underlined"
+ listClassNames="px-8 pt-4"
+ defaultActiveId="javascript"
+>
+<TabPanel id="javascript" label="Javascript">
```javascript
import { createClient, useQuery } from 'urql'
@@ -265,8 +263,8 @@ const [result, reexecuteQuery] = useQuery({
const { data, fetching, error } = result
```
-</TabItem>
-<TabItem value="curl">
+</TabPanel>
+<TabPanel id="curl" label="cURL">
```bash
# Append /graphql/v1/ to your URL, and then use the table name as the route
@@ -276,7 +274,7 @@ curl --request POST '<SUPABASE_URL>/graphql/v1' \
-d '{ "query":"{ todos(first: 3) { edges { node { id } } } }" }'
```
-</TabItem>
+</TabPanel>
</Tabs>
### Realtime API
@@ -284,14 +282,13 @@ curl --request POST '<SUPABASE_URL>/graphql/v1' \
By default Realtime is disabled on your database. Let's turn on Realtime for the `todos` table.
<Tabs
- groupId="dashboard-or-sql"
- defaultValue="dashboard"
- values={[
- {label: 'Dashboard', value: 'dashboard'},
- {label: 'SQL', value: 'sql'},
- ]}>
-
-<TabItem value="dashboard">
+ scrollable
+ size="small"
+ type="underlined"
+ listClassNames="px-8 pt-4"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
1. Go to the [Database](https://app.supabase.com/project/_/database/tables) page in the Dashboard.
2. Click on **Replication** in the sidebar.
@@ -302,14 +299,14 @@ By default Realtime is disabled on your database. Let's turn on Realtime for the
<source src={'/docs/videos/api/api-realtime.mp4'} type="video/mp4" muted playsInline />
</video>
-</TabItem>
-<TabItem value="sql">
+</TabPanel>
+<TabPanel id="sql" label="SQL">
```sql
alter publication supabase_realtime add table todos;
```
-</TabItem>
+</TabPanel>
</Tabs>
From the client, we can listen to any new data that is inserted into the `todos` table:
@@ -341,27 +338,26 @@ To control access to your data, you can use [Policies](/guides/auth#policies).
When you create a table in Postgres, Row Level Security is disabled by default. To enable RLS:
<Tabs
- groupId="dashboard-or-sql"
- defaultValue="dashboard"
- values={[
- {label: 'Dashboard', value: 'dashboard'},
- {label: 'SQL', value: 'sql'},
- ]}>
-
-<TabItem value="dashboard">
+ scrollable
+ size="small"
+ type="underlined"
+ listClassNames="px-8 pt-4"
+ defaultActiveId="dashboard"
+>
+<TabPanel id="dashboard" label="Dashboard">
1. Go to the [Authentication](https://app.supabase.com/project/_/auth/users) page in the Dashboard.
2. Click on **Policies** in the sidebar.
3. Select **Enable RLS** to enable Row Level Security.
-</TabItem>
-<TabItem value="sql">
+</TabPanel>
+<TabPanel id="sql" label="SQL">
```sql
alter table todos enable row level security;
```
-</TabItem>
+</TabPanel>
</Tabs>
### The `service_role` key
@@ -383,6 +379,6 @@ select usename,useconfig from pg_shadow where usename = 'authenticator' ;
The expected value for `useconfig` should be:
-```
-["session_preload_libraries=supautils, safeupdate"]
+```sql
+['session_preload_libraries=supautils, safeupdate']
```
diff --git a/apps/temp-docs/public/videos/api/api-docs.mp4 b/apps/temp-docs/public/videos/api/api-docs.mp4
new file mode 100644
index 00000000000..7fe41d76a17
Binary files /dev/null and b/apps/temp-docs/public/videos/api/api-docs.mp4 differ
diff --git a/apps/temp-docs/public/videos/connection-pool-config.mp4 b/apps/temp-docs/public/videos/connection-pool-config.mp4
new file mode 100644
index 00000000000..1513e03e94e
Binary files /dev/null and b/apps/temp-docs/public/videos/connection-pool-config.mp4 differ
diff --git a/apps/temp-docs/public/videos/guides/integrations/plasmic/configure-app-host-plasmic-05.mp4 b/apps/temp-docs/public/videos/guides/integrations/plasmic/configure-app-host-plasmic-05.mp4
new file mode 100644
index 00000000000..d8d574e6133
Binary files /dev/null and b/apps/temp-docs/public/videos/guides/integrations/plasmic/configure-app-host-plasmic-05.mp4 differ
diff --git a/apps/temp-docs/public/videos/guides/integrations/plasmic/create-gallery-page-plasmic-06.mp4 b/apps/temp-docs/public/videos/guides/integrations/plasmic/create-gallery-page-plasmic-06.mp4
new file mode 100644
index 00000000000..206e243443f
Binary files /dev/null and b/apps/temp-docs/public/videos/guides/integrations/plasmic/create-gallery-page-plasmic-06.mp4 differ
diff --git a/apps/temp-docs/public/videos/guides/integrations/plasmic/end-to-end-plasmic-10.mp4 b/apps/temp-docs/public/videos/guides/integrations/plasmic/end-to-end-plasmic-10.mp4
new file mode 100644
index 00000000000..cdf5b35ff7f
Binary files /dev/null and b/apps/temp-docs/public/videos/guides/integrations/plasmic/end-to-end-plasmic-10.mp4 differ