Skip to content

Commit bd7a2c6

Browse files
committed
Nextra incremental upgrade
1 parent 3f22e0b commit bd7a2c6

File tree

122 files changed

+9980
-6026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+9980
-6026
lines changed

.github/workflows/cla.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "CLA"
3-
on: # yamllint disable-line rule:truthy
3+
on: # yamllint disable-line rule:truthy
44
issue_comment:
55
types:
66
- "created"

.github/workflows/link-checker-full.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: "Link Checker with External Links"
33

44
on:
55
schedule:
6-
- cron: '0 18 * * *' # Daily at 18:00 UTC
6+
- cron: "0 18 * * *" # Daily at 18:00 UTC
77
workflow_dispatch:
88

99
jobs:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ pnpm run dev
3737

3838
Now you should be able to see the docs rendered at http://localhost:3000
3939

40-
4140
Run linters:
4241

4342
```sh

components/JupyterNotebookViewer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ interface JupyterNotebookViewerProps {
44
fileUrl: string;
55
}
66

7-
const JupyterNotebookViewer: React.FC<JupyterNotebookViewerProps> = ({ fileUrl }) => {
7+
const JupyterNotebookViewer: React.FC<JupyterNotebookViewerProps> = ({
8+
fileUrl,
9+
}) => {
810
const nbviewerUrl = `https://nbviewer.org/github/${encodeURIComponent(fileUrl)}`;
911

1012
return (

components/banner.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { usePathname } from 'next/navigation';
1+
import { usePathname } from "next/navigation";
22

33
export default function Banner() {
44
const pathname = usePathname();
5-
const isCommercial = pathname.startsWith('/authzed/');
5+
const isCommercial = pathname.startsWith("/authzed/");
66

77
return isCommercial ? (
88
<a href="https://authzed.com/zanzibar?utm_source=docs">
@@ -11,7 +11,8 @@ export default function Banner() {
1111
</a>
1212
) : (
1313
<a href="https://github.com/authzed/spicedb">
14-
SpiceDB is 100% open source. Please help us by starring our GitHub repo. ↗
14+
SpiceDB is 100% open source. Please help us by starring our GitHub repo.
15+
1516
</a>
1617
);
1718
}

components/cta.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Button } from '@/components/ui/button';
2-
import { faPhone } from '@fortawesome/free-solid-svg-icons';
3-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4-
import Link from 'next/link';
5-
import { usePathname } from 'next/navigation';
1+
import { Button } from "@/components/ui/button";
2+
import { faPhone } from "@fortawesome/free-solid-svg-icons";
3+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
4+
import Link from "next/link";
5+
import { usePathname } from "next/navigation";
66

77
export function TocCTA() {
88
const pathname = usePathname();
9-
const isCommercial = pathname.startsWith('/authzed/');
9+
const isCommercial = pathname.startsWith("/authzed/");
1010

1111
return isCommercial ? (
1212
<div className="flex flex-wrap w-full nx-mt-8 nx-border-t nx-bg-white nx-pt-8 nx-shadow-[0_-12px_16px_white] dark:nx-bg-dark dark:nx-shadow-[0_-12px_16px_#111] nx-sticky nx-bottom-0 nx-flex nx-flex-col nx-items-start nx-gap-2 nx-pb-8 dark:nx-border-neutral-800 contrast-more:nx-border-t contrast-more:nx-border-neutral-400 contrast-more:nx-shadow-none contrast-more:dark:nx-border-neutral-400">
@@ -27,7 +27,7 @@ export function TocCTA() {
2727

2828
export function NavCTA() {
2929
const pathname = usePathname();
30-
const isCommercial = pathname.startsWith('/authzed/');
30+
const isCommercial = pathname.startsWith("/authzed/");
3131

3232
// TODO: No-ops for now
3333
return isCommercial ? <></> : <></>;

components/footer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import Link from 'next/link';
2-
import { LogoIcon } from './logo';
3-
import Scripts from './scripts';
1+
import Link from "next/link";
2+
import { LogoIcon } from "./logo";
3+
import Scripts from "./scripts";
44

55
export default function Footer() {
66
return (

components/layout.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import clsx from 'clsx';
2-
import { Inter } from 'next/font/google';
3-
import { PropsWithChildren } from 'react';
1+
import clsx from "clsx";
2+
import { Inter } from "next/font/google";
3+
import { PropsWithChildren } from "react";
44

55
const inter = Inter({
6-
variable: '--font-inter',
7-
subsets: ['latin'],
8-
display: 'swap',
6+
variable: "--font-inter",
7+
subsets: ["latin"],
8+
display: "swap",
99
});
1010

1111
export default function Layout(props: PropsWithChildren) {

components/logo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export function Logo() {
6161
}
6262
svg:hover {
6363
mask-position: 100%;
64-
transition: mask-position 1s ease, -webkit-mask-position 1s ease;
64+
transition:
65+
mask-position 1s ease,
66+
-webkit-mask-position 1s ease;
6567
}
6668
`}</style>
6769
</svg>

components/nextra/Flexsearch.tsx

Lines changed: 62 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,44 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
// SOFTWARE.
2323

24-
import cn from 'clsx';
24+
import cn from "clsx";
2525
// flexsearch types are incorrect, they were overwritten in tsconfig.json
26-
import { Document } from 'flexsearch';
27-
import { useRouter } from 'next/router';
28-
import type { SearchData } from 'nextra';
29-
import type { ReactElement, ReactNode } from 'react';
30-
import { useCallback, useState } from 'react';
31-
import ExternalIcon from './ExternalIcon';
32-
import { HighlightMatches } from './HighlightMatches';
33-
import { Search } from './Search';
34-
import { SearchResult } from './types';
26+
import { Document } from "flexsearch";
27+
import { useRouter } from "next/router";
28+
import type { SearchData } from "nextra";
29+
import type { ReactElement, ReactNode } from "react";
30+
import { useCallback, useState } from "react";
31+
import ExternalIcon from "./ExternalIcon";
32+
import { HighlightMatches } from "./HighlightMatches";
33+
import { Search } from "./Search";
34+
import { SearchResult } from "./types";
3535

3636
// Diff: Inlined definitions
37-
export const DEFAULT_LOCALE = 'en-US';
37+
export const DEFAULT_LOCALE = "en-US";
3838

3939
type SectionIndex = {
40-
id: string;
41-
url: string;
42-
title: string;
43-
pageId: string;
44-
content: string;
45-
display?: string;
46-
}
40+
id: string;
41+
url: string;
42+
title: string;
43+
pageId: string;
44+
content: string;
45+
display?: string;
46+
};
4747

4848
type PageIndex = {
49-
id: number;
50-
title: string;
51-
content: string;
52-
}
49+
id: number;
50+
title: string;
51+
content: string;
52+
};
5353

5454
// Diff: Additional index for blog posts
55-
type BlogIndex =
56-
{
57-
id: number;
58-
title: string;
59-
content: string;
60-
url: string;
61-
summary: string;
62-
}
55+
type BlogIndex = {
56+
id: number;
57+
title: string;
58+
content: string;
59+
url: string;
60+
summary: string;
61+
};
6362

6463
type Result = {
6564
_page_rk: number;
@@ -71,26 +70,26 @@ type Result = {
7170

7271
// This can be global for better caching.
7372
const indexes: {
74-
// tuple is PageIndex, SectionIndex
73+
// tuple is PageIndex, SectionIndex
7574
[locale: string]: [Document, Document];
7675
} = {};
7776

7877
// Diff: Index for blog posts
7978
// Associated type is BlogIndex
8079
const blogIndex = new Document({
8180
cache: 100,
82-
tokenize: 'forward',
81+
tokenize: "forward",
8382
document: {
84-
id: 'id',
85-
index: 'content',
86-
store: ['title', 'url', 'summary'],
83+
id: "id",
84+
index: "content",
85+
store: ["title", "url", "summary"],
8786
},
8887
});
8988

9089
// Caches promises that load the index
9190
const loadIndexesPromises = new Map<string, Promise<void>>();
9291
const loadIndexes = (basePath: string, locale: string): Promise<void> => {
93-
const key = basePath + '@' + locale;
92+
const key = basePath + "@" + locale;
9493
if (loadIndexesPromises.has(key)) {
9594
return loadIndexesPromises.get(key)!;
9695
}
@@ -101,16 +100,16 @@ const loadIndexes = (basePath: string, locale: string): Promise<void> => {
101100

102101
// Diff: Function for loading blog posts
103102
const loadBlogData = async (basePath: string | undefined) => {
104-
const response = await fetch(`${basePath ?? ''}/feed.json`, {
105-
cache: 'force-cache',
103+
const response = await fetch(`${basePath ?? ""}/feed.json`, {
104+
cache: "force-cache",
106105
});
107106
const content = await response.json();
108107

109108
return content.items.map((item, i) => {
110109
return {
111110
id: i,
112111
title: item.title,
113-
content: item['content_html'],
112+
content: item["content_html"],
114113
url: item.url,
115114
summary: item.summary,
116115
};
@@ -119,10 +118,10 @@ const loadBlogData = async (basePath: string | undefined) => {
119118

120119
const loadIndexesImpl = async (
121120
basePath: string,
122-
locale: string
121+
locale: string,
123122
): Promise<void> => {
124123
const response = await fetch(
125-
`${basePath}/_next/static/chunks/nextra-data-${locale}.json`
124+
`${basePath}/_next/static/chunks/nextra-data-${locale}.json`,
126125
);
127126
const searchData = (await response.json()) as SearchData;
128127
// Diff: Load blog data
@@ -131,11 +130,11 @@ const loadIndexesImpl = async (
131130
// Associated type is PageIndex
132131
const pageIndex = new Document({
133132
cache: 100,
134-
tokenize: 'full',
133+
tokenize: "full",
135134
document: {
136-
id: 'id',
137-
index: 'content',
138-
store: ['title'],
135+
id: "id",
136+
index: "content",
137+
store: ["title"],
139138
},
140139
context: {
141140
resolution: 9,
@@ -147,12 +146,12 @@ const loadIndexesImpl = async (
147146
// Associated type is SectionIndex
148147
const sectionIndex = new Document({
149148
cache: 100,
150-
tokenize: 'full',
149+
tokenize: "full",
151150
document: {
152-
id: 'id',
153-
index: 'content',
154-
tag: 'pageId',
155-
store: ['title', 'content', 'url', 'display'],
151+
id: "id",
152+
index: "content",
153+
tag: "pageId",
154+
store: ["title", "content", "url", "display"],
156155
},
157156
context: {
158157
resolution: 9,
@@ -164,14 +163,14 @@ const loadIndexesImpl = async (
164163
let pageId = 0;
165164

166165
for (const [route, structurizedData] of Object.entries(searchData)) {
167-
let pageContent = '';
166+
let pageContent = "";
168167
++pageId;
169168

170169
for (const [key, content] of Object.entries(structurizedData.data)) {
171-
const [headingId, headingValue] = key.split('#');
172-
const url = route + (headingId ? '#' + headingId : '');
170+
const [headingId, headingValue] = key.split("#");
171+
const url = route + (headingId ? "#" + headingId : "");
173172
const title = headingValue || structurizedData.title;
174-
const paragraphs = content.split('\n');
173+
const paragraphs = content.split("\n");
175174

176175
sectionIndex.add({
177176
id: url,
@@ -220,7 +219,7 @@ export function Flexsearch({
220219
const [loading, setLoading] = useState(false);
221220
const [error, setError] = useState(false);
222221
const [results, setResults] = useState<SearchResult[]>([]);
223-
const [search, setSearch] = useState('');
222+
const [search, setSearch] = useState("");
224223

225224
const doSearch = (search: string) => {
226225
if (!search) return;
@@ -260,17 +259,17 @@ export function Flexsearch({
260259
}
261260
const { url, title } = doc;
262261
const content = doc.display || doc.content;
263-
if (occurred[url + '@' + content]) continue;
264-
occurred[url + '@' + content] = true;
262+
if (occurred[url + "@" + content]) continue;
263+
occurred[url + "@" + content] = true;
265264
results.push({
266265
_page_rk: i,
267266
_section_rk: j,
268267
route: url,
269268
prefix: isFirstItemOfPage && (
270269
<div
271270
className={cn(
272-
'nx-mx-2.5 nx-mb-2 nx-mt-6 nx-select-none nx-border-b nx-border-black/10 nx-px-2.5 nx-pb-1.5 nx-text-xs nx-font-semibold nx-uppercase nx-text-gray-500 first:nx-mt-0 dark:nx-border-white/20 dark:nx-text-gray-300',
273-
'contrast-more:nx-border-gray-600 contrast-more:nx-text-gray-900 contrast-more:dark:nx-border-gray-50 contrast-more:dark:nx-text-gray-50'
271+
"nx-mx-2.5 nx-mb-2 nx-mt-6 nx-select-none nx-border-b nx-border-black/10 nx-px-2.5 nx-pb-1.5 nx-text-xs nx-font-semibold nx-uppercase nx-text-gray-500 first:nx-mt-0 dark:nx-border-white/20 dark:nx-text-gray-300",
272+
"contrast-more:nx-border-gray-600 contrast-more:nx-text-gray-900 contrast-more:dark:nx-border-gray-50 contrast-more:dark:nx-text-gray-50",
274273
)}
275274
>
276275
{result.doc.title}
@@ -336,9 +335,9 @@ export function Flexsearch({
336335
prefix: (
337336
<div
338337
className={cn(
339-
'nx-mx-2.5 nx-mb-2 nx-mt-6 nx-select-none nx-border-b nx-border-black/10 nx-px-2.5 nx-pb-1.5 nx-text-xs nx-font-semibold nx-uppercase nx-text-gray-500 first:nx-mt-0 dark:nx-border-white/20 dark:nx-text-gray-300',
340-
'contrast-more:nx-border-gray-600 contrast-more:nx-text-gray-900 contrast-more:dark:nx-border-gray-50 contrast-more:dark:nx-text-gray-50',
341-
'flex gap-1 items-center'
338+
"nx-mx-2.5 nx-mb-2 nx-mt-6 nx-select-none nx-border-b nx-border-black/10 nx-px-2.5 nx-pb-1.5 nx-text-xs nx-font-semibold nx-uppercase nx-text-gray-500 first:nx-mt-0 dark:nx-border-white/20 dark:nx-text-gray-300",
339+
"contrast-more:nx-border-gray-600 contrast-more:nx-text-gray-900 contrast-more:dark:nx-border-gray-50 contrast-more:dark:nx-text-gray-50",
340+
"flex gap-1 items-center",
342341
)}
343342
>
344343
AuthZed Blog <ExternalIcon className="h-4" />
@@ -374,7 +373,7 @@ export function Flexsearch({
374373
setLoading(false);
375374
}
376375
},
377-
[locale, basePath]
376+
[locale, basePath],
378377
);
379378

380379
const handleChange = async (value: string) => {

0 commit comments

Comments
 (0)