Skip to content

feat(pwa): 新增無入口的隱私權政策頁面 /private#11

Merged
Retsomm merged 1 commit into
mainfrom
dev
Jul 7, 2026
Merged

feat(pwa): 新增無入口的隱私權政策頁面 /private#11
Retsomm merged 1 commit into
mainfrom
dev

Conversation

@Retsomm

@Retsomm Retsomm commented Jul 7, 2026

Copy link
Copy Markdown
Owner

透過 URL pathname 直接渲染,App 內無任何連結導向,並加入 Vercel SPA rewrite 確保直接訪問該路徑時不會 404。

Summary by CodeRabbit

  • New Features

    • Added a dedicated privacy page accessible via its own route.
    • The privacy page supports dark mode and includes a toggle in the header.
    • Added a left-arrow icon for improved navigation visuals.
  • Bug Fixes

    • Updated routing so direct page links work reliably in the app, including refresh and deep-link access.

透過 URL pathname 直接渲染,App 內無任何連結導向,並加入 Vercel SPA rewrite 確保直接訪問該路徑時不會 404。
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
travel-in-time Ready Ready Preview, Comment Jul 7, 2026 10:39am

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a /private route rendering a new Privacy page component that displays static privacy policy content with a dark-mode toggle, adds a new IconArrowLeft SVG icon, and configures Vercel SPA fallback routing via vercel.json.

Changes

Privacy Page and Routing

Layer / File(s) Summary
Privacy page content and component
pwa/src/page/Privacy.tsx
Defines static SECTIONS policy data and the Privacy component rendering a themed header with dark-mode toggle and mapped policy sections/paragraphs.
App routing and supporting icon
pwa/src/App.tsx, pwa/src/components/Library/icons.tsx
App.tsx early-returns to render Privacy when the path is /private, passing darkMode and a toggle callback; a new IconArrowLeft SVG icon component is added.
Vercel SPA rewrite
pwa/vercel.json
Adds a rewrites rule routing all paths to /index.html for SPA fallback support.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant App
  participant Privacy

  Browser->>App: navigate to /private
  App->>App: check window.location.pathname
  App->>Privacy: render(darkMode, onToggleDark)
  Privacy-->>Browser: display policy sections
  Browser->>Privacy: click toggle button
  Privacy->>App: onToggleDark()
  App-->>Privacy: updated darkMode
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 標題準確描述了新增 /private 隱私權政策頁面,與變更內容一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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

Comment @coderabbitai help to get the list of available commands.

@Retsomm Retsomm merged commit c2562b6 into main Jul 7, 2026
5 of 6 checks passed

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
pwa/src/App.tsx (1)

16-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Wrapper markup duplicated with the main render path.

The dark/min-h-screen bg-stone-50 dark:bg-gray-900 wrapper here duplicates lines 71-72 in the main return. Minor, but could be extracted into a shared AppShell-style wrapper to avoid drift if the theming classes change later.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pwa/src/App.tsx` around lines 16 - 24, The wrapper markup in App is
duplicated between the /private branch and the main render path, so extract the
shared dark mode and min-h-screen theme container into a reusable AppShell-style
wrapper. Update the App component to render Privacy and the main content through
that shared wrapper, reusing the existing darkMode state and onToggleDark
handler so the theming classes stay in one place and won’t drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pwa/src/page/Privacy.tsx`:
- Around line 97-146: The Privacy component uses inline style objects throughout
instead of the project’s Tailwind className convention. Update the `Privacy`
component to replace the computed color/style variables and all `style={{...}}`
usages with `className`-based styling, using existing `dark:` patterns like
other pages. Keep the layout and visual appearance by moving the header, toggle
button, card wrapper, headings, and paragraphs to Tailwind utilities or CSS
variables consumed via className. Focus on the `Privacy` component and its
section rendering loop so it aligns with the app-wide JSX styling guideline.

---

Nitpick comments:
In `@pwa/src/App.tsx`:
- Around line 16-24: The wrapper markup in App is duplicated between the
/private branch and the main render path, so extract the shared dark mode and
min-h-screen theme container into a reusable AppShell-style wrapper. Update the
App component to render Privacy and the main content through that shared
wrapper, reusing the existing darkMode state and onToggleDark handler so the
theming classes stay in one place and won’t drift.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c542296c-6524-44c1-ad53-99e6e838f1f5

📥 Commits

Reviewing files that changed from the base of the PR and between a9a6243 and b14e36c.

📒 Files selected for processing (4)
  • pwa/src/App.tsx
  • pwa/src/components/Library/icons.tsx
  • pwa/src/page/Privacy.tsx
  • pwa/vercel.json

Comment thread pwa/src/page/Privacy.tsx
Comment on lines +97 to +146
const Privacy = ({ darkMode, onToggleDark }: Props) => {
const paperBg = darkMode ? '#1a1816' : '#f9f7f2'
const paperBg2 = darkMode ? '#231f1c' : '#f1ede4'
const borderCol = darkMode ? '#3a3430' : '#e4ddd0'
const inkCol = darkMode ? '#e8e0d4' : '#2a2420'
const ink3Col = darkMode ? '#8a7f74' : '#9a8f80'

return (
<div className="flex flex-col min-h-screen" style={{ background: paperBg, color: inkCol }}>
<div
className="flex items-center gap-2 px-4 py-3"
style={{ borderBottom: `1px solid ${borderCol}`, paddingTop: 'max(env(safe-area-inset-top), 12px)' }}
>
<span style={{ fontFamily: SERIF, fontSize: 16, fontWeight: 500 }}>隱私權政策</span>
<button className="p-2 rounded-full transition ml-auto" style={{ color: ink3Col }} onClick={onToggleDark}>
{darkMode ? <IconSun /> : <IconMoon />}
</button>
</div>

<div className="flex-1 flex items-center justify-center overflow-y-auto px-4 py-10">
<div
style={{
width: '100%', maxWidth: 640,
background: paperBg2, border: `1px solid ${borderCol}`,
borderRadius: 12, padding: '32px 28px',
}}
>
<h1 style={{ fontFamily: SERIF, fontSize: 26, fontWeight: 400, marginBottom: 6, textAlign: 'center' }}>
隱私權政策
</h1>
<p style={{ fontFamily: MONO, fontSize: 11, letterSpacing: '0.08em', color: ink3Col, textAlign: 'center', marginBottom: 28 }}>
TRAVEL IN TIME · 生效日期 2026-07-07
</p>

{SECTIONS.map((section) => (
<div key={section.title} style={{ marginBottom: 22 }}>
<h2 style={{ fontFamily: SERIF, fontSize: 16, fontWeight: 500, marginBottom: 8 }}>
{section.title}
</h2>
{section.paragraphs.map((p, i) => (
<p key={i} style={{ fontSize: 13, lineHeight: 1.75, color: inkCol, marginBottom: 8 }}>
{p}
</p>
))}
</div>
))}
</div>
</div>
</div>
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Extensive inline styles violate the tsx className guideline.

Nearly every element in this component (header, toggle button, card wrapper, headings, paragraphs) uses style={{...}} instead of Tailwind className. The app already establishes a dark class + dark: utility pattern in App.tsx/other pages (e.g. bg-stone-50 dark:bg-gray-900); this component instead computes hex colors in JS and applies them via inline style, bypassing that convention entirely.

Consider replacing the computed color variables with Tailwind dark: variant classes (or CSS custom properties consumed via className) so the component matches the rest of the codebase and the coding guideline.

As per coding guidelines, **/*.tsx: "React JSX 頁面/元件中應使用 className 寫法,並避免使用 inline style".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pwa/src/page/Privacy.tsx` around lines 97 - 146, The Privacy component uses
inline style objects throughout instead of the project’s Tailwind className
convention. Update the `Privacy` component to replace the computed color/style
variables and all `style={{...}}` usages with `className`-based styling, using
existing `dark:` patterns like other pages. Keep the layout and visual
appearance by moving the header, toggle button, card wrapper, headings, and
paragraphs to Tailwind utilities or CSS variables consumed via className. Focus
on the `Privacy` component and its section rendering loop so it aligns with the
app-wide JSX styling guideline.

Source: Coding guidelines

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.

1 participant