-
Notifications
You must be signed in to change notification settings - Fork 0
Add public auth fallback, health-config page, and sandbox UI pages #22
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
Open
Huynhthuongg
wants to merge
10
commits into
main
Choose a base branch
from
codex/explain-codebase-structure-for-beginners-xev5l0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
412d4ff
feat(sandbox-ai): add mobile dashboard, auth portal, static chat, ter…
Huynhthuongg 46f4038
refactor(sandbox-ai): split auth/env config and health page to reduce…
Huynhthuongg e2ed909
fix(ci): resolve sandbox-ai typecheck errors in PR branch
Huynhthuongg 72c75d0
Fix public pricing route crash in auth fallback
Huynhthuongg 5d913c4
Merge pull request #23 from Huynhthuongg/codex/fix-high-priority-bug-…
Huynhthuongg 5a03294
Fix public auth portal redirects for sign-in/up
Huynhthuongg 2a7732f
Merge pull request #24 from Huynhthuongg/codex/fix-high-priority-bug-…
Huynhthuongg ad84e1d
Improve auth portal behavior in public auth mode
Huynhthuongg 5c3c8b6
Merge pull request #25 from Huynhthuongg/codex/fix-high-priority-bug-…
Huynhthuongg 09b90a7
Update artifacts/sandbox-ai/src/pages/termux-lab.tsx
Huynhthuongg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| 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); | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
| export const isAuthEnabled = authMode === "clerk" && isClerkConfigured; | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
|
|
||
| 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'.", | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
| }, | ||
| { | ||
| key: "VITE_CLERK_PUBLISHABLE_KEY", | ||
| value: clerkPubKey, | ||
| required: authMode === "clerk", | ||
| status: isClerkConfigured ? ("ok" as const) : ("missing" as const), | ||
| 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.", | ||
| }, | ||
| ]; | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { Link } from "wouter"; | ||
| import { isAuthEnabled } from "@/config/auth-mode"; | ||
|
|
||
| export default function AuthPortal() { | ||
| const signInHref = isAuthEnabled ? "/sign-in" : "/health-config"; | ||
| const signUpHref = isAuthEnabled ? "/sign-up" : "/health-config"; | ||
|
|
||
| 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> | ||
| <p className="text-sm text-white/70"> | ||
| {isAuthEnabled | ||
| ? "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." | ||
| : "Auth đang chạy ở chế độ public nên đăng nhập/đăng ký tạm thời không khả dụng. Mở Health Config để xem biến môi trường cần thiết."} | ||
| </p> | ||
| <div className="grid gap-3"> | ||
| <Link href={signInHref} className="rounded-xl px-4 py-3 bg-cyan-400 text-black font-bold text-center"> | ||
| {isAuthEnabled ? "Tiếp tục với Google / GitHub" : "Mở Health Config"} | ||
| </Link> | ||
| <Link href={signUpHref} className="rounded-xl px-4 py-3 border border-white/20 font-semibold text-center"> | ||
| {isAuthEnabled ? "Tạo tài khoản mới" : "Xem cấu hình auth"} | ||
| </Link> | ||
| </div> | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
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
| 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" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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
| 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> | ||
| ); | ||
| } |
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
| 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> | ||
|
Huynhthuongg marked this conversation as resolved.
|
||
| <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> | ||
| ); | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { useState } from "react"; | ||
|
|
||
| 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> | ||
| <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 aria-label="Command" 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> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
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
| 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> | ||
| ); | ||
| } |
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
| 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" | ||
| } | ||
| ] | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.