agentic-dev 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/prd.json +29 -0
- package/.agent/progress.txt +1 -0
- package/.agent/prompt.md +21 -0
- package/.agent/ralph-loop-state.json +13 -0
- package/.agent/ralph-supervisor-state.json +12 -0
- package/.agent/ralph-supervisor.sh +238 -0
- package/.agent/ralph.sh +305 -0
- package/.agent/runs/README.md +7 -0
- package/.agent/sdd-build-ast-audit.json +13 -0
- package/.claude/CLAUDE.md +44 -0
- package/.claude/agentic-dev.json +3 -0
- package/.claude/agents/ai-dev.md +27 -0
- package/.claude/agents/backend-dev.md +26 -0
- package/.claude/agents/db-dev.md +26 -0
- package/.claude/agents/devops.md +27 -0
- package/.claude/agents/frontend-dev.md +25 -0
- package/.claude/agents/github-ops.md +25 -0
- package/.claude/agents/test-dev.md +26 -0
- package/.claude/agents/uiux-designer.md +25 -0
- package/.claude/settings.json +49 -0
- package/.claude/settings.local.json +8 -0
- package/.claude/skills/commit/SKILL.md +37 -0
- package/.claude/skills/dev-browser/SKILL.md +30 -0
- package/.claude/skills/otro/SKILL.md +43 -0
- package/.claude/skills/planning-with-files/SKILL.md +37 -0
- package/.claude/skills/prd/SKILL.md +27 -0
- package/.claude/skills/ralph-loop/SKILL.md +42 -0
- package/.claude/skills/sdd/SKILL.md +13 -0
- package/.claude/skills/sdd-dev/SKILL.md +71 -0
- package/.claude/skills/sdd-development/SKILL.md +13 -0
- package/.claude/workspace-config.json +3 -0
- package/.codex/agentic-dev.json +3 -0
- package/.codex/agents/README.md +22 -0
- package/.codex/agents/api.toml +11 -0
- package/.codex/agents/architecture.toml +11 -0
- package/.codex/agents/ci.toml +11 -0
- package/.codex/agents/gitops.toml +11 -0
- package/.codex/agents/orchestrator.toml +11 -0
- package/.codex/agents/quality.toml +11 -0
- package/.codex/agents/runtime.toml +11 -0
- package/.codex/agents/security.toml +11 -0
- package/.codex/agents/specs.toml +11 -0
- package/.codex/agents/ui.toml +11 -0
- package/.codex/config.toml +46 -0
- package/.codex/skills/SKILL.md +13 -0
- package/.codex/skills/agents/openai.yaml +4 -0
- package/.codex/skills/commit/SKILL.md +219 -0
- package/.codex/skills/commit/references/commit_examples.md +292 -0
- package/.codex/skills/dev-browser/SKILL.md +211 -0
- package/.codex/skills/dev-browser/bun.lock +443 -0
- package/.codex/skills/dev-browser/package-lock.json +2988 -0
- package/.codex/skills/dev-browser/package.json +31 -0
- package/.codex/skills/dev-browser/references/scraping.md +155 -0
- package/.codex/skills/dev-browser/scripts/start-relay.ts +32 -0
- package/.codex/skills/dev-browser/scripts/start-server.ts +117 -0
- package/.codex/skills/dev-browser/server.sh +24 -0
- package/.codex/skills/dev-browser/src/client.ts +474 -0
- package/.codex/skills/dev-browser/src/index.ts +287 -0
- package/.codex/skills/dev-browser/src/relay.ts +731 -0
- package/.codex/skills/dev-browser/src/snapshot/__tests__/snapshot.test.ts +223 -0
- package/.codex/skills/dev-browser/src/snapshot/browser-script.ts +877 -0
- package/.codex/skills/dev-browser/src/snapshot/index.ts +14 -0
- package/.codex/skills/dev-browser/src/snapshot/inject.ts +13 -0
- package/.codex/skills/dev-browser/src/types.ts +34 -0
- package/.codex/skills/dev-browser/tsconfig.json +36 -0
- package/.codex/skills/dev-browser/vitest.config.ts +12 -0
- package/.codex/skills/otro/SKILL.md +74 -0
- package/.codex/skills/otro/agents/openai.yaml +4 -0
- package/.codex/skills/otro/references/agent-prompts.md +61 -0
- package/.codex/skills/otro/references/contracts.md +146 -0
- package/.codex/skills/otro/references/orchestration-loop.md +51 -0
- package/.codex/skills/otro/references/runtime.md +79 -0
- package/.codex/skills/otro/runs/README.md +11 -0
- package/.codex/skills/otro/schemas/step_plan.schema.json +289 -0
- package/.codex/skills/otro/schemas/task_result.schema.json +142 -0
- package/.codex/skills/otro/schemas/wave_plan.schema.json +4 -0
- package/.codex/skills/otro/scripts/README.md +38 -0
- package/.codex/skills/otro/scripts/bump_validation_header.py +179 -0
- package/.codex/skills/otro/scripts/check_validation_header.py +84 -0
- package/.codex/skills/otro/scripts/common.py +303 -0
- package/.codex/skills/otro/scripts/init_run.sh +68 -0
- package/.codex/skills/otro/scripts/plan_loop.py +8 -0
- package/.codex/skills/otro/scripts/plan_step.py +367 -0
- package/.codex/skills/otro/scripts/plan_wave.py +8 -0
- package/.codex/skills/otro/scripts/reconcile_loop.py +8 -0
- package/.codex/skills/otro/scripts/reconcile_step.py +37 -0
- package/.codex/skills/otro/scripts/reconcile_wave.py +8 -0
- package/.codex/skills/otro/scripts/run_loop.py +300 -0
- package/.codex/skills/otro/scripts/run_loop_step.py +8 -0
- package/.codex/skills/otro/scripts/run_step.py +246 -0
- package/.codex/skills/otro/scripts/run_wave.py +8 -0
- package/.codex/skills/otro/validation/validation.md +15 -0
- package/.codex/skills/planning-with-files/SKILL.md +42 -0
- package/.codex/skills/planning-with-files/agents/openai.yaml +4 -0
- package/.codex/skills/planning-with-files/assets/plan-template.md +37 -0
- package/.codex/skills/planning-with-files/references/plan-rules.md +35 -0
- package/.codex/skills/planning-with-files/scripts/new_plan.sh +65 -0
- package/.codex/skills/prd/SKILL.md +235 -0
- package/.codex/skills/ralph-loop/SKILL.md +46 -0
- package/.codex/skills/ralph-loop/agents/openai.yaml +4 -0
- package/.codex/skills/ralph-loop/references/failure-triage.md +32 -0
- package/.codex/skills/ralph-loop/scripts/loop_until_success.sh +97 -0
- package/.codex/skills/sdd/SKILL.md +184 -0
- package/.codex/skills/sdd/agents/openai.yaml +4 -0
- package/.codex/skills/sdd/references/section-map.md +67 -0
- package/.dockerignore +8 -0
- package/.env.example +50 -0
- package/.gitignore +16 -0
- package/AGENTS.md +78 -0
- package/README.md +83 -47
- package/SDD_SKILL.md +589 -0
- package/bin/agentic-dev.mjs +97 -0
- package/client/admin/.dockerignore +3 -0
- package/client/admin/.env.example +1 -0
- package/client/admin/Dockerfile +16 -0
- package/client/admin/Dockerfile.dev +18 -0
- package/client/admin/README.md +20 -0
- package/client/admin/index.html +12 -0
- package/client/admin/package.json +41 -0
- package/client/admin/postcss.config.js +6 -0
- package/client/admin/scripts/ui-parity-admin-adapter.mjs +65 -0
- package/client/admin/src/api/alerts.ts +33 -0
- package/client/admin/src/api/client.ts +71 -0
- package/client/admin/src/api/orders.ts +33 -0
- package/client/admin/src/api/support.ts +11 -0
- package/client/admin/src/app/App.tsx +23 -0
- package/client/admin/src/auth/AuthProvider.tsx +122 -0
- package/client/admin/src/auth/ProtectedRoute.tsx +22 -0
- package/client/admin/src/auth/auth-client.ts +38 -0
- package/client/admin/src/auth/types.ts +18 -0
- package/client/admin/src/components/AdminNotificationsDrawer.tsx +162 -0
- package/client/admin/src/components/AdminShell.tsx +76 -0
- package/client/admin/src/components/ui/button.tsx +34 -0
- package/client/admin/src/components/ui/input.tsx +21 -0
- package/client/admin/src/lib/cn.ts +6 -0
- package/client/admin/src/lib/specRouteCatalog.json +30 -0
- package/client/admin/src/lib/specScreens.json +22 -0
- package/client/admin/src/main.tsx +17 -0
- package/client/admin/src/pages/AdminDashboardPage.tsx +171 -0
- package/client/admin/src/pages/AdminLoginPage.tsx +75 -0
- package/client/admin/src/pages/AdminQueuePage.tsx +107 -0
- package/client/admin/src/pages/AdminSupportPage.tsx +61 -0
- package/client/admin/src/styles/globals.css +17 -0
- package/client/admin/src/theme-vars.ts +18 -0
- package/client/admin/src/theme.ts +25 -0
- package/client/admin/src/vite-env.d.ts +1 -0
- package/client/admin/tailwind.config.js +8 -0
- package/client/admin/tsconfig.json +25 -0
- package/client/admin/vite.config.ts +12 -0
- package/client/landing/.dockerignore +3 -0
- package/client/landing/.env.example +1 -0
- package/client/landing/Dockerfile +16 -0
- package/client/landing/Dockerfile.dev +18 -0
- package/client/landing/README.md +18 -0
- package/client/landing/index.html +12 -0
- package/client/landing/package.json +41 -0
- package/client/landing/postcss.config.js +6 -0
- package/client/landing/scripts/ui-parity-landing-adapter.mjs +65 -0
- package/client/landing/src/App.tsx +21 -0
- package/client/landing/src/api/catalog.ts +30 -0
- package/client/landing/src/api/client.ts +30 -0
- package/client/landing/src/auth/AuthProvider.tsx +122 -0
- package/client/landing/src/auth/ProtectedRoute.tsx +22 -0
- package/client/landing/src/auth/auth-client.ts +38 -0
- package/client/landing/src/auth/types.ts +18 -0
- package/client/landing/src/components/LandingShell.tsx +34 -0
- package/client/landing/src/lib/specRouteCatalog.json +23 -0
- package/client/landing/src/lib/specScreens.json +17 -0
- package/client/landing/src/main.tsx +17 -0
- package/client/landing/src/pages/LandingHomePage.tsx +215 -0
- package/client/landing/src/pages/LandingLoginPage.tsx +90 -0
- package/client/landing/src/pages/LandingWorkspacePage.tsx +126 -0
- package/client/landing/src/styles/globals.css +17 -0
- package/client/landing/src/theme-vars.ts +16 -0
- package/client/landing/src/theme.ts +21 -0
- package/client/landing/src/vite-env.d.ts +1 -0
- package/client/landing/tailwind.config.js +8 -0
- package/client/landing/tsconfig.json +25 -0
- package/client/landing/vite.config.ts +12 -0
- package/client/mobile/.dockerignore +2 -0
- package/client/mobile/.env.example +1 -0
- package/client/mobile/Dockerfile +16 -0
- package/client/mobile/Dockerfile.dev +18 -0
- package/client/mobile/README.md +19 -0
- package/client/mobile/index.html +12 -0
- package/client/mobile/package.json +42 -0
- package/client/mobile/postcss.config.js +6 -0
- package/client/mobile/scripts/ui-parity-mobile-adapter.mjs +67 -0
- package/client/mobile/src/App.tsx +1 -0
- package/client/mobile/src/api/client.ts +62 -0
- package/client/mobile/src/api/fulfillment.ts +55 -0
- package/client/mobile/src/api/shipping.ts +56 -0
- package/client/mobile/src/app/App.tsx +23 -0
- package/client/mobile/src/auth/AuthProvider.tsx +122 -0
- package/client/mobile/src/auth/ProtectedRoute.tsx +27 -0
- package/client/mobile/src/auth/auth-client.ts +38 -0
- package/client/mobile/src/auth/types.ts +18 -0
- package/client/mobile/src/components/InShell.tsx +74 -0
- package/client/mobile/src/components/ui/button.tsx +35 -0
- package/client/mobile/src/components/ui/card.tsx +15 -0
- package/client/mobile/src/components/ui/input.tsx +21 -0
- package/client/mobile/src/lib/cn.ts +6 -0
- package/client/mobile/src/lib/specRouteCatalog.json +26 -0
- package/client/mobile/src/lib/specScreens.json +22 -0
- package/client/mobile/src/lib/useSpeechRecognitionInput.ts +271 -0
- package/client/mobile/src/main.tsx +17 -0
- package/client/mobile/src/pages/DashboardPage.tsx +172 -0
- package/client/mobile/src/pages/FulfillmentPage.tsx +138 -0
- package/client/mobile/src/pages/LoginPage.tsx +74 -0
- package/client/mobile/src/pages/ShippingPage.tsx +338 -0
- package/client/mobile/src/styles/globals.css +23 -0
- package/client/mobile/src/theme-vars.ts +16 -0
- package/client/mobile/src/theme.ts +21 -0
- package/client/mobile/src/vite-env.d.ts +1 -0
- package/client/mobile/tailwind.config.js +8 -0
- package/client/mobile/tsconfig.json +25 -0
- package/client/mobile/vite.config.ts +12 -0
- package/client/platform/.dockerignore +3 -0
- package/client/platform/.env.example +1 -0
- package/client/platform/Dockerfile +16 -0
- package/client/platform/Dockerfile.dev +18 -0
- package/client/platform/README.md +47 -0
- package/client/platform/index.html +12 -0
- package/client/platform/package.json +42 -0
- package/client/platform/postcss.config.js +6 -0
- package/client/platform/scripts/ui-parity-platform-adapter.mjs +66 -0
- package/client/platform/src/api/client.ts +30 -0
- package/client/platform/src/api/orders.ts +42 -0
- package/client/platform/src/app/App.tsx +21 -0
- package/client/platform/src/auth/AuthProvider.tsx +122 -0
- package/client/platform/src/auth/ProtectedRoute.tsx +22 -0
- package/client/platform/src/auth/auth-client.ts +38 -0
- package/client/platform/src/auth/types.ts +18 -0
- package/client/platform/src/components/AppShell.tsx +59 -0
- package/client/platform/src/components/ui/button.tsx +35 -0
- package/client/platform/src/components/ui/card.tsx +7 -0
- package/client/platform/src/components/ui/input.tsx +21 -0
- package/client/platform/src/lib/cn.ts +6 -0
- package/client/platform/src/lib/specRouteCatalog.json +23 -0
- package/client/platform/src/lib/specScreens.json +17 -0
- package/client/platform/src/main.tsx +17 -0
- package/client/platform/src/pages/DashboardPage.tsx +158 -0
- package/client/platform/src/pages/LoginPage.tsx +72 -0
- package/client/platform/src/pages/OrdersPage.tsx +123 -0
- package/client/platform/src/styles/globals.css +17 -0
- package/client/platform/src/theme-vars.ts +18 -0
- package/client/platform/src/theme.ts +25 -0
- package/client/platform/src/vite-env.d.ts +1 -0
- package/client/platform/tailwind.config.js +8 -0
- package/client/platform/tsconfig.json +25 -0
- package/client/platform/vite.config.ts +12 -0
- package/compose.yml +206 -0
- package/infra/compose/.env.dev.example +28 -0
- package/infra/compose/.env.prod.example +29 -0
- package/infra/compose/README.md +35 -0
- package/infra/compose/dev.yml +125 -0
- package/infra/compose/prod.yml +126 -0
- package/infra/terraform/README.md +34 -0
- package/infra/terraform/aws/data/.terraform.lock.hcl +25 -0
- package/infra/terraform/aws/data/README.md +18 -0
- package/infra/terraform/aws/data/main.tf +147 -0
- package/infra/terraform/aws/data/outputs.tf +14 -0
- package/infra/terraform/aws/data/variables.tf +57 -0
- package/infra/terraform/aws/data/versions.tf +10 -0
- package/infra/terraform/aws/domain/.terraform.lock.hcl +25 -0
- package/infra/terraform/aws/domain/README.md +20 -0
- package/infra/terraform/aws/domain/env/dev.tfvars.example +6 -0
- package/infra/terraform/aws/domain/env/prod.tfvars.example +7 -0
- package/infra/terraform/aws/domain/main.tf +149 -0
- package/infra/terraform/aws/domain/outputs.tf +29 -0
- package/infra/terraform/aws/domain/variables.tf +58 -0
- package/infra/terraform/aws/domain/versions.tf +10 -0
- package/infra/terraform/openstack/README.md +38 -0
- package/infra/terraform/openstack/dev/.terraform.lock.hcl +24 -0
- package/infra/terraform/openstack/dev/README.md +18 -0
- package/infra/terraform/openstack/dev/main.tf +49 -0
- package/infra/terraform/openstack/dev/providers.tf +15 -0
- package/infra/terraform/openstack/dev/terraform.tfvars.example +54 -0
- package/infra/terraform/openstack/dev/variables.tf +210 -0
- package/infra/terraform/openstack/dev/versions.tf +10 -0
- package/infra/terraform/openstack/modules/environment_host/main.tf +143 -0
- package/infra/terraform/openstack/modules/environment_host/outputs.tf +25 -0
- package/infra/terraform/openstack/modules/environment_host/templates/docker-host-user-data.sh.tftpl +40 -0
- package/infra/terraform/openstack/modules/environment_host/variables.tf +145 -0
- package/infra/terraform/openstack/modules/environment_host/versions.tf +7 -0
- package/infra/terraform/openstack/prod/.terraform.lock.hcl +24 -0
- package/infra/terraform/openstack/prod/README.md +18 -0
- package/infra/terraform/openstack/prod/main.tf +49 -0
- package/infra/terraform/openstack/prod/providers.tf +15 -0
- package/infra/terraform/openstack/prod/terraform.tfvars.example +55 -0
- package/infra/terraform/openstack/prod/variables.tf +210 -0
- package/infra/terraform/openstack/prod/versions.tf +10 -0
- package/infra/terraform/openstack/server/.terraform.lock.hcl +45 -0
- package/infra/terraform/openstack/server/README.md +47 -0
- package/infra/terraform/openstack/server/main.tf +161 -0
- package/infra/terraform/openstack/server/outputs.tf +30 -0
- package/infra/terraform/openstack/server/providers.tf +30 -0
- package/infra/terraform/openstack/server/templates/server-user-data.sh.tftpl +50 -0
- package/infra/terraform/openstack/server/variables.tf +233 -0
- package/infra/terraform/openstack/server/zz_aspace.auto.tfvars.example.json +29 -0
- package/lib/scaffold.mjs +379 -0
- package/package.json +33 -12
- package/pnpm-workspace.yaml +2 -0
- package/scripts/dev/audit_sdd_build_ast.py +277 -0
- package/sdd/01_planning/01_feature/INDEX.md +16 -0
- package/sdd/01_planning/01_feature/README.md +76 -0
- package/sdd/01_planning/01_feature/alerts_feature_spec.md +55 -0
- package/sdd/01_planning/01_feature/auth_feature_spec.md +57 -0
- package/sdd/01_planning/01_feature/catalog_feature_spec.md +61 -0
- package/sdd/01_planning/01_feature/fulfillment_feature_spec.md +58 -0
- package/sdd/01_planning/01_feature/health_feature_spec.md +52 -0
- package/sdd/01_planning/01_feature/inventory_feature_spec.md +60 -0
- package/sdd/01_planning/01_feature/order_feature_spec.md +63 -0
- package/sdd/01_planning/01_feature/shipping_feature_spec.md +55 -0
- package/sdd/01_planning/01_feature/support_feature_spec.md +53 -0
- package/sdd/01_planning/01_feature/user_feature_spec.md +54 -0
- package/sdd/01_planning/02_screen/INDEX.md +13 -0
- package/sdd/01_planning/02_screen/README.md +41 -0
- package/sdd/01_planning/02_screen/admin_screen_spec.pdf +0 -0
- package/sdd/01_planning/02_screen/assets/README.md +16 -0
- package/sdd/01_planning/02_screen/assets/example/README.md +13 -0
- package/sdd/01_planning/02_screen/landing_screen_spec.pdf +0 -0
- package/sdd/01_planning/02_screen/mobile_screen_spec.pdf +0 -0
- package/sdd/01_planning/02_screen/platform_screen_spec.pdf +0 -0
- package/sdd/01_planning/03_architecture/INDEX.md +9 -0
- package/sdd/01_planning/03_architecture/README.md +25 -0
- package/sdd/01_planning/03_architecture/architecture_document_structure.md +77 -0
- package/sdd/01_planning/03_architecture/backend/README.md +10 -0
- package/sdd/01_planning/03_architecture/frontend/README.md +12 -0
- package/sdd/01_planning/03_architecture/infra/README.md +10 -0
- package/sdd/01_planning/03_architecture/tech-research/README.md +4 -0
- package/sdd/01_planning/03_architecture/templates_system_architecture.md +84 -0
- package/sdd/01_planning/04_data/INDEX.md +4 -0
- package/sdd/01_planning/04_data/README.md +10 -0
- package/sdd/01_planning/04_data/templates_data_modeling.md +119 -0
- package/sdd/01_planning/05_api/README.md +12 -0
- package/sdd/01_planning/05_api/templates_api_contract.md +90 -0
- package/sdd/01_planning/06_iac/README.md +11 -0
- package/sdd/01_planning/06_iac/templates_runtime_and_cicd_baseline.md +46 -0
- package/sdd/01_planning/07_integration/README.md +11 -0
- package/sdd/01_planning/07_integration/templates_frontend_api_integration.md +46 -0
- package/sdd/01_planning/08_nonfunctional/README.md +7 -0
- package/sdd/01_planning/09_security/README.md +7 -0
- package/sdd/01_planning/10_test/README.md +12 -0
- package/sdd/01_planning/10_test/templates_test_strategy.md +60 -0
- package/sdd/01_planning/INDEX.md +19 -0
- package/sdd/01_planning/README.md +17 -0
- package/sdd/02_plan/01_feature/README.md +34 -0
- package/sdd/02_plan/01_feature/_feature_todo_template.md +29 -0
- package/sdd/02_plan/02_screen/INDEX.md +19 -0
- package/sdd/02_plan/02_screen/README.md +39 -0
- package/sdd/02_plan/02_screen/_screen_todo_template.md +60 -0
- package/sdd/02_plan/03_architecture/README.md +23 -0
- package/sdd/02_plan/03_architecture/architecture_document_governance.md +40 -0
- package/sdd/02_plan/03_architecture/build_ast_runtime_tree_governance.md +53 -0
- package/sdd/02_plan/03_architecture/repository_governance.md +39 -0
- package/sdd/02_plan/03_architecture/runtime_and_structure_governance.md +38 -0
- package/sdd/02_plan/03_architecture/templates-hexagonal-template-architecture.md +9 -0
- package/sdd/02_plan/03_architecture/toolchain_governance.md +98 -0
- package/sdd/02_plan/04_data/README.md +5 -0
- package/sdd/02_plan/05_api/README.md +5 -0
- package/sdd/02_plan/06_iac/README.md +11 -0
- package/sdd/02_plan/06_iac/dev_runtime_delivery.md +36 -0
- package/sdd/02_plan/06_iac/template_runtime_delivery.md +50 -0
- package/sdd/02_plan/07_integration/README.md +5 -0
- package/sdd/02_plan/07_integration/frontend_live_integration.md +31 -0
- package/sdd/02_plan/08_nonfunctional/README.md +5 -0
- package/sdd/02_plan/08_nonfunctional/repository_hygiene.md +26 -0
- package/sdd/02_plan/09_security/README.md +5 -0
- package/sdd/02_plan/10_test/README.md +11 -0
- package/sdd/02_plan/10_test/regression_verification.md +39 -0
- package/sdd/02_plan/10_test/templates/README.md +8 -0
- package/sdd/02_plan/10_test/templates/ui_parity_platform_contract.template.yaml +23 -0
- package/sdd/02_plan/10_test/verification_strategy.md +43 -0
- package/sdd/02_plan/99_generated/from_planning/ui_parity/.gitkeep +1 -0
- package/sdd/02_plan/README.md +40 -0
- package/sdd/03_build/01_feature/README.md +20 -0
- package/sdd/03_build/01_feature/domain/README.md +3 -0
- package/sdd/03_build/01_feature/domain/account_and_access.md +20 -0
- package/sdd/03_build/01_feature/domain/catalog_and_inventory.md +20 -0
- package/sdd/03_build/01_feature/domain/ordering_and_fulfillment.md +21 -0
- package/sdd/03_build/01_feature/domain/support_and_observability.md +21 -0
- package/sdd/03_build/01_feature/domain_surfaces.md +28 -0
- package/sdd/03_build/01_feature/service/README.md +3 -0
- package/sdd/03_build/01_feature/service/admin_surface.md +15 -0
- package/sdd/03_build/01_feature/service/landing_surface.md +13 -0
- package/sdd/03_build/01_feature/service/mobile_surface.md +14 -0
- package/sdd/03_build/01_feature/service/platform_surface.md +14 -0
- package/sdd/03_build/02_screen/README.md +25 -0
- package/sdd/03_build/02_screen/_screen_build_template.md +26 -0
- package/sdd/03_build/02_screen/admin/README.md +5 -0
- package/sdd/03_build/02_screen/landing/README.md +5 -0
- package/sdd/03_build/02_screen/mobile/README.md +5 -0
- package/sdd/03_build/02_screen/platform/README.md +5 -0
- package/sdd/03_build/03_architecture/README.md +10 -0
- package/sdd/03_build/03_architecture/architecture_document_governance.md +30 -0
- package/sdd/03_build/03_architecture/build_ast_runtime_tree_governance.md +24 -0
- package/sdd/03_build/03_architecture/repository_governance.md +18 -0
- package/sdd/03_build/03_architecture/toolchain_governance.md +36 -0
- package/sdd/03_build/06_iac/README.md +3 -0
- package/sdd/03_build/06_iac/dev_runtime_delivery.md +10 -0
- package/sdd/03_build/06_iac/template_runtime_delivery.md +49 -0
- package/sdd/03_build/07_integration/README.md +3 -0
- package/sdd/03_build/07_integration/frontend_live_integration.md +11 -0
- package/sdd/03_build/08_nonfunctional/README.md +3 -0
- package/sdd/03_build/08_nonfunctional/repository_hygiene.md +10 -0
- package/sdd/03_build/10_test/README.md +9 -0
- package/sdd/03_build/10_test/regression_verification.md +16 -0
- package/sdd/03_build/10_test/verification_harness.md +11 -0
- package/sdd/03_build/README.md +35 -0
- package/sdd/04_verify/01_feature/README.md +5 -0
- package/sdd/04_verify/01_feature/domain_verification.md +14 -0
- package/sdd/04_verify/01_feature/service_verification.md +22 -0
- package/sdd/04_verify/02_screen/README.md +6 -0
- package/sdd/04_verify/02_screen/_screen_verify_template.md +20 -0
- package/sdd/04_verify/02_screen/admin/README.md +4 -0
- package/sdd/04_verify/02_screen/landing/README.md +4 -0
- package/sdd/04_verify/02_screen/mobile/README.md +4 -0
- package/sdd/04_verify/02_screen/platform/README.md +4 -0
- package/sdd/04_verify/03_architecture/README.md +10 -0
- package/sdd/04_verify/03_architecture/architecture_document_governance.md +15 -0
- package/sdd/04_verify/03_architecture/build_ast_runtime_tree_governance.md +28 -0
- package/sdd/04_verify/03_architecture/repository_governance.md +16 -0
- package/sdd/04_verify/03_architecture/toolchain_governance.md +58 -0
- package/sdd/04_verify/06_iac/README.md +3 -0
- package/sdd/04_verify/06_iac/dev_runtime_delivery.md +10 -0
- package/sdd/04_verify/06_iac/template_runtime_delivery.md +42 -0
- package/sdd/04_verify/07_integration/README.md +3 -0
- package/sdd/04_verify/07_integration/frontend_live_integration.md +16 -0
- package/sdd/04_verify/08_nonfunctional/README.md +3 -0
- package/sdd/04_verify/08_nonfunctional/repository_hygiene.md +14 -0
- package/sdd/04_verify/10_test/README.md +9 -0
- package/sdd/04_verify/10_test/regression_verification.md +16 -0
- package/sdd/04_verify/10_test/ui_parity/README.md +4 -0
- package/sdd/04_verify/10_test/ui_parity/loop_runs/.gitkeep +0 -0
- package/sdd/04_verify/10_test/ui_parity/reference/.gitkeep +0 -0
- package/sdd/04_verify/10_test/ui_parity/staged_runs/.gitkeep +0 -0
- package/sdd/04_verify/10_test/verification_harness.md +17 -0
- package/sdd/04_verify/README.md +22 -0
- package/sdd/05_operate/01_runbooks/.gitkeep +1 -0
- package/sdd/05_operate/01_runbooks/README.md +4 -0
- package/sdd/05_operate/02_delivery_status/README.md +4 -0
- package/sdd/05_operate/02_delivery_status/service_status.md +16 -0
- package/sdd/05_operate/README.md +12 -0
- package/sdd/99_toolchain/01_automation/.gitkeep +1 -0
- package/sdd/99_toolchain/01_automation/README.md +76 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/analyze_proof_results.py +132 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/analyze_route_gap.py +85 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/assets/repo-contract.template.json +75 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/bootstrap_frontend_parity.sh +84 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/init_frontend_parity.sh +33 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/init_repo_contract.sh +51 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/repo-contract.json +76 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/resolve_frontend_target.py +52 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/resolve_repo_contract.py +56 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/run_frontend_target.sh +100 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/run_repo_phase.sh +140 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/validate_json_schema.py +39 -0
- package/sdd/99_toolchain/01_automation/agentic-parity-harness-design.md +291 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/dashboard.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/queue.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/support.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/landing_screen_capture/home.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/landing_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/landing_screen_capture/workspace.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/mobile_screen_capture/dashboard.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/mobile_screen_capture/fulfillment.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/mobile_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/platform_screen_capture/dashboard.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/platform_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/platform_screen_capture/orders.png +0 -0
- package/sdd/99_toolchain/01_automation/build_asset_recipes.py +10 -0
- package/sdd/99_toolchain/01_automation/build_screen_spec_pdf.py +427 -0
- package/sdd/99_toolchain/01_automation/capture_screen_assets.mjs +148 -0
- package/sdd/99_toolchain/01_automation/harness-layout.md +34 -0
- package/sdd/99_toolchain/01_automation/parity-execution-tooling-design.md +319 -0
- package/sdd/99_toolchain/01_automation/playwright_exactness_manifest.py +21 -0
- package/sdd/99_toolchain/01_automation/run_playwright_exactness.py +87 -0
- package/sdd/99_toolchain/01_automation/screen_spec_manifest.py +321 -0
- package/sdd/99_toolchain/01_automation/spec_asset_builder.py +274 -0
- package/sdd/99_toolchain/01_automation/ui-contract-projection.md +79 -0
- package/sdd/99_toolchain/01_automation/ui-parity/README.md +60 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/extract-reference-pages.mjs +2 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/materialize-reference-assets.mjs +58 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/normalize-reference-assets.mjs +2 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/route-gap-report.mjs +187 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/run-proof.mjs +50 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/scaffold-contract.mjs +62 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/upload-parity1.mjs +2 -0
- package/sdd/99_toolchain/01_automation/ui-parity/contracts/collector-metadata.schema.json +33 -0
- package/sdd/99_toolchain/01_automation/ui-parity/contracts/proof-result.schema.json +76 -0
- package/sdd/99_toolchain/01_automation/ui-parity/contracts/route-gap-report.schema.json +95 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/capture-runner.mjs +55 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/load-adapter.mjs +25 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/load-contract.mjs +81 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/paths.mjs +23 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/proof-runner.mjs +255 -0
- package/sdd/99_toolchain/01_automation/ui-parity/interfaces/ui-parity-artifact-layout.md +23 -0
- package/sdd/99_toolchain/01_automation/ui-parity/interfaces/ui-parity-proof-interface.md +60 -0
- package/sdd/99_toolchain/01_automation/ui-parity/interfaces/ui-parity-route-gap-interface.md +82 -0
- package/sdd/99_toolchain/01_automation/ui-parity/runtime/playwright-runtime.mjs +16 -0
- package/sdd/99_toolchain/01_automation/ui-parity/runtime/static-runtime.mjs +6 -0
- package/sdd/99_toolchain/02_policies/.gitkeep +1 -0
- package/sdd/99_toolchain/02_policies/build-ast-governance-policy.md +22 -0
- package/sdd/99_toolchain/02_policies/compose-runtime-baseline-policy.md +24 -0
- package/sdd/99_toolchain/02_policies/convention-storage-policy.md +26 -0
- package/sdd/99_toolchain/02_policies/main-push-before-dev-deploy-policy.md +27 -0
- package/sdd/99_toolchain/02_policies/otro-orchestration-policy.md +30 -0
- package/sdd/99_toolchain/02_policies/regression-verification-policy.md +22 -0
- package/sdd/99_toolchain/03_templates/.gitkeep +1 -0
- package/sdd/99_toolchain/03_templates/asset_recipe_manifest.example.py +38 -0
- package/sdd/99_toolchain/03_templates/generated_assets/README.md +11 -0
- package/sdd/99_toolchain/03_templates/generated_assets/example-brand-lockup.svg +3 -0
- package/sdd/99_toolchain/03_templates/generated_assets/example-brand-mark.svg +3 -0
- package/sdd/99_toolchain/03_templates/generated_assets/example-brand-wordmark.svg +3 -0
- package/sdd/99_toolchain/03_templates/playwright_exactness_manifest.example.py +21 -0
- package/sdd/99_toolchain/README.md +23 -0
- package/sdd/README.md +21 -0
- package/server/.dockerignore +4 -0
- package/server/.env.example +19 -0
- package/server/Dockerfile +22 -0
- package/server/Dockerfile.dev +19 -0
- package/server/README.md +33 -0
- package/server/__init__.py +0 -0
- package/server/api/__init__.py +1 -0
- package/server/api/http/__init__.py +4 -0
- package/server/api/http/app.py +53 -0
- package/server/api/http/router.py +24 -0
- package/server/config.py +52 -0
- package/server/contexts/__init__.py +12 -0
- package/server/contexts/alerts/__init__.py +1 -0
- package/server/contexts/alerts/application/__init__.py +13 -0
- package/server/contexts/alerts/application/services.py +41 -0
- package/server/contexts/alerts/contracts/__init__.py +3 -0
- package/server/contexts/alerts/contracts/http/__init__.py +3 -0
- package/server/contexts/alerts/contracts/http/router.py +37 -0
- package/server/contexts/alerts/domain/__init__.py +15 -0
- package/server/contexts/alerts/domain/models.py +29 -0
- package/server/contexts/alerts/infrastructure/__init__.py +11 -0
- package/server/contexts/alerts/infrastructure/repository.py +41 -0
- package/server/contexts/auth/__init__.py +1 -0
- package/server/contexts/auth/application/__init__.py +3 -0
- package/server/contexts/auth/application/ports.py +10 -0
- package/server/contexts/auth/application/services.py +64 -0
- package/server/contexts/auth/contracts/__init__.py +4 -0
- package/server/contexts/auth/contracts/http/__init__.py +4 -0
- package/server/contexts/auth/contracts/http/dependencies.py +37 -0
- package/server/contexts/auth/contracts/http/router.py +19 -0
- package/server/contexts/auth/domain/__init__.py +3 -0
- package/server/contexts/auth/domain/models.py +24 -0
- package/server/contexts/auth/infrastructure/__init__.py +4 -0
- package/server/contexts/auth/infrastructure/adapters/memory.py +19 -0
- package/server/contexts/auth/infrastructure/adapters/mongodb.py +24 -0
- package/server/contexts/auth/infrastructure/adapters/sqlalchemy.py +74 -0
- package/server/contexts/auth/infrastructure/repository.py +28 -0
- package/server/contexts/catalog/__init__.py +1 -0
- package/server/contexts/catalog/application/__init__.py +28 -0
- package/server/contexts/catalog/application/ports.py +15 -0
- package/server/contexts/catalog/application/services.py +154 -0
- package/server/contexts/catalog/contracts/__init__.py +3 -0
- package/server/contexts/catalog/contracts/http/__init__.py +3 -0
- package/server/contexts/catalog/contracts/http/router.py +60 -0
- package/server/contexts/catalog/domain/__init__.py +45 -0
- package/server/contexts/catalog/domain/models.py +113 -0
- package/server/contexts/catalog/infrastructure/__init__.py +4 -0
- package/server/contexts/catalog/infrastructure/adapters/memory.py +62 -0
- package/server/contexts/catalog/infrastructure/repository.py +8 -0
- package/server/contexts/fulfillment/__init__.py +1 -0
- package/server/contexts/fulfillment/application/__init__.py +13 -0
- package/server/contexts/fulfillment/application/ports.py +20 -0
- package/server/contexts/fulfillment/application/services.py +85 -0
- package/server/contexts/fulfillment/contracts/__init__.py +3 -0
- package/server/contexts/fulfillment/contracts/http/__init__.py +3 -0
- package/server/contexts/fulfillment/contracts/http/router.py +40 -0
- package/server/contexts/fulfillment/domain/__init__.py +25 -0
- package/server/contexts/fulfillment/domain/models.py +73 -0
- package/server/contexts/fulfillment/infrastructure/__init__.py +13 -0
- package/server/contexts/fulfillment/infrastructure/adapters/memory.py +43 -0
- package/server/contexts/fulfillment/infrastructure/repository.py +97 -0
- package/server/contexts/health/__init__.py +1 -0
- package/server/contexts/health/application/__init__.py +3 -0
- package/server/contexts/health/application/services.py +2 -0
- package/server/contexts/health/contracts/__init__.py +3 -0
- package/server/contexts/health/contracts/http/__init__.py +3 -0
- package/server/contexts/health/contracts/http/router.py +10 -0
- package/server/contexts/inventory/__init__.py +1 -0
- package/server/contexts/inventory/application/__init__.py +28 -0
- package/server/contexts/inventory/application/ports.py +11 -0
- package/server/contexts/inventory/application/services.py +214 -0
- package/server/contexts/inventory/contracts/__init__.py +3 -0
- package/server/contexts/inventory/contracts/http/__init__.py +3 -0
- package/server/contexts/inventory/contracts/http/router.py +82 -0
- package/server/contexts/inventory/domain/__init__.py +33 -0
- package/server/contexts/inventory/domain/models.py +93 -0
- package/server/contexts/inventory/infrastructure/__init__.py +4 -0
- package/server/contexts/inventory/infrastructure/adapters/memory.py +24 -0
- package/server/contexts/inventory/infrastructure/repository.py +8 -0
- package/server/contexts/orders/__init__.py +1 -0
- package/server/contexts/orders/application/__init__.py +19 -0
- package/server/contexts/orders/application/services.py +127 -0
- package/server/contexts/orders/contracts/__init__.py +3 -0
- package/server/contexts/orders/contracts/http/__init__.py +3 -0
- package/server/contexts/orders/contracts/http/router.py +82 -0
- package/server/contexts/orders/domain/__init__.py +29 -0
- package/server/contexts/orders/domain/models.py +95 -0
- package/server/contexts/orders/infrastructure/__init__.py +7 -0
- package/server/contexts/orders/infrastructure/repository.py +104 -0
- package/server/contexts/shipping/__init__.py +1 -0
- package/server/contexts/shipping/application/__init__.py +13 -0
- package/server/contexts/shipping/application/services.py +92 -0
- package/server/contexts/shipping/contracts/__init__.py +3 -0
- package/server/contexts/shipping/contracts/http/__init__.py +3 -0
- package/server/contexts/shipping/contracts/http/router.py +40 -0
- package/server/contexts/shipping/domain/__init__.py +19 -0
- package/server/contexts/shipping/domain/models.py +48 -0
- package/server/contexts/shipping/infrastructure/__init__.py +9 -0
- package/server/contexts/shipping/infrastructure/repository.py +50 -0
- package/server/contexts/support/__init__.py +1 -0
- package/server/contexts/support/application/__init__.py +13 -0
- package/server/contexts/support/application/services.py +29 -0
- package/server/contexts/support/contracts/__init__.py +3 -0
- package/server/contexts/support/contracts/http/__init__.py +3 -0
- package/server/contexts/support/contracts/http/router.py +40 -0
- package/server/contexts/support/domain/__init__.py +13 -0
- package/server/contexts/support/domain/models.py +27 -0
- package/server/contexts/support/infrastructure/__init__.py +11 -0
- package/server/contexts/support/infrastructure/repository.py +70 -0
- package/server/contexts/user/__init__.py +1 -0
- package/server/contexts/user/application/__init__.py +3 -0
- package/server/contexts/user/application/ports.py +11 -0
- package/server/contexts/user/application/services.py +44 -0
- package/server/contexts/user/contracts/__init__.py +3 -0
- package/server/contexts/user/contracts/http/__init__.py +3 -0
- package/server/contexts/user/contracts/http/router.py +26 -0
- package/server/contexts/user/domain/__init__.py +3 -0
- package/server/contexts/user/domain/models.py +22 -0
- package/server/contexts/user/infrastructure/__init__.py +3 -0
- package/server/contexts/user/infrastructure/adapters/memory.py +27 -0
- package/server/contexts/user/infrastructure/adapters/mongodb.py +41 -0
- package/server/contexts/user/infrastructure/adapters/sqlalchemy.py +94 -0
- package/server/contexts/user/infrastructure/factory.py +28 -0
- package/server/data/README.md +24 -0
- package/server/data/bootstrap/alerts.json +38 -0
- package/server/data/bootstrap/auth_accounts.json +18 -0
- package/server/data/bootstrap/catalog_products.json +179 -0
- package/server/data/bootstrap/fulfillment_events.json +5 -0
- package/server/data/bootstrap/fulfillment_notes.json +5 -0
- package/server/data/bootstrap/fulfillment_tasks.json +50 -0
- package/server/data/bootstrap/inventory_levels.json +80 -0
- package/server/data/bootstrap/orders.json +62 -0
- package/server/data/bootstrap/shipping_shipments.json +50 -0
- package/server/data/bootstrap/support_faqs.json +26 -0
- package/server/data/bootstrap/users.json +20 -0
- package/server/data/bootstrap_loader.py +15 -0
- package/server/docker-entrypoint.sh +56 -0
- package/server/main.py +3 -0
- package/server/pyproject.toml +36 -0
- package/server/shared/__init__.py +1 -0
- package/server/shared/application/__init__.py +3 -0
- package/server/shared/application/health.py +2 -0
- package/server/shared/infrastructure/__init__.py +10 -0
- package/server/shared/infrastructure/runtime.py +6 -0
- package/server/shared/infrastructure/security.py +33 -0
- package/server/tests/e2e/test_domain_feature_flows.py +483 -0
- package/server/tests/test_health.py +49 -0
- package/server/uv.lock +1169 -0
- package/bin/agentic-dev.js +0 -9
- package/src/cli.js +0 -37
- package/src/init-command.js +0 -230
- package/src/lib/command.js +0 -14
- package/src/lib/fs.js +0 -92
- package/src/lib/git.js +0 -57
- package/src/lib/github.js +0 -77
- package/src/lib/prompt.js +0 -52
- package/src/lib/system.js +0 -15
- package/src/lib/template.js +0 -143
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL as string | undefined)?.replace(/\/$/, "") ?? "";
|
|
2
|
+
|
|
3
|
+
interface RequestOptions {
|
|
4
|
+
accessToken?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async function readJson<T>(response: Response): Promise<T> {
|
|
8
|
+
if (!response.ok) {
|
|
9
|
+
let message = "Request failed";
|
|
10
|
+
try {
|
|
11
|
+
const data = (await response.json()) as { detail?: string };
|
|
12
|
+
if (typeof data.detail === "string" && data.detail.length > 0) {
|
|
13
|
+
message = data.detail;
|
|
14
|
+
}
|
|
15
|
+
} catch {
|
|
16
|
+
message = response.statusText || message;
|
|
17
|
+
}
|
|
18
|
+
throw new Error(message);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (await response.json()) as T;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function apiGet<T>(path: string, options?: RequestOptions): Promise<T> {
|
|
25
|
+
const response = await fetch(`${API_BASE_URL}${path}`, {
|
|
26
|
+
headers: options?.accessToken ? { Authorization: `Bearer ${options.accessToken}` } : undefined,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return readJson<T>(response);
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { apiGet } from "@/api/client";
|
|
2
|
+
|
|
3
|
+
export interface DashboardStat {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
tone?: string | null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface OrderActivity {
|
|
10
|
+
order_id: string;
|
|
11
|
+
date: string;
|
|
12
|
+
customer: string;
|
|
13
|
+
status: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SelectedOrder {
|
|
17
|
+
product_name: string;
|
|
18
|
+
customer_name: string;
|
|
19
|
+
status: string;
|
|
20
|
+
amount: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface OrderOverviewResponse {
|
|
24
|
+
stats: DashboardStat[];
|
|
25
|
+
recent_activity: OrderActivity[];
|
|
26
|
+
selected_order: SelectedOrder;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OrderSummary {
|
|
30
|
+
id: string;
|
|
31
|
+
product_name: string;
|
|
32
|
+
customer_name: string;
|
|
33
|
+
status: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function fetchOrderOverview(accessToken: string) {
|
|
37
|
+
return apiGet<OrderOverviewResponse>("/orders/overview", { accessToken });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function fetchOrders(accessToken: string) {
|
|
41
|
+
return apiGet<OrderSummary[]>("/orders", { accessToken });
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Route, Routes } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
import { ProtectedRoute } from "@/auth/ProtectedRoute";
|
|
4
|
+
import { AppShell } from "@/components/AppShell";
|
|
5
|
+
import { DashboardPage } from "@/pages/DashboardPage";
|
|
6
|
+
import { LoginPage } from "@/pages/LoginPage";
|
|
7
|
+
import { OrdersPage } from "@/pages/OrdersPage";
|
|
8
|
+
|
|
9
|
+
export function App() {
|
|
10
|
+
return (
|
|
11
|
+
<Routes>
|
|
12
|
+
<Route path="/login" element={<LoginPage />} />
|
|
13
|
+
<Route element={<ProtectedRoute />}>
|
|
14
|
+
<Route element={<AppShell />}>
|
|
15
|
+
<Route path="/" element={<DashboardPage />} />
|
|
16
|
+
<Route path="/orders" element={<OrdersPage />} />
|
|
17
|
+
</Route>
|
|
18
|
+
</Route>
|
|
19
|
+
</Routes>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useMemo, useState, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
import { getMe, login as loginRequest } from "@/auth/auth-client";
|
|
4
|
+
import type { AuthToken, AuthUser, LoginCommand } from "@/auth/types";
|
|
5
|
+
|
|
6
|
+
const STORAGE_KEY = "platform.auth.token";
|
|
7
|
+
|
|
8
|
+
interface AuthContextValue {
|
|
9
|
+
user: AuthUser | null;
|
|
10
|
+
token: AuthToken | null;
|
|
11
|
+
initializing: boolean;
|
|
12
|
+
authenticating: boolean;
|
|
13
|
+
login: (command: LoginCommand) => Promise<void>;
|
|
14
|
+
logout: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const AuthContext = createContext<AuthContextValue | undefined>(undefined);
|
|
18
|
+
|
|
19
|
+
function readStoredToken(): AuthToken | null {
|
|
20
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
21
|
+
if (!raw) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(raw) as AuthToken;
|
|
27
|
+
} catch {
|
|
28
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function storeToken(token: AuthToken | null) {
|
|
34
|
+
if (token) {
|
|
35
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(token));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
window.localStorage.removeItem(STORAGE_KEY);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function AuthProvider({ children }: { children: ReactNode }) {
|
|
43
|
+
const [token, setToken] = useState<AuthToken | null>(() => readStoredToken());
|
|
44
|
+
const [user, setUser] = useState<AuthUser | null>(null);
|
|
45
|
+
const [initializing, setInitializing] = useState(true);
|
|
46
|
+
const [authenticating, setAuthenticating] = useState(false);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
let cancelled = false;
|
|
50
|
+
|
|
51
|
+
async function bootstrap() {
|
|
52
|
+
if (!token) {
|
|
53
|
+
setUser(null);
|
|
54
|
+
setInitializing(false);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
const currentUser = await getMe(token.access_token);
|
|
60
|
+
if (!cancelled) {
|
|
61
|
+
setUser(currentUser);
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
if (!cancelled) {
|
|
65
|
+
setToken(null);
|
|
66
|
+
setUser(null);
|
|
67
|
+
storeToken(null);
|
|
68
|
+
}
|
|
69
|
+
} finally {
|
|
70
|
+
if (!cancelled) {
|
|
71
|
+
setInitializing(false);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void bootstrap();
|
|
77
|
+
|
|
78
|
+
return () => {
|
|
79
|
+
cancelled = true;
|
|
80
|
+
};
|
|
81
|
+
}, [token]);
|
|
82
|
+
|
|
83
|
+
const value = useMemo<AuthContextValue>(
|
|
84
|
+
() => ({
|
|
85
|
+
user,
|
|
86
|
+
token,
|
|
87
|
+
initializing,
|
|
88
|
+
authenticating,
|
|
89
|
+
async login(command) {
|
|
90
|
+
setAuthenticating(true);
|
|
91
|
+
try {
|
|
92
|
+
const nextToken = await loginRequest(command);
|
|
93
|
+
storeToken(nextToken);
|
|
94
|
+
setToken(nextToken);
|
|
95
|
+
const currentUser = await getMe(nextToken.access_token);
|
|
96
|
+
setUser(currentUser);
|
|
97
|
+
} finally {
|
|
98
|
+
setAuthenticating(false);
|
|
99
|
+
setInitializing(false);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
logout() {
|
|
103
|
+
storeToken(null);
|
|
104
|
+
setToken(null);
|
|
105
|
+
setUser(null);
|
|
106
|
+
setInitializing(false);
|
|
107
|
+
},
|
|
108
|
+
}),
|
|
109
|
+
[authenticating, initializing, token, user],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function useAuth() {
|
|
116
|
+
const context = useContext(AuthContext);
|
|
117
|
+
if (!context) {
|
|
118
|
+
throw new Error("useAuth must be used within an AuthProvider");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return context;
|
|
122
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Navigate, Outlet, useLocation } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
import { useAuth } from "@/auth/AuthProvider";
|
|
4
|
+
|
|
5
|
+
export function ProtectedRoute() {
|
|
6
|
+
const { initializing, user } = useAuth();
|
|
7
|
+
const location = useLocation();
|
|
8
|
+
|
|
9
|
+
if (initializing) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="flex min-h-screen items-center justify-center bg-[var(--app-shell-bg)] text-sm font-medium text-[#5f6e86]">
|
|
12
|
+
세션을 확인하는 중입니다.
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!user) {
|
|
18
|
+
return <Navigate to="/login" replace state={{ from: location }} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return <Outlet />;
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AuthToken, AuthUser, LoginCommand } from "@/auth/types";
|
|
2
|
+
|
|
3
|
+
const API_BASE_URL = (import.meta.env.VITE_API_BASE_URL as string | undefined)?.replace(/\/$/, "") ?? "";
|
|
4
|
+
|
|
5
|
+
async function readJson<T>(response: Response): Promise<T> {
|
|
6
|
+
if (!response.ok) {
|
|
7
|
+
let message = "Request failed";
|
|
8
|
+
try {
|
|
9
|
+
const data = (await response.json()) as { detail?: string };
|
|
10
|
+
if (typeof data.detail === "string" && data.detail.length > 0) {
|
|
11
|
+
message = data.detail;
|
|
12
|
+
}
|
|
13
|
+
} catch {
|
|
14
|
+
message = response.statusText || message;
|
|
15
|
+
}
|
|
16
|
+
throw new Error(message);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (await response.json()) as T;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export async function login(command: LoginCommand): Promise<AuthToken> {
|
|
23
|
+
const response = await fetch(`${API_BASE_URL}/auth/login`, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: { "Content-Type": "application/json" },
|
|
26
|
+
body: JSON.stringify(command),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return readJson<AuthToken>(response);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function getMe(accessToken: string): Promise<AuthUser> {
|
|
33
|
+
const response = await fetch(`${API_BASE_URL}/auth/me`, {
|
|
34
|
+
headers: { Authorization: `Bearer ${accessToken}` },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return readJson<AuthUser>(response);
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface AuthToken {
|
|
2
|
+
access_token: string;
|
|
3
|
+
token_type: string;
|
|
4
|
+
user_id: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface AuthUser {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
role: string;
|
|
12
|
+
status: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface LoginCommand {
|
|
16
|
+
email: string;
|
|
17
|
+
password: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Bell, Search } from "lucide-react";
|
|
2
|
+
import { NavLink, Outlet } from "react-router-dom";
|
|
3
|
+
|
|
4
|
+
import { useAuth } from "@/auth/AuthProvider";
|
|
5
|
+
import { Button } from "@/components/ui/button";
|
|
6
|
+
import { Input } from "@/components/ui/input";
|
|
7
|
+
import { appTheme } from "@/theme";
|
|
8
|
+
import { appThemeVars } from "@/theme-vars";
|
|
9
|
+
|
|
10
|
+
const navItems = [
|
|
11
|
+
{ to: "/", label: "Overview" },
|
|
12
|
+
{ to: "/orders", label: "Orders" },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export function AppShell() {
|
|
16
|
+
const { logout, user } = useAuth();
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div className="min-h-screen bg-[var(--app-shell-bg)] text-[#22314d]" style={appThemeVars(appTheme)}>
|
|
20
|
+
<header className="border-b border-[var(--app-border)] bg-white">
|
|
21
|
+
<div className="mx-auto flex max-w-7xl items-center gap-6 px-6 py-4">
|
|
22
|
+
<div className="font-black tracking-[0.18em] text-[#16253f]">PRODUCT</div>
|
|
23
|
+
<nav className="flex items-center gap-2">
|
|
24
|
+
{navItems.map((item) => (
|
|
25
|
+
<NavLink
|
|
26
|
+
key={item.to}
|
|
27
|
+
to={item.to}
|
|
28
|
+
end={item.to === "/"}
|
|
29
|
+
className={({ isActive }) =>
|
|
30
|
+
`rounded-full px-4 py-2 text-sm font-semibold ${isActive ? "bg-[#eef2ff] text-[#223a82]" : "text-[#6b7890]"}`
|
|
31
|
+
}
|
|
32
|
+
>
|
|
33
|
+
{item.label}
|
|
34
|
+
</NavLink>
|
|
35
|
+
))}
|
|
36
|
+
</nav>
|
|
37
|
+
<div className="ml-auto flex items-center gap-3">
|
|
38
|
+
<div className="relative w-[280px]">
|
|
39
|
+
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-[#8d97a8]" />
|
|
40
|
+
<Input className="pl-9" placeholder="Search workspace" />
|
|
41
|
+
</div>
|
|
42
|
+
<button className="inline-flex h-10 w-10 items-center justify-center rounded-full border border-[var(--app-border)] bg-white">
|
|
43
|
+
<Bell className="h-4 w-4 text-[#5f6e86]" />
|
|
44
|
+
</button>
|
|
45
|
+
<div className="hidden rounded-full bg-[#f7f9fc] px-4 py-2 text-sm font-semibold text-[#314157] md:block">
|
|
46
|
+
{user?.name ?? user?.email}
|
|
47
|
+
</div>
|
|
48
|
+
<Button variant="outline" onClick={logout}>
|
|
49
|
+
Log out
|
|
50
|
+
</Button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</header>
|
|
54
|
+
<main className="mx-auto max-w-7xl px-6 py-6">
|
|
55
|
+
<Outlet />
|
|
56
|
+
</main>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/cn";
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-[#1f3a8a] text-white hover:bg-[#15306f]",
|
|
12
|
+
secondary: "bg-[#eef2ff] text-[#22314d] hover:bg-[#dfe6fb]",
|
|
13
|
+
outline: "border border-[var(--app-border)] bg-white text-[#314157] hover:bg-[#f7f9fc]",
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-10 px-4 py-2",
|
|
17
|
+
sm: "h-9 px-3",
|
|
18
|
+
lg: "h-11 px-5",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
size: "default",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {}
|
|
29
|
+
|
|
30
|
+
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(({ className, variant, size, ...props }, ref) => {
|
|
31
|
+
return <button ref={ref} className={cn(buttonVariants({ variant, size }), className)} {...props} />;
|
|
32
|
+
});
|
|
33
|
+
Button.displayName = "Button";
|
|
34
|
+
|
|
35
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/cn";
|
|
4
|
+
|
|
5
|
+
export function Card({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
|
6
|
+
return <div className={cn("rounded-[var(--app-card-radius)] border border-[var(--app-border)] bg-white", className)} {...props} />;
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/cn";
|
|
4
|
+
|
|
5
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {}
|
|
6
|
+
|
|
7
|
+
const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, ...props }, ref) => {
|
|
8
|
+
return (
|
|
9
|
+
<input
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn(
|
|
12
|
+
"flex h-10 w-full rounded-md border border-[var(--app-border)] bg-white px-3 py-2 text-sm text-[#22314d] outline-none placeholder:text-[#8d97a8] focus:ring-2 focus:ring-[#bfd0ff]",
|
|
13
|
+
className,
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
Input.displayName = "Input";
|
|
20
|
+
|
|
21
|
+
export { Input };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "TMP_001",
|
|
4
|
+
"route": "/",
|
|
5
|
+
"binding": "direct",
|
|
6
|
+
"notes": ["Primary signed-in workspace route."],
|
|
7
|
+
"tags": ["shell"]
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "TMP_002",
|
|
11
|
+
"route": "/orders",
|
|
12
|
+
"binding": "direct",
|
|
13
|
+
"notes": ["Collection route for the order table."],
|
|
14
|
+
"tags": ["table"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "TMP_003",
|
|
18
|
+
"route": "/login",
|
|
19
|
+
"binding": "direct",
|
|
20
|
+
"notes": ["Unauthenticated entry route."],
|
|
21
|
+
"tags": ["public"]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import { BrowserRouter } from "react-router-dom";
|
|
4
|
+
|
|
5
|
+
import { AuthProvider } from "@/auth/AuthProvider";
|
|
6
|
+
import { App } from "./app/App";
|
|
7
|
+
import "./styles/globals.css";
|
|
8
|
+
|
|
9
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
10
|
+
<React.StrictMode>
|
|
11
|
+
<AuthProvider>
|
|
12
|
+
<BrowserRouter>
|
|
13
|
+
<App />
|
|
14
|
+
</BrowserRouter>
|
|
15
|
+
</AuthProvider>
|
|
16
|
+
</React.StrictMode>,
|
|
17
|
+
);
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { useAuth } from "@/auth/AuthProvider";
|
|
4
|
+
import { fetchOrderOverview, type OrderOverviewResponse } from "@/api/orders";
|
|
5
|
+
import { Card } from "@/components/ui/card";
|
|
6
|
+
|
|
7
|
+
export function DashboardPage() {
|
|
8
|
+
const { token } = useAuth();
|
|
9
|
+
const [overview, setOverview] = useState<OrderOverviewResponse | null>(null);
|
|
10
|
+
const [loading, setLoading] = useState(true);
|
|
11
|
+
const [error, setError] = useState<string | null>(null);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!token?.access_token) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
|
|
20
|
+
setLoading(true);
|
|
21
|
+
setError(null);
|
|
22
|
+
|
|
23
|
+
fetchOrderOverview(token.access_token)
|
|
24
|
+
.then((response) => {
|
|
25
|
+
if (!cancelled) {
|
|
26
|
+
setOverview(response);
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
.catch((nextError: Error) => {
|
|
30
|
+
if (!cancelled) {
|
|
31
|
+
setError(nextError.message);
|
|
32
|
+
setOverview(null);
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
.finally(() => {
|
|
36
|
+
if (!cancelled) {
|
|
37
|
+
setLoading(false);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return () => {
|
|
42
|
+
cancelled = true;
|
|
43
|
+
};
|
|
44
|
+
}, [token?.access_token]);
|
|
45
|
+
|
|
46
|
+
const recentActivity = overview?.recent_activity ?? [];
|
|
47
|
+
const selectedOrder = overview?.selected_order;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div className="grid gap-6 xl:grid-cols-[1fr_var(--app-panel-width)]">
|
|
51
|
+
<div className="space-y-6">
|
|
52
|
+
<section className="grid gap-4 md:grid-cols-3">
|
|
53
|
+
{(overview?.stats ?? []).map((stat) => (
|
|
54
|
+
<Card key={stat.label} className="p-[var(--app-card-padding)]">
|
|
55
|
+
<p className="text-sm text-[var(--app-muted)]">{stat.label}</p>
|
|
56
|
+
<p className={`mt-3 text-3xl font-bold ${stat.tone ?? "text-[#22314d]"}`}>{stat.value}</p>
|
|
57
|
+
</Card>
|
|
58
|
+
))}
|
|
59
|
+
{loading && !overview ? (
|
|
60
|
+
<Card className="p-[var(--app-card-padding)] md:col-span-3">
|
|
61
|
+
<p className="text-sm text-[var(--app-muted)]">Overview</p>
|
|
62
|
+
<p className="mt-3 text-lg font-semibold text-[#22314d]">Loading dashboard data...</p>
|
|
63
|
+
</Card>
|
|
64
|
+
) : null}
|
|
65
|
+
{error ? (
|
|
66
|
+
<Card className="p-[var(--app-card-padding)] md:col-span-3">
|
|
67
|
+
<p className="text-sm text-[var(--app-muted)]">Overview</p>
|
|
68
|
+
<p className="mt-3 text-lg font-semibold text-[var(--app-danger)]">{error}</p>
|
|
69
|
+
</Card>
|
|
70
|
+
) : null}
|
|
71
|
+
</section>
|
|
72
|
+
|
|
73
|
+
<Card className="overflow-hidden">
|
|
74
|
+
<div className="p-[var(--app-card-padding)]">
|
|
75
|
+
<h2 className="text-lg font-bold">Recent activity</h2>
|
|
76
|
+
</div>
|
|
77
|
+
<table className="w-full border-collapse text-sm">
|
|
78
|
+
<thead className="bg-[#f8fafe] text-left text-[#516174]">
|
|
79
|
+
<tr>
|
|
80
|
+
{["Order", "Date", "Customer", "Status"].map((cell) => (
|
|
81
|
+
<th key={cell} className="border-y border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)] font-semibold">
|
|
82
|
+
{cell}
|
|
83
|
+
</th>
|
|
84
|
+
))}
|
|
85
|
+
</tr>
|
|
86
|
+
</thead>
|
|
87
|
+
<tbody>
|
|
88
|
+
{loading && !recentActivity.length ? (
|
|
89
|
+
<tr>
|
|
90
|
+
<td className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)] text-[var(--app-muted)]" colSpan={4}>
|
|
91
|
+
Recent activity is loading.
|
|
92
|
+
</td>
|
|
93
|
+
</tr>
|
|
94
|
+
) : null}
|
|
95
|
+
{error ? (
|
|
96
|
+
<tr>
|
|
97
|
+
<td
|
|
98
|
+
className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)] text-[var(--app-danger)]"
|
|
99
|
+
colSpan={4}
|
|
100
|
+
>
|
|
101
|
+
{error}
|
|
102
|
+
</td>
|
|
103
|
+
</tr>
|
|
104
|
+
) : null}
|
|
105
|
+
{!loading && !error && !recentActivity.length ? (
|
|
106
|
+
<tr>
|
|
107
|
+
<td className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)] text-[var(--app-muted)]" colSpan={4}>
|
|
108
|
+
No recent activity found.
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
) : null}
|
|
112
|
+
{recentActivity.map((row) => (
|
|
113
|
+
<tr key={row.order_id}>
|
|
114
|
+
<td className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)] text-[var(--app-accent)]">
|
|
115
|
+
{row.order_id}
|
|
116
|
+
</td>
|
|
117
|
+
<td className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)]">{row.date}</td>
|
|
118
|
+
<td className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)]">{row.customer}</td>
|
|
119
|
+
<td className="border-b border-[var(--app-border)] px-[var(--app-table-cell-px)] py-[var(--app-table-cell-py)]">
|
|
120
|
+
<span className={row.status === "At risk" ? "text-[var(--app-danger)]" : ""}>{row.status}</span>
|
|
121
|
+
</td>
|
|
122
|
+
</tr>
|
|
123
|
+
))}
|
|
124
|
+
</tbody>
|
|
125
|
+
</table>
|
|
126
|
+
</Card>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<Card className="p-[var(--app-card-padding)]">
|
|
130
|
+
<h2 className="text-lg font-bold">Selected detail</h2>
|
|
131
|
+
{loading && !selectedOrder ? <p className="mt-5 text-sm text-[var(--app-muted)]">Loading selected order...</p> : null}
|
|
132
|
+
{error ? <p className="mt-5 text-sm font-semibold text-[var(--app-danger)]">{error}</p> : null}
|
|
133
|
+
{selectedOrder ? (
|
|
134
|
+
<div className="mt-5 space-y-4 text-sm">
|
|
135
|
+
<div>
|
|
136
|
+
<p className="text-[var(--app-muted)]">Product</p>
|
|
137
|
+
<p className="mt-1 font-semibold">{selectedOrder.product_name}</p>
|
|
138
|
+
</div>
|
|
139
|
+
<div>
|
|
140
|
+
<p className="text-[var(--app-muted)]">Customer</p>
|
|
141
|
+
<p className="mt-1 font-semibold">{selectedOrder.customer_name}</p>
|
|
142
|
+
</div>
|
|
143
|
+
<div>
|
|
144
|
+
<p className="text-[var(--app-muted)]">Status</p>
|
|
145
|
+
<p className={`mt-1 font-semibold ${selectedOrder.status === "At risk" ? "text-[var(--app-danger)]" : "text-[#314157]"}`}>
|
|
146
|
+
{selectedOrder.status}
|
|
147
|
+
</p>
|
|
148
|
+
</div>
|
|
149
|
+
<div>
|
|
150
|
+
<p className="text-[var(--app-muted)]">Amount</p>
|
|
151
|
+
<p className="mt-1 font-semibold">{selectedOrder.amount}</p>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
) : null}
|
|
155
|
+
</Card>
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
}
|