feat: tweaks; improve posts ux
This commit is contained in:
parent
07b5a7438c
commit
f765c692af
8 changed files with 15 additions and 49 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "www-aaronjy-me",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"lint-staged": {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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([], {
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Add table
Reference in a new issue