-
Notifications
You must be signed in to change notification settings - Fork 0
Clarify unavailable login in public mode and keep auth routes reachable #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: revert-13-revert-12-revert-11-dependabot/npm_and_yarn/npm_and_yarn-888b5d1ce8
Are you sure you want to change the base?
Changes from all commits
412d4ff
46f4038
e2ed909
66245d2
1eb40ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| export type AuthMode = "clerk" | "public"; | ||
|
|
||
| const clerkPubKey = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY; | ||
| const clerkProxyUrl = import.meta.env.VITE_CLERK_PROXY_URL; | ||
| const requestedAuthMode = (import.meta.env.VITE_AUTH_MODE ?? "clerk").toLowerCase(); | ||
|
|
||
| export const authMode: AuthMode = requestedAuthMode === "public" ? "public" : "clerk"; | ||
| export const isClerkConfigured = Boolean(clerkPubKey); | ||
| export const isAuthEnabled = authMode === "clerk" && isClerkConfigured; | ||
|
|
||
| export const clerkConfig = { | ||
| clerkPubKey, | ||
| clerkProxyUrl, | ||
| }; | ||
|
|
||
| export const envChecklist = [ | ||
| { | ||
| key: "VITE_AUTH_MODE", | ||
| value: import.meta.env.VITE_AUTH_MODE, | ||
| required: false, | ||
| status: "info" as const, | ||
| hint: "Optional. Use 'clerk' (default) or 'public'.", | ||
| }, | ||
| { | ||
| key: "VITE_CLERK_PUBLISHABLE_KEY", | ||
| value: clerkPubKey, | ||
| required: authMode === "clerk", | ||
| status: isClerkConfigured ? ("ok" as const) : ("missing" as const), | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
| hint: "Required when VITE_AUTH_MODE=clerk.", | ||
| }, | ||
| { | ||
| key: "VITE_CLERK_PROXY_URL", | ||
| value: clerkProxyUrl, | ||
| required: false, | ||
| status: "info" as const, | ||
| hint: "Optional proxy URL for Clerk.", | ||
| }, | ||
| ]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { Link } from "wouter"; | ||
| import { envChecklist, isAuthEnabled } from "@/config/auth-mode"; | ||
|
|
||
| export default function AuthPortal() { | ||
| const missingRequiredEnv = envChecklist.filter((item) => item.required && !item.value).map((item) => item.key); | ||
|
|
||
| return ( | ||
| <div className="min-h-screen bg-black text-white p-6"> | ||
| <div className="max-w-md mx-auto pt-12 space-y-6"> | ||
| <h1 className="text-3xl font-black">Đăng nhập / Đăng ký</h1> | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
|
|
||
| {isAuthEnabled ? ( | ||
| <p className="text-sm text-white/70"> | ||
| Quy trình OAuth (Google/GitHub) được xử lý qua Clerk. Bấm nút bên dưới để vào trang xác thực chính thức. | ||
| </p> | ||
| ) : ( | ||
| <div className="rounded-xl border border-yellow-500/40 bg-yellow-500/10 p-4 text-sm text-yellow-100 space-y-2"> | ||
| <p className="font-semibold">Auth đang tắt ở môi trường hiện tại nên chưa thể đăng nhập.</p> | ||
| {missingRequiredEnv.length > 0 && ( | ||
| <p className="text-yellow-200/90">Thiếu biến: {missingRequiredEnv.join(", ")}</p> | ||
| )} | ||
| <p className="text-yellow-200/90">Vào trang Health Config để kiểm tra cấu hình chi tiết.</p> | ||
| </div> | ||
| )} | ||
|
|
||
| <div className="grid gap-3"> | ||
| {isAuthEnabled ? ( | ||
| <> | ||
| <Link href="/sign-in" className="rounded-xl px-4 py-3 bg-cyan-400 text-black font-bold text-center">Tiếp tục với Google / GitHub</Link> | ||
| <Link href="/sign-up" className="rounded-xl px-4 py-3 border border-white/20 font-semibold text-center">Tạo tài khoản mới</Link> | ||
| </> | ||
| ) : ( | ||
| <Link href="/health-config" className="rounded-xl px-4 py-3 bg-cyan-400 text-black font-bold text-center">Mở Health Config</Link> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| export default function ChatStaticPage() { | ||
| const messages = [ | ||
| { role: "user", content: "Tạo API login bằng Node.js" }, | ||
| { role: "assistant", content: "Dưới đây là skeleton theo phong cách Codex, gồm route, service và validator..." }, | ||
| ]; | ||
| return ( | ||
| <div className="min-h-screen bg-[#0b0d12] text-white flex flex-col"> | ||
| <header className="p-4 border-b border-white/10 font-black">Codex-style Chat (Static UI)</header> | ||
| <div className="flex-1 p-4 space-y-4"> | ||
| {messages.map((m, i) => ( | ||
| <div key={i} className={`max-w-3xl rounded-xl p-3 ${m.role === "user" ? "ml-auto bg-cyan-500/20" : "bg-white/5"}`}> | ||
| <div className="text-xs opacity-70 mb-1">{m.role}</div> | ||
| <div>{m.content}</div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| <div className="p-4 border-t border-white/10"> | ||
| <input disabled value="Static mock input..." className="w-full rounded-lg bg-white/10 px-3 py-2 text-sm" /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Custom agent: Enforce Accessibility Standards (WCAG...) Disabled Prompt for AI agents |
||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { authMode, envChecklist, isAuthEnabled } from "@/config/auth-mode"; | ||
|
|
||
| export default function HealthConfigPage() { | ||
| return ( | ||
| <div className="min-h-screen" style={{ backgroundColor: "var(--sb-bg)", color: "#fff", padding: 24 }}> | ||
| <h1 style={{ fontSize: 28, fontWeight: 800, marginBottom: 12 }}>Health Config</h1> | ||
| <p style={{ opacity: 0.8, marginBottom: 20 }}> | ||
| Runtime auth mode: <strong>{authMode}</strong>. Auth enabled: <strong>{String(isAuthEnabled)}</strong>. | ||
| </p> | ||
| <div style={{ display: "grid", gap: 10 }}> | ||
| {envChecklist.map((item) => ( | ||
| <div key={item.key} style={{ border: "1px solid rgba(255,255,255,0.15)", borderRadius: 10, padding: 12 }}> | ||
| <div style={{ display: "flex", justifyContent: "space-between", gap: 12 }}> | ||
| <code>{item.key}</code> | ||
| <strong> | ||
| {item.status === "ok" ? "✅ configured" : item.status === "missing" ? "❌ missing" : "ℹ️ optional"} | ||
| </strong> | ||
| </div> | ||
| <div style={{ marginTop: 6, fontSize: 13, opacity: 0.85 }}>required: {String(item.required)}</div> | ||
| <div style={{ marginTop: 6, fontSize: 13, opacity: 0.85 }}>value: {item.value ? "set" : "empty"}</div> | ||
| <div style={{ marginTop: 6, fontSize: 13, opacity: 0.85 }}>{item.hint}</div> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { useState } from "react"; | ||
| import { Link } from "wouter"; | ||
| import { Menu, X, MessageSquare, Wrench, TerminalSquare, User } from "lucide-react"; | ||
|
|
||
| export default function MobileDashboard() { | ||
| const [open, setOpen] = useState(false); | ||
| return ( | ||
| <div className="min-h-screen bg-[#06070a] text-white"> | ||
| <header className="sticky top-0 z-20 border-b border-white/10 bg-black/60 backdrop-blur px-4 py-3 flex items-center justify-between"> | ||
| <button onClick={() => setOpen((v) => !v)} className="p-2 rounded-lg border border-white/20"> | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
| {open ? <X size={18} /> : <Menu size={18} />} | ||
| </button> | ||
| <h1 className="font-black">Sandbox Dashboard</h1> | ||
| <User size={18} className="opacity-70" /> | ||
| </header> | ||
|
|
||
| {open && ( | ||
| <nav className="p-4 space-y-2 border-b border-white/10"> | ||
| <Link href="/chat-static" className="flex items-center gap-2 p-3 rounded-lg bg-white/5"><MessageSquare size={16}/> Chat tĩnh (Codex style)</Link> | ||
| <Link href="/termux-lab" className="flex items-center gap-2 p-3 rounded-lg bg-white/5"><TerminalSquare size={16}/> Termux nền + AI lệnh</Link> | ||
| <Link href="/tools" className="flex items-center gap-2 p-3 rounded-lg bg-white/5"><Wrench size={16}/> Công cụ hỗ trợ</Link> | ||
| </nav> | ||
| )} | ||
|
|
||
| <main className="p-4 space-y-3"> | ||
| <div className="rounded-2xl border border-cyan-400/30 bg-cyan-400/10 p-4"> | ||
| <p className="text-sm text-cyan-200">Mobile-first layout với menu 3 gạch như bạn yêu cầu.</p> | ||
| </div> | ||
| <div className="grid grid-cols-2 gap-3"> | ||
| <Link href="/chat-static" className="rounded-xl p-4 bg-white/5 border border-white/10">Mở Chat</Link> | ||
| <Link href="/tools" className="rounded-xl p-4 bg-white/5 border border-white/10">Mở Tools</Link> | ||
| </div> | ||
| </main> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { useState } from "react"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Custom agent: Enforce Pragmatic Test Coverage New interactive UI component Prompt for AI agents |
||
|
|
||
| export default function TermuxLab() { | ||
| const [cmd, setCmd] = useState("npm run build"); | ||
| const [logs, setLogs] = useState<string[]>(["[termux] session booted", "[ai] ready to suggest commands"]); | ||
| return ( | ||
| <div className="min-h-screen bg-black text-green-300 p-4 font-mono"> | ||
| <h1 className="text-white font-bold mb-4">Termux nền + AI command assistant (mock)</h1> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Custom agent: Enforce i18n for User-Facing Strings User-facing heading text is hardcoded instead of using i18n translation functions. Prompt for AI agents |
||
| <div className="rounded-xl border border-green-500/30 p-3 mb-3 bg-green-950/20"> | ||
| {logs.map((l, i) => <div key={i}>{l}</div>)} | ||
| </div> | ||
| <div className="flex gap-2"> | ||
| <input value={cmd} onChange={(e) => setCmd(e.target.value)} className="flex-1 bg-white/10 text-white px-3 py-2 rounded" /> | ||
| <button onClick={() => setLogs((v) => [...v, `$ ${cmd}`, "[ai] suggestion: add --verbose if fail"])} className="px-3 py-2 rounded bg-cyan-500 text-black font-bold">Run</button> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Custom agent: Enforce i18n for User-Facing Strings User-facing button label is hardcoded instead of using i18n translation functions. Prompt for AI agents |
||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| const tools = [ | ||
| "Prompt Optimizer", | ||
| "API Schema Checker", | ||
| "Log Analyzer", | ||
| "Release Checklist", | ||
| "Env Validator", | ||
| ]; | ||
|
|
||
| export default function ToolsHub() { | ||
| return ( | ||
| <div className="min-h-screen bg-[#080a10] text-white p-6"> | ||
| <h1 className="text-2xl font-black mb-4">Công cụ hỗ trợ</h1> | ||
| <div className="grid gap-3"> | ||
| {tools.map((t) => ( | ||
| <div key={t} className="rounded-xl border border-white/15 p-4 bg-white/5">{t}</div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,33 @@ | ||
| { | ||
| "extends": "../../tsconfig.base.json", | ||
| "include": ["src/**/*"], | ||
| "exclude": ["node_modules", "build", "dist", "**/*.test.ts"], | ||
| "include": [ | ||
| "src/**/*" | ||
| ], | ||
| "exclude": [ | ||
| "node_modules", | ||
| "build", | ||
| "dist", | ||
| "**/*.test.ts" | ||
| ], | ||
| "compilerOptions": { | ||
| "noEmit": true, | ||
| "jsx": "preserve", | ||
| "lib": ["esnext", "dom", "dom.iterable"], | ||
| "lib": [ | ||
| "esnext", | ||
| "dom", | ||
| "dom.iterable" | ||
| ], | ||
| "resolveJsonModule": true, | ||
| "allowImportingTsExtensions": true, | ||
| "moduleResolution": "bundler", | ||
| "types": ["node", "vite/client"], | ||
| "types": [ | ||
| "node", | ||
| "vite/client" | ||
| ], | ||
| "paths": { | ||
| "@/*": ["./src/*"] | ||
| "@/*": [ | ||
| "./src/*" | ||
| ] | ||
| } | ||
| }, | ||
| "references": [ | ||
| { | ||
| "path": "../../lib/api-client-react" | ||
| }, | ||
| { | ||
| "path": "../../lib/integrations-openai-ai-react" | ||
| } | ||
| ] | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Custom agent: Enforce i18n for User-Facing Strings
Raw user-facing hint strings in envChecklist are not wrapped with i18n translation keys/functions.
Prompt for AI agents