Files
andwati-nextgen/src/lib/books.ts
T
andwati 63007a1c09 Rebuild site in Tailwind to match adammaj.com layout with andwati content
- Port adammaj.com layout, sidebar and 3D bookshelf from Chakra to Tailwind v4,
  matched to measured pixel values
- Pages: About, Writing, Reading (bookshelf), Portfolio; content exported to
  markdown with YAML frontmatter, KaTeX math, callouts and YouTube embeds
- Shiki (github-light) code highlighting via rehype-pretty-code
- SEO: per-page metadata and canonicals, JSON-LD, generated OG images,
  sitemap, robots, RSS/JSON feeds, llms.txt
- Umami analytics via PUBLIC_UMAMI_SCRIPT_URL / PUBLIC_UMAMI_WEBSITE_ID
- Prettier + cspell for content, husky/lint-staged pre-commit hook
- Multi-stage Dockerfile (Node 24, pnpm, standalone output) for Dokploy
- Remove unused Chakra, emotion, framer-motion, posthog, next-seo and MDX deps
2026-09-30 12:38:09 +03:00

45 lines
975 B
TypeScript

import {
type Book,
coverExists,
formatDate,
getBooks,
spineFor,
} from "@/lib/content";
export type ShelfBook = {
slug: string;
href: string;
title: string;
coverImage?: string;
spineColor: string;
textColor: string;
};
export function getShelf(): ShelfBook[] {
return getBooks().map((b) => ({
slug: b.slug,
href: `/reading/${b.slug}`,
title: b.data.title,
coverImage: coverExists(b.data.coverImage) ? b.data.coverImage : undefined,
...spineFor(b.data.title),
}));
}
export function readLine(b: Book) {
return [
b.dateFinished && `Read: ${formatDate(b.dateFinished)}`,
b.rating && `Rating: ${b.rating}/5`,
]
.filter(Boolean)
.join(" • ");
}
export function byline(b: Book) {
const parts = [
b.authors?.length && `By: ${b.authors.join(", ")}`,
b.dateFinished && `Read: ${formatDate(b.dateFinished)}`,
b.rating && `Rating: ${b.rating}/5`,
];
return parts.filter(Boolean).join(" - ");
}