Modernize Thai PDPA Website with Next.js and Legal Reference Pages#9
Open
peeax wants to merge 103 commits into
Open
Modernize Thai PDPA Website with Next.js and Legal Reference Pages#9peeax wants to merge 103 commits into
peeax wants to merge 103 commits into
Conversation
added 24 commits
July 3, 2026 09:36
Member
There was a problem hiding this comment.
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
paramsis a plain object here;await paramsis 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 on lines
+37
to
+41
| return onMobile ? ( | ||
| <NextLink sx={linkSx} href={`/${reference.slug}`} key={reference.slug}> | ||
| {inner} | ||
| </NextLink> | ||
| ) : ( |
Comment on lines
+12
to
+14
| export async function generateMetadata({ params }) { | ||
| const { slug } = await params; | ||
| const note = getNote(slug); |
Comment on lines
+29
to
+33
| return ( | ||
| <NextLink {...restProps} href={href} sx={{ variant: 'links.internal' }}> | ||
| {children} | ||
| </NextLink> | ||
| ); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
/reference-article-29.public/pdfs/, including the main PDPA PDF and related legal reference PDFs.screen-capture.gifshowing the current Next.js stacked-page experience.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 ต้นฉบับ:
/reference-article-29public/pdfs/รวมถึง PDF พระราชบัญญัติหลักและ PDF เอกสารอ้างอิงที่เกี่ยวข้องscreen-capture.gifใหม่เพื่อแสดงการใช้งาน stacked pages ของเว็บเวอร์ชัน Next.js ปัจจุบัน