Skip to content

Commit 207b4ea

Browse files
committed
fix: blogpost pages
1 parent 4e7807c commit 207b4ea

File tree

9 files changed

+19
-29
lines changed

9 files changed

+19
-29
lines changed

src/pages/blog-views/BrutalistBlogPostPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ const BrutalistBlogPostPage = () => {
215215
const currentPostIndex = post.seriesPosts?.findIndex(
216216
(item) => item.slug === currentSlug,
217217
);
218-
const prevPost = post.seriesPosts?.[currentPostIndex + 1];
219-
const nextPost = post.seriesPosts?.[currentPostIndex - 1];
218+
const prevPost = post.seriesPosts?.[currentPostIndex - 1];
219+
const nextPost = post.seriesPosts?.[currentPostIndex + 1];
220220

221221
return (
222222
<div className="min-h-screen bg-[#050505] text-white selection:bg-emerald-500/30 pb-32 relative">

src/pages/blog-views/DokumentBlogPostPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ const DokumentBlogPostPage = () => {
354354
const currentPostIndex = post.seriesPosts?.findIndex(
355355
(item) => item.slug === currentSlug,
356356
);
357-
const prevPost = post.seriesPosts?.[currentPostIndex + 1];
358-
const nextPost = post.seriesPosts?.[currentPostIndex - 1];
357+
const prevPost = post.seriesPosts?.[currentPostIndex - 1];
358+
const nextPost = post.seriesPosts?.[currentPostIndex + 1];
359359

360360
return (
361361
<div className="min-h-screen bg-[#f3f3f3] text-[#111] font-sans relative overflow-x-hidden selection:bg-emerald-500/20">

src/pages/blog-views/DossierBlogPostPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ const DossierBlogPostPage = () => {
363363
const currentPostIndex = post.seriesPosts?.findIndex(
364364
(item) => item.slug === currentSlug,
365365
);
366-
const prevPost = post.seriesPosts?.[currentPostIndex + 1];
367-
const nextPost = post.seriesPosts?.[currentPostIndex - 1];
366+
const prevPost = post.seriesPosts?.[currentPostIndex - 1];
367+
const nextPost = post.seriesPosts?.[currentPostIndex + 1];
368368

369369
return (
370370
<div className="min-h-screen bg-[#f3f3f3] text-[#111] overflow-y-auto selection:bg-black selection:text-white custom-scrollbar font-sans relative">

src/pages/blog-views/EditorialBlogPostPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ const EditorialBlogPostPage = () => {
286286
const currentPostIndex = post.seriesPosts?.findIndex(
287287
(item) => item.slug === currentSlug,
288288
);
289-
const prevPost = post.seriesPosts?.[currentPostIndex + 1];
290-
const nextPost = post.seriesPosts?.[currentPostIndex - 1];
289+
const prevPost = post.seriesPosts?.[currentPostIndex - 1];
290+
const nextPost = post.seriesPosts?.[currentPostIndex + 1];
291291

292292
return (
293293
<div className={`min-h-screen transition-colors duration-500 font-instr-serif ${isInvert ? 'bg-[#1a1a1a] text-[#f4f4f4]' : 'bg-[#f4f4f4] text-[#1a1a1a]'}`}>

src/pages/blog-views/OldBlogPostPage.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ const OldBlogPostPage = () => {
281281
? post.seriesPosts.findIndex((item) => item.slug === currentSlug)
282282
: -1;
283283
const prevPost =
284-
post.seriesPosts && currentPostIndex < post.seriesPosts.length - 1
285-
? post.seriesPosts[currentPostIndex + 1]
284+
post.seriesPosts && currentPostIndex > 0
285+
? post.seriesPosts[currentPostIndex - 1]
286286
: null;
287287
const nextPost =
288-
currentPostIndex > 0 ? post.seriesPosts[currentPostIndex - 1] : null;
288+
currentPostIndex < post.seriesPosts.length - 1 ? post.seriesPosts[currentPostIndex + 1] : null;
289289

290290
const backLink = post.attributes.series
291291
? `/blog/series/${post.attributes.series.slug}`

src/pages/blog-views/TerminalBlogPostPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ const TerminalBlogPostPage = () => {
435435
const currentPostIndex = post.seriesPosts?.findIndex(
436436
(item) => item.slug === currentSlug,
437437
);
438-
const prevPost = post.seriesPosts?.[currentPostIndex + 1];
439-
const nextPost = post.seriesPosts?.[currentPostIndex - 1];
438+
const prevPost = post.seriesPosts?.[currentPostIndex - 1];
439+
const nextPost = post.seriesPosts?.[currentPostIndex + 1];
440440

441441
const backLink = post.attributes.series
442442
? `/blog/series/${post.attributes.series.slug}`

src/pages/blog-views/TerminalGreenBlogPostPage.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ const TerminalGreenBlogPostPage = () => {
180180
const currentPostIndex = post.seriesPosts?.findIndex(
181181
(item) => item.slug === currentSlug,
182182
);
183-
const prevPost = post.seriesPosts?.[currentPostIndex + 1];
184-
const nextPost = post.seriesPosts?.[currentPostIndex - 1];
183+
const prevPost = post.seriesPosts?.[currentPostIndex - 1];
184+
const nextPost = post.seriesPosts?.[currentPostIndex + 1];
185185

186186
return (
187187
<div className="min-h-screen bg-black text-emerald-500 font-mono relative overflow-x-hidden selection:bg-emerald-500 selection:text-black">

src/pages/brutalist-views/BrutalistSeriesPage.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ const BrutalistSeriesPage = () => {
2121

2222
const filteredPosts = processedPosts
2323
.filter((post) => post.series && post.series.slug === seriesSlug)
24-
.sort((a, b) => {
25-
const dateA = new Date(a.updated || a.date);
26-
const dateB = new Date(b.updated || b.date);
27-
return dateB - dateA;
28-
});
24+
.sort((a, b) => (a.seriesIndex || 0) - (b.seriesIndex || 0));
2925

3026
if (filteredPosts.length > 0) {
3127
setSeriesPosts(filteredPosts);
@@ -112,6 +108,7 @@ const BrutalistSeriesPage = () => {
112108
<PostItem
113109
key={post.slug}
114110
{...post}
111+
seriesIndex={post.seriesIndex}
115112
slug={`series/${seriesSlug}/${post.slug}`}
116113
isActive={activePost?.slug === post.slug}
117114
onHover={setActivePost}

src/pages/luxe-views/LuxeSeriesPage.jsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,7 @@ const LuxeSeriesPage = () => {
1919

2020
const filteredPosts = processedPosts
2121
.filter((post) => post.series && post.series.slug === seriesSlug)
22-
.sort((a, b) => {
23-
const dateA = new Date(a.updated || a.date);
24-
const dateB = new Date(b.updated || b.date);
25-
// Default to oldest first for series reading order?
26-
// Original code used newest first (B-A). Let's stick to reading order (A-B) for Luxe UX if it's a sequence?
27-
// Actually, Brutalist was B-A. Let's keep B-A for consistency unless specified.
28-
return dateB - dateA;
29-
});
22+
.sort((a, b) => (a.seriesIndex || 0) - (b.seriesIndex || 0));
3023

3124
if (filteredPosts.length > 0) {
3225
setSeriesPosts(filteredPosts);
@@ -100,7 +93,7 @@ const LuxeSeriesPage = () => {
10093
<div className="flex flex-col md:flex-row md:items-center justify-between gap-6">
10194
<div className="flex items-start gap-6">
10295
<span className="font-playfairDisplay text-4xl text-[#1A1A1A]/10 group-hover:text-[#8D4004]/20 transition-colors">
103-
{String(seriesPosts.length - index).padStart(2, '0')}
96+
{String(post.seriesIndex).padStart(2, '0')}
10497
</span>
10598
<div>
10699
<h3 className="font-playfairDisplay text-2xl text-[#1A1A1A] group-hover:italic transition-all mb-2">

0 commit comments

Comments
 (0)