diff --git a/apps/web/src/components/integration-guide.tsx b/apps/web/src/components/integration-guide.tsx new file mode 100644 index 0000000..2b43f7d --- /dev/null +++ b/apps/web/src/components/integration-guide.tsx @@ -0,0 +1,57 @@ +import { Info } from "lucide-react"; +import { CodeBlock } from "./CodeBlock"; + +export function IntegrationGuide({ blogId }: { blogId: string }) { + return ( + <> +
+

Integration guide

+

First, install the zendo client

+ {`npm install zenblog`} + +

Next, store your blog id as an environment variable

+ + + {`BLOG_ID=${blogId}`} + + +

+ + Avoid making your blog id public. You should store it in a secure way. +

+ +

Now, create a client with your blog id

+ + + {`import { createZenblogClient } from "zenblog"; + +const cms = createZenblogClient({ + blogId: process.env.BLOG_ID, +});`} + + +

Use the client to fetch posts and render them on your website.

+ + {`import { cms } from "../lib/cms"; +import Link from "next/link"; + +const posts = await cms.posts.list(); + +return
+ {posts.map((post) => + + {post.title} + + )} +
`} +
+ +

That's it! 👏 Your blog page is ready.

+

Next, you should learn how to render the posts content.

+
+ + ); +} diff --git a/apps/web/src/components/ui/button.tsx b/apps/web/src/components/ui/button.tsx index ee71d9b..e4e2d7b 100644 --- a/apps/web/src/components/ui/button.tsx +++ b/apps/web/src/components/ui/button.tsx @@ -14,11 +14,11 @@ const buttonVariants = cva( destructive: "bg-red-500 text-zinc-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-zinc-50 dark:hover:bg-red-900/90", outline: - "border border-b-2 border-zinc-200 bg-white hover:bg-zinc-100 hover:text-zinc-900 dark:border-zinc-800 dark:bg-zinc-950 dark:hover:bg-zinc-800 dark:hover:text-zinc-50", + "border border-b-2 border-zinc-200 bg-white hover:bg-zinc-100 hover:text-zinc-900 dark:border-zinc-800 dark:bg-zinc-950 dark:hover:bg-zinc-800 text-zinc-600 dark:hover:text-zinc-50", secondary: - "bg-zinc-100 text-zinc-700 hover:bg-orange-100/70 hover:text-orange-600 dark:bg-zinc-800 dark:text-zinc-50 dark:hover:bg-zinc-800/80", + "bg-zinc-100 hover:bg-orange-100/70 hover:text-orange-600 dark:bg-zinc-800 dark:text-zinc-50 dark:hover:bg-zinc-800/80 text-zinc-600", ghost: - "hover:bg-zinc-100 hover:text-zinc-900 dark:hover:bg-zinc-800 dark:hover:text-zinc-50", + "hover:bg-zinc-100 hover:text-zinc-900 dark:hover:bg-zinc-800 dark:hover:text-zinc-50 text-zinc-600", link: "text-zinc-800 underline-offset-4 hover:underline dark:text-zinc-50", }, size: { diff --git a/apps/web/src/pages/blogs/[blogId]/posts.tsx b/apps/web/src/pages/blogs/[blogId]/posts.tsx index 609a1f2..07b1b30 100644 --- a/apps/web/src/pages/blogs/[blogId]/posts.tsx +++ b/apps/web/src/pages/blogs/[blogId]/posts.tsx @@ -5,6 +5,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import Link from "next/link"; import { Button } from "@/components/ui/button"; import { + CodeIcon, ImageOff, MoreVertical, Pen, @@ -47,6 +48,7 @@ import { ImageUploader } from "@/components/Images/ImageUploader"; import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; import { usePostViewsQuery } from "@/queries/analytics"; import { on } from "events"; +import { IntegrationGuide } from "@/components/integration-guide"; export function StatePill({ published }: { published: boolean }) { const text = published ? "Published" : "Draft"; @@ -150,16 +152,26 @@ export default function BlogPosts() { Tags -
- + + + + + +
diff --git a/apps/web/src/pages/blogs/[blogId]/settings.tsx b/apps/web/src/pages/blogs/[blogId]/settings.tsx index 0db6740..76a6782 100644 --- a/apps/web/src/pages/blogs/[blogId]/settings.tsx +++ b/apps/web/src/pages/blogs/[blogId]/settings.tsx @@ -180,58 +180,6 @@ export default function BlogSettings() { -
-

Integration guide

-

First, install the zendo client

- {`npm install zenblog`} - -

Next, store your blog id as an environment variable

- - - {`BLOG_ID=${blog.id}`} - - -

- - Avoid making your blog id public. You should store it in a secure - way. -

- -

Now, create a client with your blog id

- - - {`import { createZenblogClient } from "zenblog"; - -const cms = createZenblogClient({ - blogId: process.env.BLOG_ID, -});`} - - -

- Use the client to fetch posts and render them on your website. -

- - {`import { cms } from "../lib/cms"; -import Link from "next/link"; - -const posts = await cms.posts.list(); - -return
- {posts.map((post) => - - {post.title} - - )} -
`} -
- -

That's it! 👏 Your blog page is ready.

-

Next, you should learn how to render the posts content.

-
-

diff --git a/todo/mvp.md b/todo/mvp.md index 61490b9..1d92fc2 100644 --- a/todo/mvp.md +++ b/todo/mvp.md @@ -2,12 +2,15 @@ ## Backlog -- [] Removing tags doesnt work -- [] Published_date +- [x] Removing tags doesnt work +- [x] Published_date - [] FAQ on homepage? -- [] Update README +- [x] Update README - [] Homepage use cases examples: personal blog, docs, careers page, product listing pages, help center, changelogs, directory websites, etc. - [] email provider +- [] Integration guide tab +- [] Slash commands in editor (like notion or craft) +- [] Improve tag picker ## Pricing @@ -29,12 +32,12 @@ ## Tags -- [] Delete tag -- [] Update tag +- [x] Delete tag +- [x] Update tag ## Media -- [] CRUD media from media tab in blog view +- [x] CRUD media from media tab in blog view ## Docs @@ -55,4 +58,5 @@ - Prevent users from leaving the page when they have unsaved changes - Save posts/create in localstorage so its not lost when you reload the page goddammit -- Apple pay +- Apple pay? +- Stripe link?