Skip to content

Modernize Thai PDPA Website with Next.js and Legal Reference Pages#9

Open
peeax wants to merge 103 commits into
sidataplus:masterfrom
peeax:migrate-nextjs
Open

Modernize Thai PDPA Website with Next.js and Legal Reference Pages#9
peeax wants to merge 103 commits into
sidataplus:masterfrom
peeax:migrate-nextjs

Conversation

@peeax

@peeax peeax commented Jul 20, 2026

Copy link
Copy Markdown

This fork modernizes and extends the original Thai PDPA website.
For review, the current deployed version can also be checked here:

https://pdpa-2gq.pages.dev/

Main changes from the upstream repository:

  • Migrated the site from Gatsby/Gatsby Theme Andy to Next.js with static export support.
  • Rebuilt the article rendering system with React components for stacked pages, hover previews, table of contents, search, dark mode, and responsive layout.
  • Added supplementary legal reference pages for related announcements, decrees, and official documents.
  • Updated article links so main PDPA articles can link to reference pages such as /reference-article-29.
  • Added local backup PDF files under public/pdfs/, including the main PDPA PDF and related legal reference PDFs.
  • Added production validation scripts for linting, full-act verification, static build output checks, internal reference validation, metadata, and security headers.
  • Updated README and added a new screen-capture.gif showing the current Next.js stacked-page experience.
  • Reorganized public assets, logos, fonts, PDFs, and generated files for production deployment.

The project now builds as a static Next.js site and has passed the production check with npm run check:production.

Fork นี้มีการปรับปรุงและแก้ไขจากเว็บไซต์ Thai PDPA ต้นฉบับ
สามารถตรวจสอบเวอร์ชันที่ deploy ไว้สำหรับ review ได้ที่ลิงก์นี้:

https://pdpa-2gq.pages.dev/

รายการแก้ไขหลักจาก repository ต้นฉบับ:

  • ย้ายระบบเว็บไซต์จาก Gatsby/Gatsby Theme Andy มาเป็น Next.js พร้อมรองรับการ build แบบ static export
  • สร้างระบบแสดงผลมาตราใหม่ด้วย React components สำหรับ stacked pages, hover preview, สารบัญ, search, dark mode และ responsive layout
  • เพิ่มหน้าเอกสารอ้างอิงสำหรับประกาศ พระราชกฤษฎีกา และเอกสารทางกฎหมายที่เกี่ยวข้องกับมาตราต่าง ๆ
  • แก้ไขลิงก์จากมาตราหลักให้สามารถเชื่อมไปยังหน้าเอกสารอ้างอิง เช่น /reference-article-29
  • เพิ่มไฟล์ PDF สำรองไว้ใน public/pdfs/ รวมถึง PDF พระราชบัญญัติหลักและ PDF เอกสารอ้างอิงที่เกี่ยวข้อง
  • เพิ่มสคริปต์ตรวจสอบระดับ production สำหรับ lint, ตรวจเนื้อหาพระราชบัญญัติครบ 96 มาตรา, ตรวจ build output, ตรวจ internal references, metadata และ security headers
  • ปรับ README และเพิ่ม screen-capture.gif ใหม่เพื่อแสดงการใช้งาน stacked pages ของเว็บเวอร์ชัน Next.js ปัจจุบัน
  • จัดระเบียบ assets, logo, fonts, PDFs และ generated files ให้เหมาะสมกับการ deploy production

@na399

na399 commented Jul 21, 2026

Copy link
Copy Markdown
Member

@codex

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the Thai PDPA site by migrating from Gatsby to a statically-exported Next.js (App Router) build, reimplementing the stacked-page reading UX and adding production validation/security tooling plus supplementary legal reference pages.

Changes:

  • Migrated the site runtime to Next.js static export with Theme UI + Emotion SSR integration and stacked-page navigation.
  • Added build-time generators and production verification scripts (content completeness, internal link validation, output checks, security headers).
  • Added supplementary legal reference markdown pages and updated PDPA articles to link to those references.

Reviewed changes

Copilot reviewed 98 out of 128 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
theme/themed.js Re-exports Themed from @theme-ui/mdx for element styling under Theme UI.
theme/index.js Defines Theme UI theme (colors, typography, link styles, dark mode config).
src/gatsby-theme-andy/templates/note.js Removes Gatsby note template (migration cleanup).
src/gatsby-theme-andy/components/ReferredBlock.js Removes Gatsby-specific ReferredBlock component (migration cleanup).
scripts/serve-static.mjs Adds a small static server for out/ with security + cache headers.
scripts/lint-source.mjs Adds custom source lint checks (comment language, CSP/meta rules, whitespace, etc.).
scripts/gen-public.mjs Generates public/notes/*.json, search index, note metadata, and PWA manifest.
scripts/check-production.mjs Validates exported output (HTML refs, JSON, sitemap, headers, etc.).
scripts/check-full-act.mjs Verifies all 96 articles are present and full-act generation markers/links exist.
README.md Updates project docs for Next.js workflow and production checks.
public/llms for seo.txt Adds SEO/LLM-facing summary content file.
public/_headers Adds static-host security headers configuration.
package.json Switches dependencies/scripts to Next.js build + production validation pipeline.
next.config.mjs Configures static export, dev headers, trailing slashes, unoptimized images.
netlify.toml Adds Netlify build settings targeting npm run check:production and out/.
lib/toc-structure.js Adds fixed ToC structure for article navigation UI.
lib/strip-markdown.mjs Adds markdown/HTML-to-text utility for excerpts/search indexing.
lib/site.js Centralizes site metadata and JSON-LD string escaping helper.
lib/security-headers.mjs Defines CSP and other security headers for dev/prod.
lib/search-index.mjs Implements compact search-index serialization/normalization helpers.
lib/note-payload.mjs Implements compact note payloads + hydration for client UI.
lib/insert-links.mjs Ported wiki-link insertion to markdown links.
lib/generate-slug.mjs Ported slug generation to preserve legacy output compatibility.
lib/full-act.mjs Builds/validates full-act content from structured article sources.
lib/excerpt.mjs Generates truncated plain-text excerpts (ported behavior).
lib/constants.js Centralizes layout/search constants (breakpoints, widths, etc.).
lib/build-notes.mjs Implements content graph build: parsing, linkification, backlinks, excerpts, references.
jsconfig.json Adds JS path aliasing + JSX preserve config.
gatsby-config.js Removes Gatsby configuration (migration cleanup).
content/references/reference-article-40.md Adds supplementary legal reference content for article 40.
content/references/reference-article-40-3.md Adds supplementary legal reference content for article 40 (ROPA criteria).
content/references/reference-article-39.md Adds supplementary legal reference content for article 39.
content/references/reference-article-38-2.md Adds supplementary legal reference content for article 38/41(2).
content/references/reference-article-38-1.md Adds supplementary legal reference content for article 38/41(1) (rev 1).
content/references/reference-article-38-1-1.md Adds supplementary legal reference content for article 38/41(1) (rev 2).
content/references/reference-article-37-1.md Adds supplementary legal reference content for article 37(1).
content/references/reference-article-33.md Adds supplementary legal reference content for article 33.
content/references/reference-article-28.md Adds supplementary legal reference content for article 28.
content/references/reference-article-26-last.md Adds supplementary legal reference content for article 26 (criminal record safeguards).
content/references/reference-article-20.md Adds supplementary legal reference content for civil code section used by article 20.
content/references/reference-article-20-3.md Adds supplementary legal reference content for civil code section used by article 20.
content/references/reference-article-20-2.md Adds supplementary legal reference content for civil code section used by article 20.
content/references/reference-article-20-1.md Adds supplementary legal reference content for civil code section used by article 20.
content/references/no-announcement.md Adds placeholder reference page for “no announcement available”.
content/article-90.md Fixes Thai typo in article text.
content/article-73.md Fixes Thai typo in article text.
content/article-54.md Normalizes formatting in article text.
content/article-41.md Updates PDPA article to link to relevant supplementary references.
content/article-40.md Updates PDPA article to link to relevant supplementary references.
content/article-4.md Updates PDPA article to link to relevant supplementary references.
content/article-39.md Updates PDPA article to link to relevant supplementary references.
content/article-38.md Updates PDPA article to link to relevant supplementary references.
content/article-37.md Updates PDPA article to link to relevant supplementary references.
content/article-34.md Adds link/placeholder for referenced committee announcement.
content/article-33.md Adds link to the relevant committee announcement reference.
content/article-31.md Adds link/placeholder for referenced committee announcement.
content/article-30.md Adds link/placeholder for referenced committee announcement.
content/article-29.md Adds link to the relevant committee announcement reference.
content/article-28.md Adds link to the relevant committee announcement reference.
content/article-26.md Adds links to references for committee-defined items.
content/article-24.md Adds link to the relevant committee announcement reference.
content/article-20.md Adds links to civil code reference pages.
content/article-19.md Adds link/placeholder for referenced committee announcement.
content/act-structure.json Adds structured chapter/section metadata for full-act generation.
components/useWindowWidth.js Adds client hook for responsive behavior (ported).
components/Tippy.jsx Adds Tippy wrapper component for popovers (ported).
components/TableOfContents.jsx Adds ToC UI with mobile/desktop navigation behavior.
components/ReferredBlock.jsx Adds backlink rendering block (ported to Next.js).
components/Popover.jsx Adds hover popover content rendering (ported).
components/OfficialDisclaimer.jsx Adds official-document disclaimer/footer block (ported/extended).
components/MarkdownContent.jsx Adds markdown renderer with Theme UI element mapping + sanitization.
components/LinkToStacked.jsx Adds stacked-pages-aware link component using History API navigation.
components/Header.jsx Adds header UI with dark mode toggle + search entry (ported).
components/Footer.jsx Ports footer and adds “last updated” text.
components/DarkModeToggle.jsx Adds Theme UI color mode toggle with hydration-safe icon behavior.
components/BrainNoteContainer.jsx Implements the stacked column layout + History API navigation.
components/BrainNote.jsx Renders articles/references with ToC insertion and popover previews.
components/AnchorTag.jsx Handles internal/external links with stacked navigation + popovers.
app/sitemap.js Adds static sitemap generation for exported routes.
app/robots.js Adds static robots.txt generation.
app/Providers.jsx Adds Theme UI + Emotion provider setup and color-mode class sync.
app/page.jsx Serves root note at / with Legislation JSON-LD.
app/not-found.jsx Adds custom 404 page.
app/layout.jsx Adds global metadata, preloads, and WebSite JSON-LD.
app/globals.css Adds global CSS reset/fonts and Tippy theming.
app/EmotionRegistry.jsx Adds Emotion SSR registry for App Router.
app/[slug]/page.jsx Adds per-slug statically generated pages with JSON-LD + metadata.
.prettierrc Adds Prettier configuration.
.node-version Pins Node.js version for CI/build environments.
.gitignore Updates ignored output/generated files for Next.js + generated public assets.
.github/workflows/production-check.yml Adds CI workflow running npm run check:production + npm audit.
.gitattributes Normalizes line endings and adds yarn-related eol rules.
Comments suppressed due to low confidence (1)

app/[slug]/page.jsx:37

  • params is a plain object here; await params is unnecessary and makes the function look like it depends on async data. Destructure directly.
export default async function NotePage({ params }) {
  const { slug } = await params;
  const note = getNote(slug);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread components/TableOfContents.jsx Outdated
Comment on lines +37 to +41
return onMobile ? (
<NextLink sx={linkSx} href={`/${reference.slug}`} key={reference.slug}>
{inner}
</NextLink>
) : (
Comment thread app/[slug]/page.jsx
Comment on lines +12 to +14
export async function generateMetadata({ params }) {
const { slug } = await params;
const note = getNote(slug);
Comment thread components/AnchorTag.jsx
Comment on lines +29 to +33
return (
<NextLink {...restProps} href={href} sx={{ variant: 'links.internal' }}>
{children}
</NextLink>
);
peeax and others added 2 commits July 23, 2026 08:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

5 participants