diff --git a/src/components/Header.tsx b/src/components/Header.tsx index 4cb1d13..1299c44 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -65,7 +65,7 @@ const Menu = () => { const Header = () => { const { theme, setTheme } = useTheme() return ( -
+
)} diff --git a/src/pages/about.tsx b/src/pages/about.tsx index a2c5ca9..91d7a63 100644 --- a/src/pages/about.tsx +++ b/src/pages/about.tsx @@ -2,109 +2,109 @@ import MainTemplate from "@/templates/MainTemplate" import portrait from "../images/portrait-compressed.jpg" const AboutPage = () => { - return ( - -
-

- About -

-
+ return ( + +
+

+ About +

+
-
- A portrait of the blog author -
- Pictured with the WITCH computer at the{" "} - - National Museum of Computing - - , Bletchley Park. -
-
-

- I'm a self-taught software engineer based on the south coast of England. - This blog is my technical scrapbook. I document the details of my - technical life so I can have a record of progress when I look back.{" "} -

+
+ A portrait of the blog author +
+ Pictured with the WITCH computer at the{" "} + + National Museum of Computing + + , Bletchley Park. +
+
+

+ I'm a self-taught software engineer based on the south coast of England. + This blog is my technical scrapbook. I document the details of my + technical life so I can have a record of progress when I look back.{" "} +

-

- I completed a degree in Philosophy at the University of Warwick (2009) - and hold a Postgraduate Certificate of Education (2011). -

-

- Currently I work for{" "} - - ITV - {" "} - {""} - as a backend software engineer. Before that, I worked as a full-stack - engineer at the{" "} - - BBC - {" "} - and as a frontend engineer at{" "} - - Arria NLG - {" "} - and in several web developer roles. Before software I was a - teacher.{" "} -

+

+ I completed a degree in Philosophy at the University of Warwick (2009) + and hold a Postgraduate Certificate of Education (2011). +

+

+ Currently I work for{" "} + + ITV + {" "} + {""} + as a backend software engineer. Before that, I worked as a full-stack + engineer at the{" "} + + BBC + {" "} + and as a frontend engineer at{" "} + + Arria NLG + {" "} + and in several web developer roles. Before software I was a + teacher.{" "} +

-

- Some things I like: -

    -
  • 🐶 Staffies and other bull-breeds
  • -
  • 🎼 Classical music (Haydn, Mozart, JSB)
  • -
  • 🛸 Science fiction
  • -
-

+

+ Some things I like: +

    +
  • 🐶 Staffies and other bull-breeds
  • +
  • 🎼 Classical music (Haydn, Mozart, JSB)
  • +
  • 🛸 Science fiction
  • +
+

-

- Some things I'm interested in: -

    -
  • 🧑‍💻 Self-hosting and digital resiliance
  • -
  • 🖳 The history of computing and networks
  • -
  • 🇮🇪 Irish history and culture
  • -
  • ☸️ Buddhism
  • - {/* +

    + Some things I'm interested in: +

      +
    • 🧑‍💻 Self-hosting and digital resiliance
    • +
    • 🖳 The history of computing and networks
    • +
    • 🇮🇪 Irish history and culture
    • +
    • ☸️ Buddhism
    • + {/*
    • 📡 Civil communications infrastructure
    • */} -
    -

    +
+

-

- I self-host my own Git forge at{" "} - - forgejo.systemsobscure.net - {" "} - rather than use Microsoft GitHub. You can view my personal projects - there. -

-
- ) +

+ I self-host my own Git forge at{" "} + + forgejo.systemsobscure.net + {" "} + rather than use Microsoft GitHub. You can view my personal projects + there. +

+
+ ) } export { AboutPage } diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 5c2550d..ad1d6c9 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -9,14 +9,25 @@ const HomePage = () => { const { posts } = usePosts() return ( - +
+

+ Another software engineer with a blog +

+

+ I'm a self-taught software engineer currently working at ITV, + previously at the BBC. This blog is a technical scrapbook and digital + garden. +

+
+ {/* + -

- Another software engineer with a blog +

+ Another software engineer with a blog!

-

+

I'm a self-taught software engineer currently working at ITV, previously at the BBC. This blog is a technical scrapbook and digital garden. @@ -28,6 +39,13 @@ const HomePage = () => { + + + + + */} { - const { page } = useParams() + const { page } = useParams() - const navigate = useNavigate() + const navigate = useNavigate() - const { posts } = usePosts() - const postsPerPage = 10 + const { posts } = usePosts() + const postsPerPage = 8 - const currentPage = Number(page) || 1 - const totalPages = Math.ceil(posts.length / postsPerPage) + const currentPage = Number(page) || 1 + const totalPages = Math.ceil(posts.length / postsPerPage) - useEffect(() => { - if (currentPage < 1 || currentPage > totalPages) { - navigate(`/posts/page/1`, { replace: true }) - } - }, [currentPage, totalPages, navigate]) + useEffect(() => { + // Only redirect if we have posts and the page is definitively invalid + if (totalPages > 0 && (currentPage < 1 || currentPage > totalPages)) { + navigate(`/posts/page/1`, { replace: true }) + } + }, [currentPage, totalPages, navigate]) - const currentPosts = useMemo(() => { - const startIndex = (currentPage - 1) * postsPerPage - const endIndex = startIndex + postsPerPage - return posts.slice(startIndex, endIndex) - }, [posts, currentPage, postsPerPage]) + const currentPosts = useMemo(() => { + const startIndex = (currentPage - 1) * postsPerPage + const endIndex = startIndex + postsPerPage + return posts.slice(startIndex, endIndex) + }, [posts, currentPage, postsPerPage]) - const hasNextPage = currentPage < totalPages - const hasPrevPage = currentPage > 1 + const hasNextPage = currentPage < totalPages + const hasPrevPage = currentPage > 1 - const goToNextPage = () => { - if (hasNextPage) { - navigate(`/posts/page/${currentPage + 1}`) - } - } + const goToNextPage = () => { + if (hasNextPage) { + navigate(`/posts/page/${currentPage + 1}`) + } + } - const goToPrevPage = () => { - if (hasPrevPage) { - navigate(`/posts/page/${currentPage - 1}`) - } - } + const goToPrevPage = () => { + if (hasPrevPage) { + navigate(`/posts/page/${currentPage - 1}`) + } + } - return ( - -

-

- All posts -

-
-
-
- {currentPosts.map((post) => ( - - - - - {post.title} - - -
- {convertDate(post.date)} -
- {post.tags.map((tag, i) => ( - { - e.preventDefault() - e.stopPropagation() - navigate(`/tags/${tag}`) - }} - > - {tag} - - ))} -
-
-
-
-
- - ))} -
- - - - - - - - - - -
-
- ) + return ( + +
+

+ All posts +

+
+
+
+ {currentPosts.map((post) => ( + + + + + {post.title} + + +
+ {convertDate(post.date)} +
+ {post.tags.map((tag, i) => ( + { + e.preventDefault() + e.stopPropagation() + navigate(`/tags/${tag}`) + }} + > + {tag} + + ))} +
+
+
+
+
+ + ))} +
+ + + + + + + + + + +
+
+ ) } export { PostsPage } diff --git a/src/templates/BlogTemplate.tsx b/src/templates/BlogTemplate.tsx index 8c002b4..8f6122b 100644 --- a/src/templates/BlogTemplate.tsx +++ b/src/templates/BlogTemplate.tsx @@ -37,10 +37,10 @@ const BlogTemplate = () => {