Skip to content

Commit

Permalink
feat: use new api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Aug 3, 2024
1 parent 5d65223 commit 5deee93
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export const FeaturePreviewContextProvider = ({ children }: PropsWithChildren<{}

export const useIsAPIDocsSidePanelEnabled = () => {
const { flags } = useFeaturePreviewContext()
return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL]
// return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL]
return true
}

export const useIsRLSAIAssistantEnabled = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function convertArgumentTypes(value: string) {

return { name, type, defaultValue: parsedDefaultValue }
} else {
console.error('Error while trying to parse function arguments', x)
console.error('解析函数参数失败', x)
return null
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Bucket = ({ language, apikey, endpoint }: ContentProps) => {
</Badge>
</div>
<p className="text-sm text-foreground-light">
Allowed MIME types:{' '}
允许的多媒体类型:
{allowedMimeTypes === null
? '允许所有类型'
: (allowedMimeTypes ?? []).length === 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Entities = ({ language }: ContentProps) => {
请记住在您对表进行任何更改后需要重新生成并下载此文件。
</p>
</div>
<ContentSnippet selectedLanguage={language} snippet={DOCS_CONTENT.graphql} />
{/* <ContentSnippet selectedLanguage={language} snippet={DOCS_CONTENT.graphql} /> */}
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Entity = ({ language, apikey = '', endpoint = '' }: ContentProps) => {
<div className="flex flex-col gap-y-1">
<h2 className="text-xl">{resource}</h2>
<p className="text-sm text-foreground-light">
{definition?.description ?? '无描述'}
{definition?.description ?? '无描述信息'}
</p>
</div>
<LanguageSelector />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ const Introduction = ({ showKeys, language, apikey, endpoint }: ContentProps) =>
>
<div className="px-4 space-y-6">
<div className="flex space-x-4 mt-8">
<p className="text-sm w-40">项目 URL</p>
<p className="text-sm w-40">项目地址</p>
<Input disabled readOnly copy size="small" value={endpoint} className="w-full" />
</div>
<div className="flex space-x-4">
<p className="text-sm w-40">客户端 API key</p>
<p className="text-sm w-40">客户端密钥</p>
<Input
disabled
readOnly
size="small"
value={showKeys ? apikey : '通过下拉菜单在头部显示 API key'}
value={showKeys ? apikey : '点击菜单栏顶部的按钮显示密钥'}
className="w-full"
descriptionText="这个 key 可以安全地在浏览器中使用,前提是您启用行级安全(RLS)并且配置了相应的策略。"
descriptionText="这个密钥可以安全地在浏览器中使用,前提是您启用行级安全(RLS)并且配置了相应的策略。"
actions={[
<Button
key="copy"
Expand All @@ -62,16 +62,16 @@ const Introduction = ({ showKeys, language, apikey, endpoint }: ContentProps) =>
/>
</div>
<div className="flex space-x-4">
<p className="text-sm w-40 mb-16">服务端 key</p>
<p className="text-sm w-40 mb-16">服务端密钥</p>
<Input
disabled
readOnly
size="small"
value={showKeys ? serviceKey : '通过下拉菜单在头部显示 API key'}
value={showKeys ? serviceKey : '点击菜单栏顶部的按钮显示密钥'}
className="w-full"
descriptionText={
<p>
这个 key 可以绕过行级安全策略。{' '}
这个密钥可以绕过行级安全策略。
<span className="text-amber-900">请务必不要公开它。</span>
</p>
}
Expand Down
12 changes: 6 additions & 6 deletions apps/studio/components/interfaces/ProjectAPIDocs/Content/RPC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ const RPC = ({ language }: ContentProps) => {
<div className="divide-y">
<div className="space-y-1 px-4 py-4">
<h2 className="text-xl">{rpc.name}</h2>
<p className="text-sm text-foreground-light">{summary ?? 'No description available'}</p>
<p className="text-sm text-foreground-light">{summary ?? '无描述信息'}</p>
</div>
<div className="space-y-2 px-4 py-4">
<p className="text-sm text-foreground-light">Function arguments</p>
<p className="text-sm text-foreground-light">函数参数</p>
<Table
head={[
<Table.th key="name">Name</Table.th>,
<Table.th key="format">Format</Table.th>,
<Table.th key="type">Type</Table.th>,
<Table.th key="name">参数名</Table.th>,
<Table.th key="format">格式</Table.th>,
<Table.th key="type">类型</Table.th>,
<Table.th key="required"></Table.th>,
]}
body={parameters.map((parameter: any) => (
Expand All @@ -60,7 +60,7 @@ const RPC = ({ language }: ContentProps) => {
<Table.td title={parameter.type}>{parameter.type}</Table.td>
<Table.td>
{parameter.required ? (
<Badge variant="warning">必须</Badge>
<Badge variant="warning">必选</Badge>
) : (
<p className="text-foreground-light">可选</p>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const FirstLevelNav = () => {
rel="noreferrer"
className="!justify-start"
>
文档
文档中心
</Link>
</Button>
<Button block asChild type="text" size="small" icon={<IconBookOpen />}>
Expand All @@ -198,7 +198,7 @@ const FirstLevelNav = () => {
rel="noreferrer"
className="!justify-start"
>
REST 指南
API 指南
</Link>
</Button>
</div>
Expand Down
Loading

0 comments on commit 5deee93

Please sign in to comment.