Skip to content

Conversation

@blizet
Copy link
Contributor

@blizet blizet commented Jul 11, 2025

Summary:
This PR sets up a GitHub Actions workflow to build and deploy our Next.js site to GitHub Pages. It also introduces dynamic base path handling in the app by using process.env.NODE_ENV to switch the BASE_PATH for correct asset and route resolution in production.

Changes made:

  • Improved server-side data fetching and static generation for blog post pages, resulting in faster load times and simplified navigation
  • Updated Next.js components (BlogCard and BlogPostPage) to use a dynamic BASE_PATH based on process.env.NODE_ENV, ensuring correct URL paths for assets and routing when deployed via GitHub Pages.
  • Aligned environment variable usage with GitHub Actions workflow, relying on the default NODE_ENV set during build without manual overrides..
  • Adjusted image URLs and internal links to prepend the BASE_PATH only in production, making the app fully compatible with the static deployment and base path injection handled by the workflow.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a redesigned blog post page with enhanced visual styling, including gradient backgrounds, sticky headers, and improved image handling.
    • Added localized date formatting and clear author metadata on blog posts.
  • Refactor

    • Improved server-side data fetching and static generation for blog post pages, resulting in faster load times and simplified navigation.
    • Separated UI rendering into a dedicated client component for better structure.
  • Style

    • Updated blog card visuals and removed unused elements for a cleaner appearance.
  • Chores

    • Added the "serve" package to dependencies for improved deployment options.
    • Minor formatting and syntax adjustments in configuration files.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 11, 2025

Walkthrough

A new client component for rendering blog posts was introduced, and the blog post page was refactored to use server-side data fetching with static path generation. Image path handling was updated in blog cards to support environment-based prefixes. Minor formatting changes were made to configuration files, and a new dependency was added.

Changes

File(s) Change Summary
app/a/[slug]/BlogPostClient.tsx Added new client component BlogPostPage for rendering individual blog posts with environment-aware image URLs.
app/a/[slug]/page.tsx Refactored to server-side async component; uses static params and delegates rendering to BlogPostPage.
components/blog-card.tsx Updated image URL logic to use environment-based prefix; removed placeholder and date display.
lib/blog.ts Removed "use client" directive.
next.config.mjs Adjusted formatting: removed JSDoc, added semicolon and trailing comma.
package.json Added "serve" dependency; normalized file ending.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant NextServer as Next.js Server (app/a/[slug]/page.tsx)
    participant BlogLib as Blog Library (getPostBySlug)
    participant BlogPostPage as BlogPostPage (Client Component)

    User->>NextServer: Request /a/[slug]
    NextServer->>BlogLib: getPostBySlug(slug)
    BlogLib-->>NextServer: BlogPost data
    NextServer->>BlogPostPage: Render with post prop
    BlogPostPage-->>User: Rendered blog post page
Loading

Poem

🐇
In fields of code, a post now blooms,
With gradients bright in digital rooms.
Images find their perfect path,
While config files enjoy a formatting bath.
A new page hops with server-side grace—
Blog bunnies cheer in every case!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ffeada and a11f880.

📒 Files selected for processing (1)
  • app/a/[slug]/page.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/a/[slug]/page.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
components/blog-card.tsx (2)

19-20: Consider making the BASE_PATH configurable.

The hardcoded "/StableViewpoints" path works for this specific deployment but reduces portability. Consider using an environment variable or Next.js configuration.

-const BASE_PATH = process.env.NODE_ENV === "production" ? "/StableViewpoints" : ""
+const BASE_PATH = process.env.NODE_ENV === "production" ? (process.env.NEXT_PUBLIC_BASE_PATH || "/StableViewpoints") : ""

23-24: Remove unnecessary whitespace.

The extra blank lines don't add value and should be removed for cleaner code.

-export default function BlogCard({ post }: BlogCardProps) {
- 
-
+export default function BlogCard({ post }: BlogCardProps) {
app/a/[slug]/BlogPostClient.tsx (1)

10-11: Consider centralizing BASE_PATH logic.

The BASE_PATH constant is duplicated across multiple components. Consider moving it to a shared configuration file or utility function.

Create a new file lib/config.ts:

export const BASE_PATH = process.env.NODE_ENV === "production" ? "/StableViewpoints" : ""

Then import it in both components:

-// Conditionally set BASE_PATH based on environment
-const BASE_PATH = process.env.NODE_ENV === "production" ? "/StableViewpoints" : ""
+import { BASE_PATH } from "@/lib/config"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 575f9d4 and 9ffeada.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • app/a/[slug]/BlogPostClient.tsx (1 hunks)
  • app/a/[slug]/page.tsx (1 hunks)
  • components/blog-card.tsx (2 hunks)
  • lib/blog.ts (0 hunks)
  • next.config.mjs (2 hunks)
  • package.json (2 hunks)
💤 Files with no reviewable changes (1)
  • lib/blog.ts
🧰 Additional context used
🧬 Code Graph Analysis (2)
app/a/[slug]/BlogPostClient.tsx (4)
lib/blog.ts (1)
  • BlogPost (3-12)
components/ui/calendar.tsx (1)
  • Calendar (66-66)
lib/markdown-renderer.tsx (1)
  • MarkdownRenderer (5-90)
components/footer.tsx (1)
  • Footer (25-78)
app/a/[slug]/page.tsx (2)
lib/blog.ts (2)
  • getAllPosts (15-27)
  • getPostBySlug (29-32)
app/a/[slug]/BlogPostClient.tsx (1)
  • BlogPostPage (13-89)
🔇 Additional comments (5)
next.config.mjs (1)

1-1: LGTM! Clean formatting improvements.

The formatting changes (empty line, trailing comma, semicolon) improve code consistency without affecting functionality.

Also applies to: 13-13, 16-16

components/blog-card.tsx (1)

38-42: LGTM! Proper environment-aware image URL handling.

The conditional BASE_PATH prefixing correctly handles relative vs absolute URLs and aligns with the PR's goal of supporting GitHub Pages deployment.

app/a/[slug]/BlogPostClient.tsx (1)

13-89: Excellent implementation of the blog post page component.

The component structure is well-organized with proper:

  • TypeScript typing with BlogPost interface
  • Semantic HTML structure
  • Accessibility attributes
  • Environment-aware image handling
  • Australian date formatting
  • Responsive design patterns
  • Proper Next.js Image usage with priority flag

The separation of concerns between server and client components aligns with Next.js 13+ best practices.

app/a/[slug]/page.tsx (2)

5-8: LGTM! Proper static generation setup.

The generateStaticParams function correctly generates static paths for all blog posts, which is essential for the GitHub Pages deployment.


14-19: Excellent error handling and component delegation.

The notFound() call properly handles missing posts, and delegating UI rendering to the BlogPostPage client component maintains clean separation of concerns.

Comment on lines +20 to 22
"serve": "^14.2.4",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Move serve to devDependencies or reference it in scripts

serve is typically used only for local/static previews and is not required at runtime in a Next.js production deployment (GitHub Pages will host the static files directly, and next start is used for SSR targets). Keeping it under dependencies unnecessarily bloats the production bundle size (~10 MB) and increases install time.

Either:

  1. Reference serve in a script (e.g. "preview": "serve out") and move it to devDependencies, or
  2. Remove it altogether if it isn’t used.

Example refactor:

-  "dependencies": {
-    ...
-    "serve": "^14.2.4",
-    ...
-  },
+  "dependencies": {
+    ...
+  },
+  "devDependencies": {
+    ...
+    "serve": "^14.2.4",
+    ...
+  }

Run:

to confirm its current usage before adjusting.


🏁 Script executed:

#!/bin/bash
# Check if 'serve' is actually invoked anywhere
rg -n '"serve' --glob package.json
rg -n '\bserve\b' --type js --type ts --type json --type yml

Length of output: 167


🏁 Script executed:

#!/bin/bash
# Show the scripts section in package.json to see if 'serve' is referenced
rg -A 10 '"scripts": {' --glob package.json

# Search for any standalone 'serve' references across key file types
rg -n '\bserve\b' -g '*.js' -g '*.jsx' -g '*.ts' -g '*.tsx' -g '*.json' -g '*.yml' -g '*.yaml'

Length of output: 3821


#!/bin/bash
# Print the scripts section from package.json to check for any 'serve' references
jq '.scripts' package.json

🏁 Script executed:

#!/bin/bash
# Extract the scripts section from package.json to check for any 'serve' usage
jq '.scripts' package.json

Length of output: 123


Move serve to devDependencies or remove

We confirmed there are no references to serve in any npm scripts or source files. It’s only needed for local/static previews and should not live in dependencies.

• File: package.json (lines 20–22)
• Next steps (choose one):

  1. Move serve into devDependencies and add a preview script, e.g.:
    "scripts": {
      "preview": "serve out"
    }
  2. Remove serve entirely if you’re not using it.

Example diff:

-  "dependencies": {
-    ...
-    "serve": "^14.2.4",
-    ...
-  },
+  "dependencies": {
+    ...
+  },
+  "devDependencies": {
+    ...
+    "serve": "^14.2.4",
+    ...
+  }
🤖 Prompt for AI Agents
In package.json around lines 20 to 22, the "serve" package is incorrectly listed
under dependencies but is only used for local/static previews. Move "serve" from
dependencies to devDependencies and add a new npm script named "preview" with
the command "serve out" to enable easy local preview. Alternatively, if "serve"
is not used at all, remove it entirely from the dependencies section.

@Zahnentferner Zahnentferner merged commit 0bf2325 into StabilityNexus:main Jul 12, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants