Merge pull request #13060 from supabase/chore/fix-title-tags

Chore/fix title tags
This commit is contained in:
Copple authored and GitHub committed 2023-03-21 06:36:42 +01:00
commit 71af49c7d4
11 files changed
+260 -215

No files matched your search

@@ -1,3 +1,4 @@
import Head from 'next/head'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
@@ -30,51 +31,78 @@ const RefSectionHandler = (props: RefSectionHandlerProps) => {
}
})
return (
<RefSubLayout>
{props.sections.map((x, i) => {
switch (x.type) {
case 'markdown':
const markdownData = props.pageProps.docs.find((doc) => doc.id === x.id)
function getPageTitle() {
switch (props.type) {
case 'client-lib':
return props.spec.info.title
case 'cli':
return 'Supabase CLI reference'
case 'api':
return 'Supabase API reference'
default:
return 'Supabase Docs'
}
}
return <RefEducationSection key={x.id + i} item={x} markdownContent={markdownData} />
break
case 'function':
return (
<RefFunctionSection
key={x.id + i}
funcData={x}
commonFuncData={x}
spec={props.spec}
typeSpec={props.typeSpec}
/>
)
case 'cli-command':
return <CliCommandSection key={x.id + i} funcData={x} commonFuncData={x} />
break
case 'operation':
return (
<ApiOperationSection
key={x.id + i}
funcData={x}
commonFuncData={x}
spec={props.spec}
/>
)
default:
return (
<RefFunctionSection
key={x.id + i}
funcData={x}
commonFuncData={x}
spec={props.spec}
typeSpec={props.typeSpec}
/>
)
break
}
})}
</RefSubLayout>
const pageTitle = getPageTitle()
return (
<>
<Head>
<title>{pageTitle}</title>
<meta name="description" content={pageTitle} />
<meta property="og:image" content={`https://supabase.com/docs/img/supabase-og-image.png`} />
<meta
name="twitter:image"
content={`https://supabase.com/docs/img/supabase-og-image.png`}
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</Head>
<RefSubLayout>
{props.sections.map((x, i) => {
switch (x.type) {
case 'markdown':
const markdownData = props.pageProps.docs.find((doc) => doc.id === x.id)
return <RefEducationSection key={x.id + i} item={x} markdownContent={markdownData} />
break
case 'function':
return (
<RefFunctionSection
key={x.id + i}
funcData={x}
commonFuncData={x}
spec={props.spec}
typeSpec={props.typeSpec}
/>
)
case 'cli-command':
return <CliCommandSection key={x.id + i} funcData={x} commonFuncData={x} />
break
case 'operation':
return (
<ApiOperationSection
key={x.id + i}
funcData={x}
commonFuncData={x}
spec={props.spec}
/>
)
default:
return (
<RefFunctionSection
key={x.id + i}
funcData={x}
commonFuncData={x}
spec={props.spec}
typeSpec={props.typeSpec}
/>
)
break
}
})}
</RefSubLayout>
</>
)
}
+31 -25
View File
@@ -7,6 +7,7 @@ import TopNavBarRef from '~/components/Navigation/NavigationMenu/TopNavBarRef'
import { memo, useEffect } from 'react'
import Footer from '~/components/Navigation/Footer'
import { menuState, useMenuLevelId, useMenuMobileOpen } from '~/hooks/useMenuState'
import Head from 'next/head'
const levelsData = {
home: {
@@ -312,32 +313,37 @@ const SiteLayout = ({ children }) => {
}, [])
return (
<main>
<div className="flex flex-row h-screen">
<NavContainer />
<Container>
<div className={['lg:sticky top-0 z-10 overflow-hidden'].join(' ')}>
<TopNavBarRef />
</div>
<div
className={[
'sticky transition-all top-0',
'z-10',
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
].join(' ')}
>
<div className={['lg:hidden', 'px-5 ', 'border-b z-10'].join(' ')}>
<MobileHeader />
<>
<Head>
<title>Supabase Docs</title>
</Head>
<main>
<div className="flex flex-row h-screen">
<NavContainer />
<Container>
<div className={['lg:sticky top-0 z-10 overflow-hidden'].join(' ')}>
<TopNavBarRef />
</div>
</div>
<div className="grow px-5 max-w-7xl mx-auto py-16">
{children}
<Footer />
</div>
<MobileMenuBackdrop />
</Container>
</div>
</main>
<div
className={[
'sticky transition-all top-0',
'z-10',
'backdrop-blur backdrop-filter bg-white-1200 dark:bg-blackA-300',
].join(' ')}
>
<div className={['lg:hidden', 'px-5 ', 'border-b z-10'].join(' ')}>
<MobileHeader />
</div>
</div>
<div className="grow px-5 max-w-7xl mx-auto py-16">
{children}
<Footer />
</div>
<MobileMenuBackdrop />
</Container>
</div>
</main>
</>
)
}
@@ -37,7 +37,6 @@ const RefSubLayoutNonFunc: FC<RefSubLayoutNonFuncType> & RefSubLayoutNonFuncSubC
}
const Section: FC<ISectionContainer> = (props) => {
// console.log({ props })
return (
<article
key={props.id}
+52 -46
View File
@@ -2,67 +2,73 @@
import specFile from '~/../../spec/gotrue_v1_config.yaml' assert { type: 'yml' }
import { Parameter } from '~/lib/refGenerator/refTypes'
import ReactMarkdown from 'react-markdown'
import Head from 'next/head'
// Parameters are grouped on the page by tag
const TAGS = ['general']
export default function Config() {
return (
<div>
<div className="flex my-16">
<div className="w-full prose">
<h1 className="text-4xl mb-16">{specFile.info.title} Configuration</h1>
<ReactMarkdown>{specFile.info.description}</ReactMarkdown>
<div>
{TAGS.map((tag) =>
specFile.parameters
.filter((param: Parameter) => param.tags[0] === tag)
.map((parameter: Parameter, index) => (
<div>
{index === 0 && <h2 className="text-xl capitalize">{tag}</h2>}
<div className="mt-8">
<div>
<h2 className="text-xl font-medium text-scale-1200 font-mono">
<span className="mr-2">$</span>
{parameter.title}
</h2>
<div className="grid" id={parameter.id}>
<div className="border-b pb-8" key={parameter.id}>
<div className=" mb-16">
<p className="mb-4 scroll-mt-16 mt-0 text-scale-1100 text-base">
<ReactMarkdown>{parameter.description}</ReactMarkdown>
</p>
<div className="grid gap-2">
<div className="flex gap-2">
Required: <code>{parameter.required.toString()}</code>
</div>
<div className="flex gap-2">
Default:
<code>
{parameter.default ? parameter.default.toString() : 'None'}
</code>
<>
<Head>
<title>Auth config</title>
</Head>
<div>
<div className="flex my-16">
<div className="w-full prose">
<h1 className="text-4xl mb-16">{specFile.info.title} Configuration</h1>
<ReactMarkdown>{specFile.info.description}</ReactMarkdown>
<div>
{TAGS.map((tag) =>
specFile.parameters
.filter((param: Parameter) => param.tags[0] === tag)
.map((parameter: Parameter, index) => (
<div>
{index === 0 && <h2 className="text-xl capitalize">{tag}</h2>}
<div className="mt-8">
<div>
<h2 className="text-xl font-medium text-scale-1200 font-mono">
<span className="mr-2">$</span>
{parameter.title}
</h2>
<div className="grid" id={parameter.id}>
<div className="border-b pb-8" key={parameter.id}>
<div className=" mb-16">
<p className="mb-4 scroll-mt-16 mt-0 text-scale-1100 text-base">
<ReactMarkdown>{parameter.description}</ReactMarkdown>
</p>
<div className="grid gap-2">
<div className="flex gap-2">
Required: <code>{parameter.required.toString()}</code>
</div>
<div className="flex gap-2">
Default:
<code>
{parameter.default ? parameter.default.toString() : 'None'}
</code>
</div>
</div>
</div>
{parameter.links &&
parameter.links.map((link) => (
<div>
<h3>See also:</h3>
<li>
<a href={link.link}>{link.name}</a>
</li>
</div>
))}
</div>
{parameter.links &&
parameter.links.map((link) => (
<div>
<h3>See also:</h3>
<li>
<a href={link.link}>{link.name}</a>
</li>
</div>
))}
</div>
</div>
</div>
</div>
</div>
))
)}
))
)}
</div>
</div>
</div>
</div>
</div>
</>
)
}
+60 -54
View File
@@ -4,6 +4,7 @@ import { Parameter } from '~/lib/refGenerator/refTypes'
import ReactMarkdown from 'react-markdown'
import GuidesTableOfContents from '~/components/GuidesTableOfContents'
import { Heading } from '~/components/CustomHTMLElements'
import Head from 'next/head'
// Parameters are grouped on the page by tag
const TAGS = ['general', 'auth', 'api', 'database', 'dashboard', 'local', 'edge-functions']
@@ -21,69 +22,74 @@ const tocList = TAGS.map((tag) =>
export default function Config() {
return (
<div className="grid grid-cols-12 relative gap-4">
<div className="relative col-span-12 md:col-span-9 transition-all ease-out duration-100">
<div className="w-full prose">
<h1 className="">CLI configuration</h1>
<div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-8"></div>
<ReactMarkdown>{specFile.info.description}</ReactMarkdown>
<div>
{TAGS.map((tag) =>
specFile.parameters
.filter((param: Parameter) => param.tags[0] === tag)
.map((parameter: Parameter, index) => (
<div>
{index === 0 && <h2 className="text-xl capitalize">{tag}</h2>}
<div className="mt-8">
<div>
<Heading tag="h2" parseAnchors={false} customAnchor={parameter.id}>
<code>{parameter.title}</code>
</Heading>
<div className="grid">
<div className="border-b pb-8" key={parameter.id}>
<div className=" mb-16">
<p className="mb-4 scroll-mt-16 mt-0 text-scale-1100 text-base">
<ReactMarkdown>{parameter.description}</ReactMarkdown>
</p>
<div className="grid gap-2">
<div className="flex gap-2">
Required: <code>{parameter.required.toString()}</code>
</div>
<div className="flex gap-2">
Default:
<code>
{parameter.default ? parameter.default.toString() : 'None'}
</code>
<>
<Head>
<title>Supabase CLI config</title>
</Head>
<div className="grid grid-cols-12 relative gap-4">
<div className="relative col-span-12 md:col-span-9 transition-all ease-out duration-100">
<div className="w-full prose">
<h1 className="">CLI configuration</h1>
<div className="max-w-xs w-32 h-[1px] bg-gradient-to-r from-brand-800 to-brand-900 my-8"></div>
<ReactMarkdown>{specFile.info.description}</ReactMarkdown>
<div>
{TAGS.map((tag) =>
specFile.parameters
.filter((param: Parameter) => param.tags[0] === tag)
.map((parameter: Parameter, index) => (
<div>
{index === 0 && <h2 className="text-xl capitalize">{tag}</h2>}
<div className="mt-8">
<div>
<Heading tag="h2" parseAnchors={false} customAnchor={parameter.id}>
<code>{parameter.title}</code>
</Heading>
<div className="grid">
<div className="border-b pb-8" key={parameter.id}>
<div className=" mb-16">
<p className="mb-4 scroll-mt-16 mt-0 text-scale-1100 text-base">
<ReactMarkdown>{parameter.description}</ReactMarkdown>
</p>
<div className="grid gap-2">
<div className="flex gap-2">
Required: <code>{parameter.required.toString()}</code>
</div>
<div className="flex gap-2">
Default:
<code>
{parameter.default ? parameter.default.toString() : 'None'}
</code>
</div>
</div>
</div>
{parameter.links &&
parameter.links.map((link) => (
<div>
<h3>See also:</h3>
<li>
<a href={link.link}>{link.name}</a>
</li>
</div>
))}
</div>
{parameter.links &&
parameter.links.map((link) => (
<div>
<h3>See also:</h3>
<li>
<a href={link.link}>{link.name}</a>
</li>
</div>
))}
</div>
</div>
</div>
</div>
</div>
))
)}
))
)}
</div>
</div>
</div>
<div className="md:col-span-3">
<div className="sticky top-20 border-l">
<span className="block font-mono text-xs uppercase text-scale-1200 pl-5 mb-4">
On this page
</span>
<GuidesTableOfContents list={tocList} />
</div>
</div>
</div>
<div className="md:col-span-3">
<div className="sticky top-20 border-l">
<span className="block font-mono text-xs uppercase text-scale-1200 pl-5 mb-4">
On this page
</span>
<GuidesTableOfContents list={tocList} />
</div>
</div>
</div>
</>
)
}
+24 -24
View File
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/csharp
title: Getting started
title: Supabase C# Client
description: |
Supabase C#.
@@ -293,9 +293,9 @@ functions:
isSpotlight: true
code: |
```c#
var attrs = new UserAttributes
{
Data = new Dictionary<string, string> { {"example", "data" } }
var attrs = new UserAttributes
{
Data = new Dictionary<string, string> { {"example", "data" } }
};
var response = await supabase.Auth.Update(attrs);
```
@@ -516,10 +516,10 @@ functions:
public int CountryId { get; set; }
}
var model = new City
{
Name = "The Shire",
CountryId = 554
var model = new City
{
Name = "The Shire",
CountryId = 554
};
await supabase.From<City>().Insert(model);
@@ -603,10 +603,10 @@ functions:
isSpotlight: true
code: |
```c#
var model = new City
{
Id = 554,
Name = "Middle Earth"
var model = new City
{
Id = 554,
Name = "Middle Earth"
};
await supabase.From<City>().Upsert(model);
@@ -620,10 +620,10 @@ functions:
isSpotlight: true
code: |
```c#
var model = new City
{
Id = 554,
Name = "Middle Earth"
var model = new City
{
Id = 554,
Name = "Middle Earth"
};
await supabase
@@ -637,10 +637,10 @@ functions:
Allowed values for count option are `exact`, `planned` and `estimated`.
code: |
```c#
var model = new City
{
Id = 554,
Name = "Middle Earth"
var model = new City
{
Id = 554,
Name = "Middle Earth"
};
await supabase
@@ -702,7 +702,7 @@ functions:
isSpotlight: true
code: |
```c#
class CursorBroadcast : BaseBroadcast
class CursorBroadcast : BaseBroadcast
{
[JsonProperty("cursorX")]
public int CursorX {get; set;}
@@ -714,7 +714,7 @@ functions:
var channel = supabase.Realtime.Channel("any");
var broadcast = channel.Register<CursorBroadcast>();
broadcast.OnBroadcast += (sender, _) =>
broadcast.OnBroadcast += (sender, _) =>
{
var data = broadcast.Current();
};
@@ -729,7 +729,7 @@ functions:
isSpotlight: true
code: |
```c#
class UserPresence : BasePresence
class UserPresence : BasePresence
{
[JsonProperty("cursorX")]
public bool IsTyping {get; set;}
@@ -742,7 +742,7 @@ functions:
var presenceKey = Guid.NewGuid().ToString();
var presence = channel.Register<UserPresence>(presenceKey);
presence.OnSync += (sender, _) =>
presence.OnSync += (sender, _) =>
{
var state = presence.CurrentState;
};
+1 -1
View File
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/dart
title: Getting started
title: Supabase Dart Client
description: |
Supabase Dart.
+2 -2
View File
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/dart
title: Getting started
title: Supabase Dart Client
description: |
Supabase Dart.
@@ -39,7 +39,7 @@ functions:
runApp(MyApp());
}
// Get a reference your Supabase client
// Get a reference your Supabase client
final supabase = Supabase.instance.client;
```
- id: for-other-dart-projects
+3 -3
View File
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/supabase-js
title: Supabase Client
title: Supabase Javascript Client
description: |
Supabase JavaScript.
@@ -61,7 +61,7 @@ functions:
```
description: |
By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.
Go to `Settings > API > Schema` and add the schema which you want to expose to the API. You also need to grant `USAGE` on your new schema with the grants you desire, such as `SELECT, INSERT, UPDATE, DELETE`.
Go to `Settings > API > Schema` and add the schema which you want to expose to the API. You also need to grant `USAGE` on your new schema with the grants you desire, such as `SELECT, INSERT, UPDATE, DELETE`.
Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.
- id: custom-fetch-implementation
@@ -567,7 +567,7 @@ functions:
notes: |
Sends a password reset request to an email address.
- When the user clicks the reset link in the email they are redirected back to your application.
You can configure the URL that the user is redirected to via the `redirectTo` param.
You can configure the URL that the user is redirected to via the `redirectTo` param.
See [redirect URLs and wildcards](/docs/guides/auth/overview#redirect-urls-and-wildcards) to add additional redirect URLs to your project.
- After the user has been redirected successfully, prompt them for a new password and call `updateUser()`:
```js
+8 -8
View File
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/supabase-js
title: Supabase Client
title: Supabase Javascript Client
description: |
Supabase JavaScript.
@@ -1318,21 +1318,21 @@ functions:
sql: |
```sql
create table countries (
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"name" text
);
create table cities (
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"name" text,
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"name" text,
"country_id" "uuid" references public.countries on delete cascade
);
with country as (
insert into countries (name)
insert into countries (name)
values ('united kingdom') returning id
)
insert into cities (name, country_id) values
insert into cities (name, country_id) values
('London', (select id from country)),
('Manchester', (select id from country)),
('Liverpool', (select id from country)),
@@ -3887,7 +3887,7 @@ functions:
}
```
description: |
You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests.
You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests.
Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled.
hideCodeBlock: true
isSpotlight: true
+7 -7
View File
@@ -2,7 +2,7 @@ openref: 0.1
info:
id: reference/supabase-py
title: Supabase Client
title: Supabase Python Client
description: |
Supabase Python(Community).
@@ -519,21 +519,21 @@ functions:
sql: |
```sql
create table countries (
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"name" text
);
create table cities (
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"name" text,
"id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
"name" text,
"country_id" "uuid" references public.countries on delete cascade
);
with country as (
insert into countries (name)
insert into countries (name)
values ('united kingdom') returning id
)
insert into cities (name, country_id) values
insert into cities (name, country_id) values
('London', (select id from country)),
('Manchester', (select id from country)),
('Liverpool', (select id from country)),
@@ -543,7 +543,7 @@ functions:
```
APIResponse(data=[{'id': 1, 'name': 'Germany', 'cities': [{'count': 1}]},
{'id': 2, 'name': 'Indonesia', 'cities': [{'count': 1}]}],
count=None)
count=None)
```
description: |
You can get the number of rows in a related table by using the