Skip to content

[feature] one shared auth shell for the five sign-in screens - #10

Merged
YJack0000 merged 1 commit into
mainfrom
feature/auth-shell
Oct 5, 2026
Merged

YJack0000 merged 1 commit into
mainfrom
feature/auth-shell

Conversation

@YJack0000

Copy link
Copy Markdown
Contributor

設計提案(方案 A):https://pensieve.pathors.com/o/jack-db85/d/pathors/sign-in-pages

改了什麼

  • /、/access、/accept/[id]、/login(MCP)、/consent(MCP)共用 components/auth/auth-shell.tsx:左邊深藍關聯圖(沒權限/邀請失效時亮點變虛線圈),右邊表單;窄於 720px 時左欄縮成上方 150px 一條。
  • 登入方式來自 lib/sign-in-methods.ts 的清單,目前只有 Google(有設 GOOGLE_CLIENT_ID 才出現)。之後加 Microsoft 或公司 SSO 只要加一項;沒設定的方式不顯示,沒有「即將推出」。
  • /login 的 MCP 流程照舊把 oauth_query 原封不動 POST 回 /api/auth/sign-in/social(SignInMethods mode="oauth-provider")。
  • /accept/[id] 直接查 invitation/organization/user(唯讀),顯示 workspace 名稱與邀請人;失效、已用過、過期的邀請有自己的狀態;登入帳號跟受邀 email 不同時說明並提供換帳號。
  • 中英雙語:pnsv_locale cookie 優先,否則看瀏覽器偏好語言,預設中文;頁尾可切換;<html lang> 與頁面 title 跟著語言。
  • 刪掉沒人用的 app/login-button.tsx、app/login/login-panel.tsx。components/ui、lib/access.ts 沒動。

驗證

  • tsc --noEmit、next build 通過。
  • 本機 next start(未登入):/、/access、/accept/<不存在>、/login、/consent 皆 200,中英都正確;/o/jack-db85 307 到 /access;cookie 蓋過瀏覽器語言;375px 無橫向捲動;淺色深色都看過。
  • 已登入的狀態(非成員的 /access、邀請 email 相符/不符、有 session 的 consent)只用假資料的暫時頁面看過,暫時頁面未 commit。部署後要用真帳號走一次 MCP 授權。

Home, /access, /accept/[id], /login and /consent each had their own layout and
a mix of English and Chinese. They now share one shell: a dark brand panel
with the relationship graph on the left, the screen's content on the right,
collapsing to a top strip under 720px.

- /: signed-out home is "Sign in to Pensieve" + sign-in methods (signed-in
  redirect unchanged).
- /access: same logic, re-skinned; the non-member state shows an account
  chip and the graph's lit node becomes an empty dashed ring.
- /accept/[id]: reads the invitation (SELECT only) to show the workspace name
  and inviter; handles invalid/expired, signed out, matching account and a
  different signed-in account (switch account).
- /login and /consent: re-skinned; oauth_query still passed verbatim. Consent
  uses plain sections instead of nested cards.

Sign-in methods come from lib/sign-in-methods.ts and only configured ones are
rendered, so Microsoft / company SSO later is one more entry.

Auth-screen copy is localised (zh-TW / en): pnsv_locale cookie, else the
browser's preferred language, defaulting to Chinese. Footer switcher sets the
cookie; <html lang> and page titles follow the locale.
@YJack0000
YJack0000 merged commit a496c1c into main Oct 5, 2026
1 check failed
@YJack0000
YJack0000 deleted the feature/auth-shell branch October 5, 2026 07:31
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

❌ SonarQube Quality Gate ERROR — pathorsAI_pensieve

failed condition value threshold
new_violations 2 ≤ 0

2 open issues on this PR:

  • MAJOR typescript:S6582 — Prefer using an optional chain expression instead, as it's more concise and easier to read. (app/accept/[id]/page.tsx:50)
  • MINOR typescript:S1301 — Replace this "switch" statement by "if" statements to increase readability. (components/auth/sign-in-methods.tsx:73)

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