Skip to content

Commit d0d5621

Browse files
authored
Merge pull request #802 from hirosystems/develop
v2.4.0
2 parents e803e21 + 993bb02 commit d0d5621

File tree

345 files changed

+7313
-3481
lines changed

Some content is hidden

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

345 files changed

+7313
-3481
lines changed

.eslintrc.cjs

-6
This file was deleted.

.eslintrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": ["next/core-web-vitals", "next/typescript"],
3+
"rules": {
4+
"@typescript-eslint/no-explicit-any": "off"
5+
}
6+
}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ bun.lockb
55
openapi
66
.DS_Store
77
**/.DS_Store
8-
tmp
8+
tmp
9+
prompt.txt

app/(docs)/[...slug]/page.tsx

+10-109
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ExternalLinkIcon } from "lucide-react";
21
import type { Metadata } from "next";
32
import { Card, Cards } from "fumadocs-ui/components/card";
43
import { RollButton } from "fumadocs-ui/components/roll-button";
@@ -18,69 +17,6 @@ export default function Page({ params }: { params: Param }): JSX.Element {
1817

1918
if (!page) notFound();
2019

21-
// TODO: this is a less than ideal solution for creating different titles between sidebar and page
22-
const generatePrefix = (page: any) => {
23-
// Mapping of words to their desired capitalization forms
24-
const specialCases = {
25-
api: "API",
26-
sdk: "SDK",
27-
connect: "Stacks Connect",
28-
platform: "Hiro Platform",
29-
hacks: "Hiro Hacks",
30-
"clarinet-js-sdk": "Clarinet JS SDK",
31-
"platform-api": "Platform API",
32-
"rpc-api": "Stacks Node RPC",
33-
};
34-
35-
if (page.file?.name === "index" && page.slugs[1]) {
36-
const segment = page.slugs[1];
37-
let prefix =
38-
specialCases[segment.toLowerCase() as keyof typeof specialCases] ||
39-
segment.charAt(0).toUpperCase() + segment.slice(1);
40-
41-
// Check if there is a second segment and append it
42-
if (page.slugs[2] && page.slugs[1].toLowerCase() !== "api") {
43-
const secondSegment = page.slugs[2];
44-
prefix +=
45-
" " +
46-
(specialCases[
47-
secondSegment.toLowerCase() as keyof typeof specialCases
48-
] || secondSegment.charAt(0).toUpperCase() + secondSegment.slice(1));
49-
}
50-
51-
if (page.slugs[1].toLowerCase() === "platform-api") {
52-
prefix = "Platform API";
53-
}
54-
55-
if (page.slugs[1].toLowerCase() === "token-metadata-api") {
56-
prefix = "Token Metadata API";
57-
}
58-
59-
if (page.slugs[1].toLowerCase() === "rpc-api") {
60-
prefix = "Stacks Node RPC API";
61-
}
62-
63-
return prefix;
64-
} else if (["overview", "index"].includes(page.file?.name)) {
65-
const pathSegments = page.file.dirname.split("/");
66-
if (pathSegments.length >= 2) {
67-
const relevantSegments = pathSegments.slice(-2); // Get the last two segments
68-
69-
return relevantSegments
70-
.map(
71-
(segment: string) =>
72-
specialCases[
73-
segment.toLowerCase() as keyof typeof specialCases
74-
] || segment.charAt(0).toUpperCase() + segment.slice(1) // Capitalize the first letter
75-
)
76-
.join(" "); // Join them with a space
77-
}
78-
}
79-
return "";
80-
};
81-
82-
const prefix = generatePrefix(page);
83-
8420
return (
8521
<DocsPage
8622
toc={page.data.exports.toc}
@@ -90,15 +26,18 @@ export default function Page({ params }: { params: Param }): JSX.Element {
9026
>
9127
<RollButton />
9228
{page.data.title !== "Home" && (
93-
<h1 className="text-3xl font-bold text-foreground sm:text-4xl">
94-
{prefix} {page.data.title}
29+
<h1 className="text-2xl text-foreground sm:text-3xl">
30+
{page.data.title}
9531
</h1>
9632
)}
9733
{page.data.title !== "Home" && (
9834
<p className="mb-8 text-lg text-muted-foreground">
9935
{page.data.description}
10036
</p>
10137
)}
38+
{page.data.title !== "Home" && (
39+
<hr className="border-t border-border/50" />
40+
)}
10241
<DocsBody>
10342
{page.data.index ? (
10443
<Category page={page} />
@@ -165,50 +104,12 @@ const metadata: Metadata = {
165104
},
166105
};
167106

168-
function generateCustomTitle(file: {
169-
flattenedPath: string;
170-
name: string;
171-
}): string {
172-
const segments = file.flattenedPath.split("/");
173-
const isRootLevelSegment = segments.length === 3;
174-
let relevantSegments: string[] = [];
175-
176-
if (isRootLevelSegment) {
177-
relevantSegments = [segments[1]];
178-
}
179-
180-
return (
181-
relevantSegments[0]?.charAt(0)?.toUpperCase() +
182-
relevantSegments[0]?.slice(1)
183-
);
184-
}
185-
186-
export function generateMetadata({ params }: { params: Param }): Metadata {
107+
export async function generateMetadata(props: {
108+
params: Promise<{ slug?: string[] }>;
109+
}) {
110+
const params = await props.params;
187111
const page = utils.getPage(params.slug);
188-
189112
if (!page) notFound();
190113

191-
const description =
192-
page.data.description ??
193-
"All the developer docs, guides and resources you need to build on Bitcoin layers.";
194-
195-
const imageParams = new URLSearchParams();
196-
imageParams.set("title", page.data.title);
197-
imageParams.set("description", description);
198-
199-
const customTitle = generateCustomTitle(page.file);
200-
201-
return createMetadata({
202-
...metadata,
203-
title: customTitle.length
204-
? `${customTitle} ${page.data.title}`
205-
: page.data.title,
206-
description,
207-
});
208-
}
209-
210-
export function generateStaticParams(): Param[] {
211-
return utils.getPages().map<Param>((page) => ({
212-
slug: page.slugs,
213-
}));
114+
return metadata;
214115
}

app/(docs)/layout.client.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
44
import Link from "next/link";
55
import { useParams, usePathname } from "next/navigation";
66
import type { ReactNode } from "react";
7-
import { cn } from "@/utils/cn";
7+
import { cn } from "@/lib/utils";
88
import { modes } from "@/utils/modes";
99
import { ChevronLeft } from "lucide-react";
1010

@@ -15,7 +15,7 @@ const itemVariants = cva(
1515
{
1616
variants: {
1717
active: {
18-
true: "text-accent-foreground",
18+
true: "text-accent-foreground pointer-events-none",
1919
},
2020
mode: {
2121
bitcoin: "bg-hiro",
@@ -31,7 +31,7 @@ const itemVariants = cva(
3131
{
3232
active: true,
3333
mode: "stacks",
34-
className: "bg-background",
34+
className: "bg-inverted text-background",
3535
},
3636
],
3737
}
@@ -99,7 +99,7 @@ export function SidebarBanner(): JSX.Element {
9999

100100
return (
101101
<Link key={currentMode.param} href={`/${currentMode.param}`}>
102-
<div className="group flex flex-row items-center gap-2 rounded-lg px-2 transition-colors">
102+
<div className="group flex flex-row items-center gap-2 rounded-lg px-2 mb-3 transition-colors">
103103
<ChevronLeft className="text-muted-foreground size-4 shrink-0 rounded-md group-hover:text-primary" />
104104
<div>
105105
<p className="text-muted-foreground group-hover:text-primary">Back</p>

app/(docs)/layout.tsx

+24-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { ArrowUpRight } from "lucide-react";
44
import { utils } from "@/utils/source";
55
import { DocsLogo } from "@/components/ui/icon";
66
import { Body, NavChildren, SidebarBanner } from "./layout.client";
7+
import { Statuspage } from "statuspage.io";
8+
9+
const statuspage = new Statuspage("3111l89394q4");
10+
console.log({ status: await statuspage.api.getStatus() });
711

812
export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
913
tree: utils.pageTree,
@@ -27,7 +31,16 @@ export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
2731
},
2832
],
2933
},
30-
links: [],
34+
links: [
35+
{
36+
text: "Guides",
37+
url: "/guides",
38+
},
39+
{
40+
text: "Cookbook",
41+
url: "/cookbook",
42+
},
43+
],
3144
sidebar: {
3245
defaultOpenLevel: 0,
3346
banner: <SidebarBanner />,
@@ -56,7 +69,16 @@ export const homeLayoutOptions: Omit<DocsLayoutProps, "children"> = {
5669
},
5770
],
5871
},
59-
links: [],
72+
links: [
73+
{
74+
text: "Guides",
75+
url: "/guides",
76+
},
77+
{
78+
text: "Cookbook",
79+
url: "/cookbook",
80+
},
81+
],
6082
};
6183

6284
export default function Layout({

app/(home)/docs/page.tsx

-78
This file was deleted.

app/(home)/layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function HomeLayout({
88
children: ReactNode;
99
}): JSX.Element {
1010
return (
11-
<div className="max-w-7xl mx-auto *:border-none">
11+
<div className="px-10 *:border-none">
1212
<Layout {...homeLayoutOptions}>{children}</Layout>
1313
</div>
1414
);

0 commit comments

Comments
 (0)