-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #935 from hirosystems/develop
Release 2.5.0
- Loading branch information
Showing
59 changed files
with
2,691 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`, | ||
}, | ||
]} | ||
/> | ||
); | ||
} |
Oops, something went wrong.