import { useMemo } from "react"; import { createFileRoute, Link } from "@tanstack/react-router"; import { getPosts, formatDate } from "~/posts"; import { pageMeta } from "~/meta"; interface BlogSearch { drafts?: true; } export const Route = createFileRoute("/blog/")({ validateSearch: (search: Record): BlogSearch => { const drafts = search.drafts === true || search.drafts === "" || search.drafts === "true"; return drafts ? { drafts: true } : {}; }, head: () => pageMeta( "Blog – Updates and announcements from the Paseo team", "Product updates, technical posts, and announcements from the Paseo team. Notes on building a self-hosted, multi-agent dev environment for your phone.", "/blog", ), component: BlogIndex, }); interface PostRowProps { slug: string; title: string; date: string; draft?: boolean; } function PostRow({ slug, title, date, draft }: PostRowProps) { const params = useMemo(() => ({ _splat: slug }), [slug]); return (
{formatDate(new Date(date))} {title} {draft && ( DRAFT )}
); } function BlogIndex() { const { drafts } = Route.useSearch(); const posts = getPosts(drafts === true); return (
{drafts && (

Showing draft posts

)}
{posts.map(({ slug, frontmatter }) => ( ))} {posts.length === 0 &&

No posts yet.

}
); }