feat: tweaks; improve posts ux

This commit is contained in:
Aaron Yarborough 2025-05-04 17:42:13 +01:00
parent 07b5a7438c
commit f765c692af
8 changed files with 15 additions and 49 deletions

View file

@ -1,6 +1,6 @@
{
"name": "www-aaronjy-me",
"version": "2.1.1",
"version": "2.1.2",
"private": true,
"type": "module",
"lint-staged": {

View file

@ -17,10 +17,9 @@ function BookReview({ review, html }) {
return (
<>
<h1>
{title}
<br />
<small>by {author}</small>
{title} <small>- {author}</small>
</h1>
<Link href="./">Back...</Link>
<article>

View file

@ -19,10 +19,6 @@ function Footer() {
<a href="/static/pgp.txt">PGP key</a>
</span>
{", "}
<span>
<a href="mailto:me@aaronjy.me">Send me an email</a>
</span>
{", "}
<span>
<a
href="https://git.aaronjy.me/aaron/aaronjy-me"

View file

@ -3,23 +3,15 @@ import Link from "next/link";
export default function StaticContentList({ entries, urlPrefix, max = 0 }) {
return (
<table>
<tbody>
{entries
.map((e) => (
<tr key={e.slug}>
<td>
{!!e.datePublished && (
<span>{formatDate(e.datePublished)}</span>
)}
</td>
<td>
<Link href={`${urlPrefix}${e.slug}`}>{e.title}</Link>
</td>
</tr>
))
.slice(0, max > 0 ? max : entries.length)}
</tbody>
</table>
<div>
{entries
.map((e) => (
<p key={e.slug}>
<Link href={`${urlPrefix}${e.slug}`}>{e.title}</Link>{" "}
{!!e.datePublished && <i>{`on ${formatDate(e.datePublished)}`}</i>}
</p>
))
.slice(0, max > 0 ? max : entries.length)}
</div>
);
}

View file

@ -11,7 +11,6 @@ import { NextSeo } from "next-seo";
export async function getServerSideProps({ params }) {
const { path } = params;
console.log(params);
const res = await fetchBasicPages([], {
path: {
_eq: path?.join("/") ?? null,

View file

@ -16,7 +16,7 @@ export async function getServerSideProps() {
}
const reviews = (await res.json()).data.sort(
(a, b) => new Date(b.read_date).getTime() - new Date(a.read_date).getTime(),
(a, b) => new Date(b.readDate).getTime() - new Date(a.readDate).getTime(),
);
return {

View file

@ -4,27 +4,6 @@ import Article from "@/components/Article/Article";
import { fetchPosts, markdownToHtml } from "@/services/content-service";
import { FailedFetchPostError, FailedFetchPostsError } from "@/errors";
// export async function getStaticPaths () {
// const res = await fetchPosts(['slug'], {
// status: 'published'
// })
// if (!res.ok) {
// throw new FailedFetchPostsError(await res.text())
// }
// const posts = (await res.json()).data
// return {
// paths: posts.map(post => ({
// params: {
// slug: post.slug
// }
// })),
// fallback: true // false or "blocking"
// }
// }
export const getServerSideProps = async ({ params }) => {
const { slug } = params;
const res = await fetchPosts([], {

View file

@ -15,6 +15,7 @@ export const getServerSideProps = async () => {
}
const json = await res.json();
const posts = json.data.sort(
(a, b) =>
new Date(b.datePublished).getTime() - new Date(a.datePublished).getTime(),