diff --git a/web/README.md b/web/README.md new file mode 100644 index 0000000000000000000000000000000000000000..79b231cc22605c31d464fda61761a2e20269592b --- /dev/null +++ b/web/README.md @@ -0,0 +1,52 @@ +# WorkPilot web dashboard + +Next.js 16 (App Router, TypeScript strict), Tailwind CSS 4, shadcn/ui (Radix), light/dark themes, +English and Urdu (Nastaliq, right-to-left). + +| Screen | What it does | +|---|---| +| `/inbox` | Agent Inbox: pending approvals with wait time, a structured before → after diff, exact arguments with a provenance badge per value, live facts from the system of record, policy rule, required role and step-up; approve, edit (form from the tool's argument schema; the tool is fixed), reject, respond; bulk approve with per-item exclusion; undo countdown for queued sends (`send_after`, Phase 7) | +| `/runs`, `/runs/[id]` | Runs list and a live run timeline over SSE (trigger, plan, every gateway decision, outcome) | +| `/chat` | Natural-language requests; results render as generative components (order table, risk card, status card) picked from `actions[].tool` / `data` | +| `/orders`, `/cod` | Orders and COD views against the e-commerce pack (`/packs/ecommerce/*`); an empty state until it is installed | +| `/analytics` | Auto-resolution rate, approval rate and latency, gateway decisions, denial reasons, cost | +| `/settings` | Policy thresholds and approval rules (owner), kill switches, team and roles | + +## Run + +```bash +# API (repo root): see the main README quick start, then +python -m core.serve # http://127.0.0.1:8000, CORS allows :3000 by default + +cd web +npm install +npm run dev # http://localhost:3000 +``` + +`NEXT_PUBLIC_API_URL` (browser → API, default `http://127.0.0.1:8000`) and `WP_API_URL` +(Next.js server → API for the session routes, defaults to the same) configure the API address. +Set `WP_CORS_ORIGINS` on the API to the web origin in other environments. + +## Auth tokens + +- **Access token** (15 min): memory only (`src/lib/session.ts`), sent as `Authorization: Bearer`. +- **Refresh token** (14 days): an `httpOnly`, `SameSite=Strict` cookie scoped to `/api/session`, + set by a small Next.js route handler (`src/app/api/session/[action]/route.ts`) that proxies + login, signup, refresh, logout and tenant switch. Browser JavaScript never reads it; a reload + silently exchanges it for a new access token. Session calls also require an + `X-Requested-With` header (CSRF). +- **Step-up token** (5 min, from `POST /auth/stepup` with a TOTP code): memory only, sent as + `X-Stepup-Token` on approvals that need it. + +Trade-off: an XSS can still *use* the session while the tab is open, but cannot steal the +long-lived token; and the app needs a Node runtime for the session routes (no static export). + +## Checks + +```bash +npm run lint && npm run typecheck && npm test && npm run build +npm run e2e # Playwright: boots tests/e2e/server.py (real API, fresh embedded Postgres, + # demo pack, scripted LLM) and a production build on :3100 +``` + +On Windows the e2e config uses `../.venv/Scripts/python.exe`; set `WP_PYTHON` to override. diff --git a/web/playwright.config.ts b/web/playwright.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..ffbf46d418b87afe1add619562b2feb75d139c55 --- /dev/null +++ b/web/playwright.config.ts @@ -0,0 +1,50 @@ +import path from "node:path"; + +import { defineConfig, devices } from "@playwright/test"; + +// End-to-end tests against a REAL API (tests/e2e/server.py: fresh embedded Postgres, demo pack, +// scripted LLM) and a production build of the web app pointed at it. +const API_PORT = Number(process.env.E2E_API_PORT ?? 8765); +const WEB_PORT = Number(process.env.E2E_WEB_PORT ?? 3100); +const API = `http://127.0.0.1:${API_PORT}`; +const WEB = `http://127.0.0.1:${WEB_PORT}`; +const PYTHON = + process.env.WP_PYTHON ?? + path.resolve( + __dirname, + process.platform === "win32" ? "../.venv/Scripts/python.exe" : "../.venv/bin/python", + ); +const SERVER = path.resolve(__dirname, "../tests/e2e/server.py"); + +export default defineConfig({ + testDir: "./e2e", + timeout: 60_000, + expect: { timeout: 15_000 }, + fullyParallel: false, + workers: 1, + retries: process.env.CI ? 1 : 0, + reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : "list", + use: { + baseURL: WEB, + trace: "retain-on-failure", + ...devices["Desktop Chrome"], + }, + projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }], + webServer: [ + { + command: `"${PYTHON}" "${SERVER}" --port ${API_PORT} --web-origin ${WEB}`, + url: `${API}/healthz`, + timeout: 180_000, + reuseExistingServer: false, + stdout: "pipe", + }, + { + command: `npm run build && npx next start -p ${WEB_PORT} -H 127.0.0.1`, + url: `${WEB}/login`, + timeout: 400_000, + reuseExistingServer: false, + env: { NEXT_PUBLIC_API_URL: API, WP_API_URL: API, NEXT_TELEMETRY_DISABLED: "1" }, + }, + ], + metadata: { api: API }, +}); diff --git a/web/playwright.staging.config.ts b/web/playwright.staging.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..ae5a61985696c9e0e37408efd46c08ddea7d52fb --- /dev/null +++ b/web/playwright.staging.config.ts @@ -0,0 +1,19 @@ +import { defineConfig, devices } from "@playwright/test"; + +// Phase 18: end-to-end checks against a DEPLOYED environment (cd.yml, after the staging +// deploy). Unlike playwright.config.ts it starts no servers and needs no test-only API routes: +// it signs in with the public demo tenant (seeded by `python -m core.cli seed-demo`). +// E2E_BASE_URL=https://staging.example.com E2E_EMAIL=... E2E_PASSWORD=... \ +// npx playwright test -c playwright.staging.config.ts +const BASE = process.env.E2E_BASE_URL ?? "http://127.0.0.1:3000"; + +export default defineConfig({ + testDir: "./e2e-staging", + timeout: 90_000, + expect: { timeout: 20_000 }, + workers: 1, + retries: process.env.CI ? 2 : 0, + reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : "list", + use: { baseURL: BASE, trace: "retain-on-failure", ...devices["Desktop Chrome"] }, + projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }], +}); diff --git a/web/src/app/(app)/analytics/page.tsx b/web/src/app/(app)/analytics/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..a2037f9b19c57b49120f9ba06128305074c4a077 --- /dev/null +++ b/web/src/app/(app)/analytics/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { AnalyticsView } from "@/components/analytics/analytics-view"; + +export const metadata: Metadata = { title: "Analytics" }; + +export default function AnalyticsPage() { + return ; +} diff --git a/web/src/app/(app)/chat/page.tsx b/web/src/app/(app)/chat/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..fa3a5afc272ead5affd218dd316fa588dd115aeb --- /dev/null +++ b/web/src/app/(app)/chat/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { ChatView } from "@/components/chat/chat-view"; + +export const metadata: Metadata = { title: "Chat" }; + +export default function ChatPage() { + return ; +} diff --git a/web/src/app/(app)/cod/page.tsx b/web/src/app/(app)/cod/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..a7160ea9a59ea9c2522d762084b41dacf32022d7 --- /dev/null +++ b/web/src/app/(app)/cod/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { CodView } from "@/components/commerce/cod-view"; + +export const metadata: Metadata = { title: "COD" }; + +export default function CodPage() { + return ; +} diff --git a/web/src/app/(app)/inbox/page.tsx b/web/src/app/(app)/inbox/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..2f8f3f18e4d0c619dd26a11924671f42d409a6fc --- /dev/null +++ b/web/src/app/(app)/inbox/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { InboxView } from "@/components/inbox/inbox-view"; + +export const metadata: Metadata = { title: "Inbox" }; + +export default function InboxPage() { + return ; +} diff --git a/web/src/app/(app)/integrations/page.tsx b/web/src/app/(app)/integrations/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..1aae64b279d74d9f43ff1944907afc49fbac4abc --- /dev/null +++ b/web/src/app/(app)/integrations/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { IntegrationsView } from "@/components/ext/integrations-view"; + +export const metadata: Metadata = { title: "Integrations & tools" }; + +export default function IntegrationsPage() { + return ; +} diff --git a/web/src/app/(app)/knowledge/page.tsx b/web/src/app/(app)/knowledge/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..97253720b6306fd4323440d9559be1462da33c51 --- /dev/null +++ b/web/src/app/(app)/knowledge/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { KnowledgeView } from "@/components/knowledge/knowledge-view"; + +export const metadata: Metadata = { title: "Knowledge" }; + +export default function KnowledgePage() { + return ; +} diff --git a/web/src/app/(app)/layout.tsx b/web/src/app/(app)/layout.tsx new file mode 100644 index 0000000000000000000000000000000000000000..aeb2b5df74cbb5e7323ff44411b30027fb8a3a14 --- /dev/null +++ b/web/src/app/(app)/layout.tsx @@ -0,0 +1,13 @@ +import { Suspense } from "react"; + +import { AppGate, FullPageLoading } from "@/components/shell/app-gate"; + +// Everything behind sign-in renders on the client (tokens live in browser memory), so the +// static shell is just a loading state and the rest streams in. +export default function AppLayout({ children }: LayoutProps<"/">) { + return ( + }> + {children} + + ); +} diff --git a/web/src/app/(app)/memory/page.tsx b/web/src/app/(app)/memory/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..7b0aba1bd319d21e5c5ad2fb4bde90c7c3906171 --- /dev/null +++ b/web/src/app/(app)/memory/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { MemoryView } from "@/components/knowledge/memory-view"; + +export const metadata: Metadata = { title: "Memory" }; + +export default function MemoryPage() { + return ; +} diff --git a/web/src/app/(app)/orders/[number]/page.tsx b/web/src/app/(app)/orders/[number]/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..b4e90c923381d2b92774d7706a87a384d774aa2e --- /dev/null +++ b/web/src/app/(app)/orders/[number]/page.tsx @@ -0,0 +1,10 @@ +"use client"; + +import { useParams } from "next/navigation"; + +import { OrderDetailView } from "@/components/commerce/order-detail"; + +export default function OrderPage() { + const { number } = useParams<{ number: string }>(); + return ; +} diff --git a/web/src/app/(app)/orders/page.tsx b/web/src/app/(app)/orders/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..c4fa9cc001d758e1c85d345d226aff207bdd55b1 --- /dev/null +++ b/web/src/app/(app)/orders/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { OrdersView } from "@/components/commerce/orders-view"; + +export const metadata: Metadata = { title: "Orders" }; + +export default function OrdersPage() { + return ; +} diff --git a/web/src/app/(app)/rules/page.tsx b/web/src/app/(app)/rules/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..5a0e49545233d6a2a44b4255bba2de352e650b8a --- /dev/null +++ b/web/src/app/(app)/rules/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { RulesView } from "@/components/ext/rules-view"; + +export const metadata: Metadata = { title: "Rules" }; + +export default function RulesPage() { + return ; +} diff --git a/web/src/app/(app)/runs/[id]/page.tsx b/web/src/app/(app)/runs/[id]/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..787e9369f8b89894473ace0acc0ceb653a467e94 --- /dev/null +++ b/web/src/app/(app)/runs/[id]/page.tsx @@ -0,0 +1,10 @@ +"use client"; + +import { useParams } from "next/navigation"; + +import { RunDetail } from "@/components/runs/run-detail"; + +export default function RunPage() { + const { id } = useParams<{ id: string }>(); + return ; +} diff --git a/web/src/app/(app)/runs/page.tsx b/web/src/app/(app)/runs/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..9cbe10c73a64debfc49013b1bb0b171b9d479d4d --- /dev/null +++ b/web/src/app/(app)/runs/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { RunsList } from "@/components/runs/runs-list"; + +export const metadata: Metadata = { title: "Runs" }; + +export default function RunsPage() { + return ; +} diff --git a/web/src/app/(app)/settings/page.tsx b/web/src/app/(app)/settings/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..c38c1b25cee80f74b21126297f5baad53c7c6cdb --- /dev/null +++ b/web/src/app/(app)/settings/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { SettingsView } from "@/components/settings/settings-view"; + +export const metadata: Metadata = { title: "Settings" }; + +export default function SettingsPage() { + return ; +} diff --git a/web/src/app/(app)/workflows/[id]/page.tsx b/web/src/app/(app)/workflows/[id]/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8fb112944683b5e204e708c88af04511e6d18ce0 --- /dev/null +++ b/web/src/app/(app)/workflows/[id]/page.tsx @@ -0,0 +1,10 @@ +"use client"; + +import { useParams } from "next/navigation"; + +import { WorkflowDetailView } from "@/components/workflows/workflow-detail"; + +export default function WorkflowPage() { + const { id } = useParams<{ id: string }>(); + return ; +} diff --git a/web/src/app/(app)/workflows/page.tsx b/web/src/app/(app)/workflows/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..16bc167e40accace287545f7baab85ae327c0c42 --- /dev/null +++ b/web/src/app/(app)/workflows/page.tsx @@ -0,0 +1,9 @@ +import type { Metadata } from "next"; + +import { WorkflowsView } from "@/components/workflows/workflows-view"; + +export const metadata: Metadata = { title: "Workflows" }; + +export default function WorkflowsPage() { + return ; +} diff --git a/web/src/app/(auth)/login/page.tsx b/web/src/app/(auth)/login/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..066c01034ac7af55169c4a864fa758294a8f3623 --- /dev/null +++ b/web/src/app/(auth)/login/page.tsx @@ -0,0 +1,14 @@ +import type { Metadata } from "next"; +import { Suspense } from "react"; + +import { AuthForm } from "@/components/shell/auth-form"; + +export const metadata: Metadata = { title: "Sign in" }; + +export default function LoginPage() { + return ( + + + + ); +} diff --git a/web/src/app/(auth)/signup/page.tsx b/web/src/app/(auth)/signup/page.tsx new file mode 100644 index 0000000000000000000000000000000000000000..6c3120da372cfbc05e79f093f288544d64b0a8ac --- /dev/null +++ b/web/src/app/(auth)/signup/page.tsx @@ -0,0 +1,14 @@ +import type { Metadata } from "next"; +import { Suspense } from "react"; + +import { AuthForm } from "@/components/shell/auth-form"; + +export const metadata: Metadata = { title: "Create workspace" }; + +export default function SignupPage() { + return ( + + + + ); +} diff --git a/web/src/app/api/session/[action]/route.ts b/web/src/app/api/session/[action]/route.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b3b6680b3e0bc2eb7d1389fb925366a5891a527 --- /dev/null +++ b/web/src/app/api/session/[action]/route.ts @@ -0,0 +1,77 @@ +// Session BFF: the only place the refresh token exists outside the API. It is kept in an +// httpOnly, SameSite=Strict cookie scoped to /api/session, so browser JS never reads it. +import { NextResponse, type NextRequest } from "next/server"; + +const BACKEND = ( + process.env.WP_API_URL ?? + process.env.NEXT_PUBLIC_API_URL ?? + "http://127.0.0.1:8000" +).replace(/\/$/, ""); +const COOKIE = "wp_refresh"; +const MAX_AGE = 14 * 24 * 60 * 60; + +type Action = "login" | "signup" | "refresh" | "logout" | "switch"; +const ACTIONS: Record = { + login: "/auth/login", + signup: "/auth/signup", + refresh: "/auth/refresh", + switch: "/me/tenant", + logout: null, +}; + +function withCookie(res: NextResponse, req: NextRequest, token: string | null): NextResponse { + res.cookies.set({ + name: COOKIE, + value: token ?? "", + httpOnly: true, + sameSite: "strict", + secure: req.nextUrl.protocol === "https:", + path: "/api/session", + maxAge: token ? MAX_AGE : 0, + }); + res.headers.set("Cache-Control", "no-store"); + return res; +} + +export async function POST( + req: NextRequest, + { params }: { params: Promise<{ action: string }> }, +): Promise { + const { action } = await params; + if (!(action in ACTIONS)) return NextResponse.json({ detail: "not found" }, { status: 404 }); + // CSRF: require a header a cross-site form cannot set (SameSite=Strict is the first line). + if (req.headers.get("x-requested-with") !== "workpilot") { + return NextResponse.json({ detail: "forbidden" }, { status: 403 }); + } + if (action === "logout") return withCookie(NextResponse.json({ ok: true }), req, null); + + const headers: Record = { "Content-Type": "application/json" }; + let body: string | undefined; + if (action === "refresh") { + const token = req.cookies.get(COOKIE)?.value; + if (!token) return NextResponse.json({ detail: "no session" }, { status: 401 }); + body = JSON.stringify({ refresh_token: token }); + } else { + body = await req.text(); + if (action === "switch") headers.Authorization = req.headers.get("authorization") ?? ""; + } + + let upstream: Response; + try { + upstream = await fetch(`${BACKEND}${ACTIONS[action as Action]}`, { + method: "POST", + headers, + body, + cache: "no-store", + }); + } catch { + return NextResponse.json({ detail: "API unreachable" }, { status: 502 }); + } + const data = (await upstream.json().catch(() => ({}))) as Record; + if (!upstream.ok) { + const res = NextResponse.json(data, { status: upstream.status }); + return action === "refresh" ? withCookie(res, req, null) : res; + } + const res = NextResponse.json({ access_token: data.access_token, tenant_id: data.tenant_id }); + return withCookie(res, req, String(data.refresh_token)); +} diff --git a/web/src/app/favicon.ico b/web/src/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..af98450595e8b8efd9e505cddc5ed705b665a4d8 Binary files /dev/null and b/web/src/app/favicon.ico differ diff --git a/web/src/app/globals.css b/web/src/app/globals.css new file mode 100644 index 0000000000000000000000000000000000000000..2843c7a839c987afa4c7aa92b1086161be3d7754 --- /dev/null +++ b/web/src/app/globals.css @@ -0,0 +1,180 @@ +@import "tailwindcss"; +@import "tw-animate-css"; +@import "shadcn/tailwind.css"; + +@custom-variant dark (&:is(.dark *)); + +@theme inline { + --color-background: var(--background); + --color-foreground: var(--foreground); + --font-sans: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif; + --font-mono: var(--font-geist-mono), ui-monospace, monospace; + --font-heading: var(--font-geist-sans), ui-sans-serif, system-ui, sans-serif; + --font-urdu: var(--font-nastaliq), var(--font-geist-sans), serif; + --color-success: var(--success); + --color-success-soft: var(--success-soft); + --color-warning: var(--warning); + --color-warning-soft: var(--warning-soft); + --color-info: var(--info); + --color-info-soft: var(--info-soft); + --color-sidebar-ring: var(--sidebar-ring); + --color-sidebar-border: var(--sidebar-border); + --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); + --color-sidebar-accent: var(--sidebar-accent); + --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); + --color-sidebar-primary: var(--sidebar-primary); + --color-sidebar-foreground: var(--sidebar-foreground); + --color-sidebar: var(--sidebar); + --color-chart-5: var(--chart-5); + --color-chart-4: var(--chart-4); + --color-chart-3: var(--chart-3); + --color-chart-2: var(--chart-2); + --color-chart-1: var(--chart-1); + --color-ring: var(--ring); + --color-input: var(--input); + --color-border: var(--border); + --color-destructive: var(--destructive); + --color-accent-foreground: var(--accent-foreground); + --color-accent: var(--accent); + --color-muted-foreground: var(--muted-foreground); + --color-muted: var(--muted); + --color-secondary-foreground: var(--secondary-foreground); + --color-secondary: var(--secondary); + --color-primary-foreground: var(--primary-foreground); + --color-primary: var(--primary); + --color-popover-foreground: var(--popover-foreground); + --color-popover: var(--popover); + --color-card-foreground: var(--card-foreground); + --color-card: var(--card); + --radius-sm: calc(var(--radius) * 0.6); + --radius-md: calc(var(--radius) * 0.8); + --radius-lg: var(--radius); + --radius-xl: calc(var(--radius) * 1.4); + --radius-2xl: calc(var(--radius) * 1.8); + --radius-3xl: calc(var(--radius) * 2.2); + --radius-4xl: calc(var(--radius) * 2.6); +} + +:root { + /* Calm, cool neutrals with a deep teal accent: an operations tool, not a marketing page. */ + --background: oklch(0.985 0.002 247); + --foreground: oklch(0.21 0.014 256); + --card: oklch(1 0 0); + --card-foreground: oklch(0.21 0.014 256); + --popover: oklch(1 0 0); + --popover-foreground: oklch(0.21 0.014 256); + --primary: oklch(0.46 0.083 182); + --primary-foreground: oklch(0.985 0.005 182); + --secondary: oklch(0.962 0.005 247); + --secondary-foreground: oklch(0.27 0.016 256); + --muted: oklch(0.962 0.005 247); + --muted-foreground: oklch(0.51 0.017 256); + --accent: oklch(0.955 0.012 182); + --accent-foreground: oklch(0.3 0.05 182); + --destructive: oklch(0.56 0.19 25); + --border: oklch(0.913 0.007 247); + --input: oklch(0.9 0.008 247); + --ring: oklch(0.6 0.08 182); + --success: oklch(0.52 0.12 155); + --success-soft: oklch(0.95 0.04 155); + --warning: oklch(0.6 0.13 65); + --warning-soft: oklch(0.965 0.05 85); + --info: oklch(0.52 0.12 250); + --info-soft: oklch(0.955 0.025 250); + --chart-1: oklch(0.46 0.083 182); + --chart-2: oklch(0.6 0.13 65); + --chart-3: oklch(0.56 0.19 25); + --chart-4: oklch(0.52 0.12 250); + --chart-5: oklch(0.7 0.02 256); + --radius: 0.5rem; + --sidebar: oklch(0.975 0.003 247); + --sidebar-foreground: oklch(0.27 0.016 256); + --sidebar-primary: oklch(0.46 0.083 182); + --sidebar-primary-foreground: oklch(0.985 0 0); + --sidebar-accent: oklch(0.94 0.008 247); + --sidebar-accent-foreground: oklch(0.21 0.014 256); + --sidebar-border: oklch(0.913 0.007 247); + --sidebar-ring: oklch(0.6 0.08 182); +} + +.dark { + --background: oklch(0.165 0.01 256); + --foreground: oklch(0.95 0.004 247); + --card: oklch(0.2 0.011 256); + --card-foreground: oklch(0.95 0.004 247); + --popover: oklch(0.21 0.012 256); + --popover-foreground: oklch(0.95 0.004 247); + --primary: oklch(0.74 0.1 180); + --primary-foreground: oklch(0.2 0.03 182); + --secondary: oklch(0.26 0.012 256); + --secondary-foreground: oklch(0.95 0.004 247); + --muted: oklch(0.25 0.011 256); + --muted-foreground: oklch(0.7 0.013 256); + --accent: oklch(0.27 0.03 182); + --accent-foreground: oklch(0.92 0.03 182); + --destructive: oklch(0.68 0.17 24); + --border: oklch(1 0 0 / 9%); + --input: oklch(1 0 0 / 14%); + --ring: oklch(0.6 0.08 182); + --success: oklch(0.74 0.13 155); + --success-soft: oklch(0.3 0.05 155); + --warning: oklch(0.8 0.13 75); + --warning-soft: oklch(0.31 0.05 70); + --info: oklch(0.74 0.11 250); + --info-soft: oklch(0.3 0.05 250); + --chart-1: oklch(0.74 0.1 180); + --chart-2: oklch(0.8 0.13 75); + --chart-3: oklch(0.68 0.17 24); + --chart-4: oklch(0.74 0.11 250); + --chart-5: oklch(0.5 0.02 256); + --sidebar: oklch(0.185 0.011 256); + --sidebar-foreground: oklch(0.9 0.006 247); + --sidebar-primary: oklch(0.74 0.1 180); + --sidebar-primary-foreground: oklch(0.2 0.03 182); + --sidebar-accent: oklch(0.25 0.012 256); + --sidebar-accent-foreground: oklch(0.95 0.004 247); + --sidebar-border: oklch(1 0 0 / 8%); + --sidebar-ring: oklch(0.6 0.08 182); +} + +@layer base { + * { + @apply border-border outline-ring/50; + } + body { + @apply bg-background text-foreground; + } + button:not(:disabled), [role="button"]:not(:disabled) { + cursor: pointer; + } + html { + @apply font-sans; + } +} + +/* Urdu: Nastaliq is tall and slanted; give it room. Code, ids and amounts stay LTR. */ +html[lang="ur"] body { + font-family: var(--font-urdu); + line-height: 2; +} +html[lang="ur"] [dir="ltr"], +html[lang="ur"] .tabular { + font-family: var(--font-geist-sans), sans-serif; + line-height: 1.5; +} +html[lang="ur"] .font-mono, +html[lang="ur"] code { + font-family: var(--font-mono); + line-height: 1.5; +} +.tabular { + font-variant-numeric: tabular-nums; +} +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + transition-duration: 0.01ms !important; + } +} diff --git a/web/src/app/layout.tsx b/web/src/app/layout.tsx new file mode 100644 index 0000000000000000000000000000000000000000..56462660513db2172a159aed57f0ba35534634ca --- /dev/null +++ b/web/src/app/layout.tsx @@ -0,0 +1,47 @@ +import type { Metadata, Viewport } from "next"; +import { Geist, Geist_Mono, Noto_Nastaliq_Urdu } from "next/font/google"; + +import { Providers } from "@/components/providers"; +import { localeBootScript } from "@/lib/i18n/boot"; + +import "./globals.css"; + +const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] }); +const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] }); +// Urdu is set in Nastaliq, the script Pakistani readers expect (Naskh reads as Arabic). +const nastaliq = Noto_Nastaliq_Urdu({ + variable: "--font-nastaliq", + subsets: ["arabic"], + weight: ["400", "600", "700"], + preload: false, +}); + +export const metadata: Metadata = { + title: { default: "WorkPilot", template: "%s · WorkPilot" }, + description: "Safe AI operations for small businesses: an agent inbox, live runs and policies.", +}; + +export const viewport: Viewport = { + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "#fbfcfd" }, + { media: "(prefers-color-scheme: dark)", color: "#16181d" }, + ], +}; + +export default function RootLayout({ children }: LayoutProps<"/">) { + return ( + + +