Skip to content

Commit

Permalink
Merge pull request #935 from hirosystems/develop
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
ryanwaits authored Jan 17, 2025
2 parents 1f230b8 + 19a30de commit 70ae57c
Show file tree
Hide file tree
Showing 59 changed files with 2,691 additions and 229 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
node_modules
.env
.env.local
.next
bun.lockb
openapi
.DS_Store
**/.DS_Store
tmp
prompt.txt
.cursorrules
2 changes: 1 addition & 1 deletion app/(docs)/layout.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function SidebarBanner(): JSX.Element {

return (
<Link key={currentMode.param} href={`/${currentMode.param}`}>
<div className="group flex flex-row items-center gap-2 rounded-lg px-2 mb-3 transition-colors">
<div className="group flex flex-row items-center gap-2 rounded-lg px-2 mb-4 transition-colors">
<ChevronLeft className="text-muted-foreground size-4 shrink-0 rounded-md group-hover:text-primary" />
<div>
<p className="text-muted-foreground group-hover:text-primary">Back</p>
Expand Down
28 changes: 11 additions & 17 deletions app/(docs)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Body, NavChildren, SidebarBanner } from "./layout.client";
import { Statuspage } from "statuspage.io";

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

export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
tree: utils.pageTree,
Expand All @@ -21,10 +21,7 @@ export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
href: "https://platform.hiro.so/",
icon: (
<div className="flex items-center gap-1 bg-secondary p-1.5 rounded-md">
<span className="ml-2 font-semibold max-md:hidden">
Hiro Platform
</span>
<ArrowUpRight />
<span className="font-semibold max-md:hidden">Hiro Platform</span>
</div>
),
external: true,
Expand All @@ -36,10 +33,10 @@ export const layoutOptions: Omit<DocsLayoutProps, "children"> = {
text: "Guides",
url: "/guides",
},
// {
// text: "Cookbook",
// url: "/cookbook",
// },
{
text: "Cookbook",
url: "/cookbook",
},
],
sidebar: {
defaultOpenLevel: 0,
Expand All @@ -59,10 +56,7 @@ export const homeLayoutOptions: Omit<DocsLayoutProps, "children"> = {
href: "https://platform.hiro.so/",
icon: (
<div className="flex items-center gap-1 bg-secondary p-1.5 rounded-md">
<span className="ml-2 font-semibold max-md:hidden">
Hiro Platform
</span>
<ArrowUpRight />
<span className="font-semibold max-md:hidden">Hiro Platform</span>
</div>
),
external: true,
Expand All @@ -74,10 +68,10 @@ export const homeLayoutOptions: Omit<DocsLayoutProps, "children"> = {
text: "Guides",
url: "/guides",
},
// {
// text: "Cookbook",
// url: "/cookbook",
// },
{
text: "Cookbook",
url: "/cookbook",
},
],
};

Expand Down
149 changes: 149 additions & 0 deletions app/cookbook/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import { Code } from "@/components/docskit/code";
import { loadRecipes } from "@/utils/loader";
import { Badge } from "@/components/ui/badge";
import { HoverProvider } from "@/context/hover";
import { HoverLink } from "@/components/docskit/annotations/hover";
import { Terminal } from "@/components/docskit/terminal";
import { InlineCode } from "@/components/docskit/inline-code";
import { WithNotes } from "@/components/docskit/notes";
import { SnippetResult } from "../components/snippet-result";
import Link from "next/link";
import { RecipeCarousel } from "@/components/recipe-carousel";
import { MoveLeft } from "lucide-react";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";

interface Param {
id: string;
}

export const dynamicParams = false;

export default async function Page({
params,
}: {
params: Param;
}): Promise<JSX.Element> {
const { id } = params;
const recipes = await loadRecipes();
const recipe = recipes.find((r) => r.id === id);

if (!recipe) {
return <div>Recipe not found</div>;
}

// Dynamically import MDX content based on recipe id
const Content = await import(`@/content/_recipes/guides/${id}.mdx`).catch(
() => {
console.error(`Failed to load MDX content for recipe: ${id}`);
return { default: () => <div>Content not found</div> };
}
);

return (
<>
<HoverProvider>
<div className="min-h-screen flex flex-col">
<div className="space-y-2 flex-grow">
<div className="px-4">
<Link
href="/cookbook"
className="inline-flex items-center text-sm text-muted-foreground hover:text-foreground mb-4"
>
<MoveLeft size={32} />
</Link>
</div>
<div className="px-4">
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 lg:gap-12">
<div className="col-span-full lg:col-span-6 lg:order-1">
<div className="block lg:hidden">
<Accordion type="single" collapsible>
<AccordionItem value="content">
<AccordionTrigger className="text-xl font-semibold">
{recipe.title}
</AccordionTrigger>
<AccordionContent>
<div className="space-y-3">
<div className="flex flex-wrap gap-2 uppercase">
{recipe.categories.map((category) => (
<Badge key={category} variant="secondary">
{category}
</Badge>
))}
</div>
<div className="prose max-w-none">
<Content.default
components={{
HoverLink,
Terminal,
Code,
InlineCode,
WithNotes,
}}
/>
</div>
</div>
</AccordionContent>
</AccordionItem>
</Accordion>
</div>

<div className="hidden lg:block space-y-3">
<div className="flex flex-wrap gap-2 uppercase">
{recipe.categories.map((category) => (
<Badge key={category} variant="secondary">
{category}
</Badge>
))}
</div>
<div className="prose max-w-none">
<Content.default
components={{
HoverLink,
Terminal,
Code,
InlineCode,
WithNotes,
}}
/>
</div>
</div>
</div>

<div className="col-span-full lg:col-span-6 lg:order-2">
<div className="lg:sticky lg:top-20 space-y-4">
<div className="recipe group relative w-full overflow-hidden">
<Code
codeblocks={[
{
lang: recipe.files[0].type,
value: recipe.files[0].content,
meta: `${recipe.files[0].name} -cn`,
},
]}
/>
</div>
<SnippetResult
recipe={recipe}
code={recipe.files[0].content as string}
type={recipe.files[0].type}
dependencies={{}}
/>
</div>
</div>
</div>
</div>
</div>

<div className="mt-0 md:mt-16">
<RecipeCarousel currentRecipeId={id} data={recipes} />
</div>
</div>
</HoverProvider>
</>
);
}
19 changes: 19 additions & 0 deletions app/cookbook/components/code-result.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Code } from "@/components/docskit/code";

interface CodeResultProps {
result: string;
}

export function CodeResult({ result }: CodeResultProps) {
return (
<Code
codeblocks={[
{
lang: "bash",
value: result,
meta: `-nw`,
},
]}
/>
);
}
Loading

0 comments on commit 70ae57c

Please sign in to comment.