Skip to content

Commit 70ae57c

Browse files
authored
Merge pull request #935 from hirosystems/develop
Release 2.5.0
2 parents 1f230b8 + 19a30de commit 70ae57c

Some content is hidden

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

59 files changed

+2691
-229
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
node_modules
22
.env
3+
.env.local
34
.next
45
bun.lockb
56
openapi
67
.DS_Store
78
**/.DS_Store
89
tmp
9-
prompt.txt
10+
.cursorrules

app/(docs)/layout.client.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -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 mb-3 transition-colors">
102+
<div className="group flex flex-row items-center gap-2 rounded-lg px-2 mb-4 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

+11-17
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Body, NavChildren, SidebarBanner } from "./layout.client";
77
import { Statuspage } from "statuspage.io";
88

99
const statuspage = new Statuspage("3111l89394q4");
10-
console.log({ status: await statuspage.api.getStatus() });
10+
// console.log({ status: await statuspage.api.getStatus() });
1111

1212
export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
1313
tree: utils.pageTree,
@@ -21,10 +21,7 @@ export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
2121
href: "https://platform.hiro.so/",
2222
icon: (
2323
<div className="flex items-center gap-1 bg-secondary p-1.5 rounded-md">
24-
<span className="ml-2 font-semibold max-md:hidden">
25-
Hiro Platform
26-
</span>
27-
<ArrowUpRight />
24+
<span className="font-semibold max-md:hidden">Hiro Platform</span>
2825
</div>
2926
),
3027
external: true,
@@ -36,10 +33,10 @@ export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
3633
text: "Guides",
3734
url: "/guides",
3835
},
39-
// {
40-
// text: "Cookbook",
41-
// url: "/cookbook",
42-
// },
36+
{
37+
text: "Cookbook",
38+
url: "/cookbook",
39+
},
4340
],
4441
sidebar: {
4542
defaultOpenLevel: 0,
@@ -59,10 +56,7 @@ export const homeLayoutOptions: Omit<DocsLayoutProps, "children"> = {
5956
href: "https://platform.hiro.so/",
6057
icon: (
6158
<div className="flex items-center gap-1 bg-secondary p-1.5 rounded-md">
62-
<span className="ml-2 font-semibold max-md:hidden">
63-
Hiro Platform
64-
</span>
65-
<ArrowUpRight />
59+
<span className="font-semibold max-md:hidden">Hiro Platform</span>
6660
</div>
6761
),
6862
external: true,
@@ -74,10 +68,10 @@ export const homeLayoutOptions: Omit<DocsLayoutProps, "children"> = {
7468
text: "Guides",
7569
url: "/guides",
7670
},
77-
// {
78-
// text: "Cookbook",
79-
// url: "/cookbook",
80-
// },
71+
{
72+
text: "Cookbook",
73+
url: "/cookbook",
74+
},
8175
],
8276
};
8377

app/cookbook/[id]/page.tsx

+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
import { Code } from "@/components/docskit/code";
2+
import { loadRecipes } from "@/utils/loader";
3+
import { Badge } from "@/components/ui/badge";
4+
import { HoverProvider } from "@/context/hover";
5+
import { HoverLink } from "@/components/docskit/annotations/hover";
6+
import { Terminal } from "@/components/docskit/terminal";
7+
import { InlineCode } from "@/components/docskit/inline-code";
8+
import { WithNotes } from "@/components/docskit/notes";
9+
import { SnippetResult } from "../components/snippet-result";
10+
import Link from "next/link";
11+
import { RecipeCarousel } from "@/components/recipe-carousel";
12+
import { MoveLeft } from "lucide-react";
13+
import {
14+
Accordion,
15+
AccordionContent,
16+
AccordionItem,
17+
AccordionTrigger,
18+
} from "@/components/ui/accordion";
19+
20+
interface Param {
21+
id: string;
22+
}
23+
24+
export const dynamicParams = false;
25+
26+
export default async function Page({
27+
params,
28+
}: {
29+
params: Param;
30+
}): Promise<JSX.Element> {
31+
const { id } = params;
32+
const recipes = await loadRecipes();
33+
const recipe = recipes.find((r) => r.id === id);
34+
35+
if (!recipe) {
36+
return <div>Recipe not found</div>;
37+
}
38+
39+
// Dynamically import MDX content based on recipe id
40+
const Content = await import(`@/content/_recipes/guides/${id}.mdx`).catch(
41+
() => {
42+
console.error(`Failed to load MDX content for recipe: ${id}`);
43+
return { default: () => <div>Content not found</div> };
44+
}
45+
);
46+
47+
return (
48+
<>
49+
<HoverProvider>
50+
<div className="min-h-screen flex flex-col">
51+
<div className="space-y-2 flex-grow">
52+
<div className="px-4">
53+
<Link
54+
href="/cookbook"
55+
className="inline-flex items-center text-sm text-muted-foreground hover:text-foreground mb-4"
56+
>
57+
<MoveLeft size={32} />
58+
</Link>
59+
</div>
60+
<div className="px-4">
61+
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-12">
62+
<div className="col-span-full lg:col-span-6 lg:order-1">
63+
<div className="block lg:hidden">
64+
<Accordion type="single" collapsible>
65+
<AccordionItem value="content">
66+
<AccordionTrigger className="text-xl font-semibold">
67+
{recipe.title}
68+
</AccordionTrigger>
69+
<AccordionContent>
70+
<div className="space-y-3">
71+
<div className="flex flex-wrap gap-2 uppercase">
72+
{recipe.categories.map((category) => (
73+
<Badge key={category} variant="secondary">
74+
{category}
75+
</Badge>
76+
))}
77+
</div>
78+
<div className="prose max-w-none">
79+
<Content.default
80+
components={{
81+
HoverLink,
82+
Terminal,
83+
Code,
84+
InlineCode,
85+
WithNotes,
86+
}}
87+
/>
88+
</div>
89+
</div>
90+
</AccordionContent>
91+
</AccordionItem>
92+
</Accordion>
93+
</div>
94+
95+
<div className="hidden lg:block space-y-3">
96+
<div className="flex flex-wrap gap-2 uppercase">
97+
{recipe.categories.map((category) => (
98+
<Badge key={category} variant="secondary">
99+
{category}
100+
</Badge>
101+
))}
102+
</div>
103+
<div className="prose max-w-none">
104+
<Content.default
105+
components={{
106+
HoverLink,
107+
Terminal,
108+
Code,
109+
InlineCode,
110+
WithNotes,
111+
}}
112+
/>
113+
</div>
114+
</div>
115+
</div>
116+
117+
<div className="col-span-full lg:col-span-6 lg:order-2">
118+
<div className="lg:sticky lg:top-20 space-y-4">
119+
<div className="recipe group relative w-full overflow-hidden">
120+
<Code
121+
codeblocks={[
122+
{
123+
lang: recipe.files[0].type,
124+
value: recipe.files[0].content,
125+
meta: `${recipe.files[0].name} -cn`,
126+
},
127+
]}
128+
/>
129+
</div>
130+
<SnippetResult
131+
recipe={recipe}
132+
code={recipe.files[0].content as string}
133+
type={recipe.files[0].type}
134+
dependencies={{}}
135+
/>
136+
</div>
137+
</div>
138+
</div>
139+
</div>
140+
</div>
141+
142+
<div className="mt-0 md:mt-16">
143+
<RecipeCarousel currentRecipeId={id} data={recipes} />
144+
</div>
145+
</div>
146+
</HoverProvider>
147+
</>
148+
);
149+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Code } from "@/components/docskit/code";
2+
3+
interface CodeResultProps {
4+
result: string;
5+
}
6+
7+
export function CodeResult({ result }: CodeResultProps) {
8+
return (
9+
<Code
10+
codeblocks={[
11+
{
12+
lang: "bash",
13+
value: result,
14+
meta: `-nw`,
15+
},
16+
]}
17+
/>
18+
);
19+
}

0 commit comments

Comments
 (0)