oneie 2.0.1 → 2.0.3
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/AGENTS.md +245 -0
- package/CLAUDE.md +534 -0
- package/README.md +61 -4
- package/one/.obsidian/app.json +1 -0
- package/one/.obsidian/appearance.json +1 -0
- package/one/.obsidian/core-plugins.json +33 -0
- package/one/.obsidian/workspace.json +211 -0
- package/one/connections/a2a.md +551 -0
- package/one/connections/acp.md +761 -0
- package/one/connections/acps.md +731 -0
- package/one/connections/agui.md +767 -0
- package/one/connections/any-backend.md +1702 -0
- package/one/connections/ap2.md +998 -0
- package/one/connections/api-docs.md +1891 -0
- package/one/connections/api.md +2190 -0
- package/one/connections/architecture-diagram.md +94 -0
- package/one/connections/communications.md +449 -0
- package/one/connections/connections.md +339 -0
- package/one/connections/cryptonetworks.md +781 -0
- package/one/connections/documentation.md +1120 -0
- package/one/connections/effect.md +279 -0
- package/one/connections/elizaos.md +1290 -0
- package/one/connections/inference.md +58 -0
- package/one/connections/kyc.md +632 -0
- package/one/connections/mcp.md +842 -0
- package/one/connections/membership.md +1152 -0
- package/one/connections/middleware.md +1067 -0
- package/one/connections/multitenant.md +1341 -0
- package/one/connections/n8n.md +1015 -0
- package/one/connections/patterns.md +89 -0
- package/one/connections/protocols.md +279 -0
- package/one/connections/relationships.md +107 -0
- package/one/connections/schema.md +587 -0
- package/one/connections/service-layer.md +550 -0
- package/one/connections/structure.md +0 -0
- package/one/connections/vectors.md +207 -0
- package/one/connections/wordpress.md +1302 -0
- package/one/connections/workflow-copy.md +905 -0
- package/one/connections/workflow-examples.md +741 -0
- package/one/connections/workflow.md +905 -0
- package/one/connections/workflows/delegation.md +885 -0
- package/one/connections/workflows/frontend.md +1037 -0
- package/one/connections/workflows/strategy.md +903 -0
- package/one/connections/workflows/tasks.md +698 -0
- package/one/connections/x402.md +1249 -0
- package/one/events/events.md +545 -0
- package/one/knowledge/ai-platform.md +305 -0
- package/one/knowledge/architecture-diagram.md +94 -0
- package/one/knowledge/architecture-frontend.md +930 -0
- package/one/knowledge/architecture.md +2077 -0
- package/one/knowledge/crypto.md +960 -0
- package/one/knowledge/dsl.md +1660 -0
- package/one/knowledge/files.md +2471 -0
- package/one/knowledge/frontend.md +1038 -0
- package/one/knowledge/hono.md +2109 -0
- package/one/knowledge/implementation-examples.md +2536 -0
- package/one/knowledge/inference-score.md +159 -0
- package/one/knowledge/knowledge.md +642 -0
- package/one/knowledge/language.md +980 -0
- package/one/knowledge/lessons-learned.md +70 -0
- package/one/knowledge/ontology-6-dimensions.md +0 -0
- package/one/knowledge/ontology-documentation.md +356 -0
- package/one/knowledge/ontology-engineering-specification.md +1292 -0
- package/one/knowledge/ontology-engineering.md +1652 -0
- package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
- package/one/knowledge/ontology-frontend-copy.md +753 -0
- package/one/knowledge/ontology-frontend-specifications.md +2188 -0
- package/one/knowledge/ontology-frontend.md +2427 -0
- package/one/knowledge/ontology-minimal.yaml +299 -0
- package/one/knowledge/ontology.md +2819 -0
- package/one/knowledge/ontology.yaml +1165 -0
- package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
- package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
- package/one/knowledge/patterns/backend/mutation-template.md +231 -0
- package/one/knowledge/patterns/backend/query-template.md +267 -0
- package/one/knowledge/patterns/backend/service-template.md +237 -0
- package/one/knowledge/patterns/design/component-architecture.md +399 -0
- package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
- package/one/knowledge/patterns/design/wireframe-template.md +216 -0
- package/one/knowledge/patterns/frontend/component-template.md +195 -0
- package/one/knowledge/patterns/frontend/form-template.md +276 -0
- package/one/knowledge/patterns/frontend/page-template.md +178 -0
- package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
- package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
- package/one/knowledge/patterns/test/technical-test-template.md +544 -0
- package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
- package/one/knowledge/patterns/test/user-flow-template.md +254 -0
- package/one/knowledge/quality-loop.md +401 -0
- package/one/knowledge/readme.md +131 -0
- package/one/knowledge/rules.md +626 -0
- package/one/knowledge/score.md +67 -0
- package/one/knowledge/specifications.md +855 -0
- package/one/knowledge/tags.md +130 -0
- package/one/organisation/one.md +599 -0
- package/one/organisation/organisation.md +438 -0
- package/one/organisation/revenue.md +673 -0
- package/one/organisation/strategy.md +869 -0
- package/one/organisation/vision.md +98 -0
- package/one/people/anthony-o-connell.md +440 -0
- package/one/people/people.md +567 -0
- package/one/repomix-output.md +92634 -0
- package/one/things/agentkit.md +349 -0
- package/one/things/agents/agent-backend.md +1401 -0
- package/one/things/agents/agent-builder.md +955 -0
- package/one/things/agents/agent-clean.md +709 -0
- package/one/things/agents/agent-clone.md +1341 -0
- package/one/things/agents/agent-designer.md +2177 -0
- package/one/things/agents/agent-director.md +1508 -0
- package/one/things/agents/agent-documenter.md +1049 -0
- package/one/things/agents/agent-frontend.md +1119 -0
- package/one/things/agents/agent-integrator.md +1192 -0
- package/one/things/agents/agent-problem-solver.md +1379 -0
- package/one/things/agents/agent-quality.md +1353 -0
- package/one/things/agents/agent-sales.md +986 -0
- package/one/things/cascade/cascade.yaml +464 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
- package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
- package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
- package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
- package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
- package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
- package/one/things/cascade/docs/examples/readme.md +222 -0
- package/one/things/cascade/docs/getting-started.md +515 -0
- package/one/things/cascade/docs/workflow.md +1372 -0
- package/one/things/cascade/readme.md +336 -0
- package/one/things/cascade/templates/feature-template.md +267 -0
- package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
- package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
- package/one/things/claude/agents/analyst.md +483 -0
- package/one/things/claude/agents/architect.md +480 -0
- package/one/things/claude/agents/brand-identity-specialist.md +513 -0
- package/one/things/claude/agents/bstp-token-strategist.md +667 -0
- package/one/things/claude/agents/builder-repo.md +489 -0
- package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
- package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
- package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
- package/one/things/claude/agents/company-bullstamp-character.md +587 -0
- package/one/things/claude/agents/company-bullstamp-community.md +292 -0
- package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
- package/one/things/claude/agents/company-bullstamp-token.md +292 -0
- package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
- package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
- package/one/things/claude/agents/content-calendar-planner.md +448 -0
- package/one/things/claude/agents/content-chapter-formatter.md +488 -0
- package/one/things/claude/agents/content-formatter.md +546 -0
- package/one/things/claude/agents/content-hook-specialist.md +462 -0
- package/one/things/claude/agents/content-image-formatter.md +535 -0
- package/one/things/claude/agents/content-introduction-formatter.md +485 -0
- package/one/things/claude/agents/content-multiplication-engine.md +556 -0
- package/one/things/claude/agents/content-playbook-writer.md +448 -0
- package/one/things/claude/agents/content-team-manager.md +622 -0
- package/one/things/claude/agents/content-toc-formatter.md +522 -0
- package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
- package/one/things/claude/agents/core-manager.md +582 -0
- package/one/things/claude/agents/core-master.md +403 -0
- package/one/things/claude/agents/cross-functional-manager.md +471 -0
- package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
- package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
- package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
- package/one/things/claude/agents/crypto-community-analyst.md +298 -0
- package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
- package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
- package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
- package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
- package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
- package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
- package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
- package/one/things/claude/agents/crypto-market-researcher.md +292 -0
- package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
- package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
- package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
- package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
- package/one/things/claude/agents/crypto-team-manager.md +387 -0
- package/one/things/claude/agents/crypto-token-analyst.md +278 -0
- package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
- package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
- package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
- package/one/things/claude/agents/customer-journey-designer.md +481 -0
- package/one/things/claude/agents/customer-success-manager.md +581 -0
- package/one/things/claude/agents/dev.md +413 -0
- package/one/things/claude/agents/documenter.md +546 -0
- package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
- package/one/things/claude/agents/engagement-specialist.md +509 -0
- package/one/things/claude/agents/engineering-architect.md +387 -0
- package/one/things/claude/agents/engineering-business-analyst.md +537 -0
- package/one/things/claude/agents/engineering-developer.md +387 -0
- package/one/things/claude/agents/engineering-director.md +282 -0
- package/one/things/claude/agents/engineering-ingestor.md +649 -0
- package/one/things/claude/agents/engineering-product-manager.md +537 -0
- package/one/things/claude/agents/engineering-product-owner.md +537 -0
- package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
- package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
- package/one/things/claude/agents/engineering-team-manager.md +512 -0
- package/one/things/claude/agents/engineering-user-experience.md +387 -0
- package/one/things/claude/agents/framework-elevate-manager.md +294 -0
- package/one/things/claude/agents/improver.md +763 -0
- package/one/things/claude/agents/intelligence-team-manager.md +385 -0
- package/one/things/claude/agents/lead-capture-expert.md +466 -0
- package/one/things/claude/agents/lead-magnet-creator.md +453 -0
- package/one/things/claude/agents/market-research-analyst.md +412 -0
- package/one/things/claude/agents/marketing-brand-identity.md +314 -0
- package/one/things/claude/agents/marketing-content-hooks.md +450 -0
- package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
- package/one/things/claude/agents/marketing-content-poster.md +361 -0
- package/one/things/claude/agents/marketing-customer-journey.md +326 -0
- package/one/things/claude/agents/marketing-director.md +397 -0
- package/one/things/claude/agents/marketing-engagement.md +326 -0
- package/one/things/claude/agents/marketing-lead-capture.md +326 -0
- package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
- package/one/things/claude/agents/marketing-network-effects.md +326 -0
- package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
- package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
- package/one/things/claude/agents/marketing-team-manager.md +446 -0
- package/one/things/claude/agents/marketing-viral-growth.md +201 -0
- package/one/things/claude/agents/mission-commander.md +373 -0
- package/one/things/claude/agents/network-effect-analyst.md +587 -0
- package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
- package/one/things/claude/agents/npx.md +890 -0
- package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
- package/one/things/claude/agents/one-master.md +355 -0
- package/one/things/claude/agents/one-orchestrator.md +315 -0
- package/one/things/claude/agents/one.md +601 -0
- package/one/things/claude/agents/playbook-generator.md +503 -0
- package/one/things/claude/agents/pm.md +326 -0
- package/one/things/claude/agents/po.md +345 -0
- package/one/things/claude/agents/qa.md +336 -0
- package/one/things/claude/agents/research-foundation-analyst.md +307 -0
- package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
- package/one/things/claude/agents/research-market-analyst.md +307 -0
- package/one/things/claude/agents/research-team-manager.md +482 -0
- package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
- package/one/things/claude/agents/sales-team-manager.md +400 -0
- package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
- package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
- package/one/things/claude/agents/service-advocacy-manager.md +307 -0
- package/one/things/claude/agents/service-success-manager.md +307 -0
- package/one/things/claude/agents/service-team-manager.md +400 -0
- package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
- package/one/things/claude/agents/share-optimization-specialist.md +551 -0
- package/one/things/claude/agents/sm.md +327 -0
- package/one/things/claude/agents/story-teller.md +473 -0
- package/one/things/claude/agents/task-master.md +596 -0
- package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
- package/one/things/claude/agents/tester.md +556 -0
- package/one/things/claude/agents/the-bull-character-manager.md +580 -0
- package/one/things/claude/agents/tools-playbook-generator.md +489 -0
- package/one/things/claude/agents/turbo-repo-builder.md +316 -0
- package/one/things/claude/agents/upsell-strategist.md +480 -0
- package/one/things/claude/agents/ux-expert.md +335 -0
- package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
- package/one/things/claude/claude-code-hooks-development.json +21 -0
- package/one/things/claude/claude-code-hooks-production.json +21 -0
- package/one/things/claude/claude-code-hooks.json +25 -0
- package/one/things/claude/commands/agent.md +104 -0
- package/one/things/claude/commands/cascade-status.md +128 -0
- package/one/things/claude/commands/ingest.md +290 -0
- package/one/things/claude/commands/ingestor.md +136 -0
- package/one/things/claude/commands/mission.md +83 -0
- package/one/things/claude/commands/npx.md +133 -0
- package/one/things/claude/commands/one.md +440 -0
- package/one/things/claude/commands/quality-check.md +204 -0
- package/one/things/claude/commands/smart-route.md +220 -0
- package/one/things/claude/commands/start.md +121 -0
- package/one/things/claude/commands/story.md +83 -0
- package/one/things/claude/commands/task.md +173 -0
- package/one/things/claude/hook-bypass.json +32 -0
- package/one/things/claude/hooks/agent-hook-config.json +427 -0
- package/one/things/claude/hooks/agent-hook-manager.js +525 -0
- package/one/things/claude/hooks/agent-load-balancer.js +271 -0
- package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
- package/one/things/claude/hooks/build-hook.sh +156 -0
- package/one/things/claude/hooks/cascade-feedback.js +297 -0
- package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
- package/one/things/claude/hooks/cleanup-hook.sh +201 -0
- package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
- package/one/things/claude/hooks/file-organization-engine.js +427 -0
- package/one/things/claude/hooks/file-organization-hook.sh +80 -0
- package/one/things/claude/hooks/file-organization-monitor.js +269 -0
- package/one/things/claude/hooks/format-hook.sh +43 -0
- package/one/things/claude/hooks/hook-bypass.sh +293 -0
- package/one/things/claude/hooks/hook-config-manager.js +202 -0
- package/one/things/claude/hooks/hook-debouncer.sh +62 -0
- package/one/things/claude/hooks/hook-logger.sh +89 -0
- package/one/things/claude/hooks/hook-orchestrator.js +662 -0
- package/one/things/claude/hooks/hook-performance-report.js +120 -0
- package/one/things/claude/hooks/lint-hook.sh +140 -0
- package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
- package/one/things/claude/hooks/memory-optimizer.js +510 -0
- package/one/things/claude/hooks/notification-hook.sh +204 -0
- package/one/things/claude/hooks/ontology-compliance.js +394 -0
- package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
- package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
- package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
- package/one/things/claude/hooks/performance-metrics.json +25 -0
- package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
- package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
- package/one/things/claude/hooks/security-hook.sh +256 -0
- package/one/things/claude/hooks/simple-load-balancer.js +238 -0
- package/one/things/claude/hooks/startup-optimizer.js +625 -0
- package/one/things/claude/hooks/story-scoring-system.js +445 -0
- package/one/things/claude/hooks/story-validation-engine.js +473 -0
- package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
- package/one/things/claude/hooks/story-validation-hook.sh +145 -0
- package/one/things/claude/hooks/structure-synchronizer.js +194 -0
- package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
- package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
- package/one/things/claude/hooks/test-hook.sh +145 -0
- package/one/things/claude/hooks/test-story-validation.sh +170 -0
- package/one/things/claude/hooks/trinity-validation-system.js +392 -0
- package/one/things/claude/settings-local.json +86 -0
- package/one/things/cli-code.md +652 -0
- package/one/things/cli-compiler-code.md +652 -0
- package/one/things/cli.md +1045 -0
- package/one/things/components/card-shadcn.md +929 -0
- package/one/things/components/card.md +1050 -0
- package/one/things/components.md +1669 -0
- package/one/things/componets.md +4 -0
- package/one/things/copilotkit.md +1559 -0
- package/one/things/creator-diagram.md +166 -0
- package/one/things/examples/children/lemonade-stand.md +366 -0
- package/one/things/examples/enterprise/crm-saas.md +1429 -0
- package/one/things/features/1-1-agent-prompts/design.md +470 -0
- package/one/things/features/1-1-agent-prompts/tests.md +264 -0
- package/one/things/features/1-1-agent-prompts.md +486 -0
- package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
- package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
- package/one/things/features/1-2-yaml-orchestrator.md +516 -0
- package/one/things/features/1-3-event-coordination/design.md +544 -0
- package/one/things/features/1-3-event-coordination/tests.md +223 -0
- package/one/things/features/1-3-event-coordination.md +508 -0
- package/one/things/features/1-4-knowledge-management/design.md +609 -0
- package/one/things/features/1-4-knowledge-management/tests.md +195 -0
- package/one/things/features/1-4-knowledge-management.md +577 -0
- package/one/things/features/1-5-quality-loops/design.md +797 -0
- package/one/things/features/1-5-quality-loops/tests.md +212 -0
- package/one/things/features/1-5-quality-loops.md +641 -0
- package/one/things/features/1-6-numbering-structure/design.md +610 -0
- package/one/things/features/1-6-numbering-structure/tests.md +213 -0
- package/one/things/features/1-6-numbering-structure.md +575 -0
- package/one/things/features/2-cli.md +1235 -0
- package/one/things/features/use-one-backend.md +1180 -0
- package/one/things/ideas/1-create-workflow.md +189 -0
- package/one/things/plans/1-create-workflow-status.md +555 -0
- package/one/things/plans/1-create-workflow.md +713 -0
- package/one/things/plans/app.md +761 -0
- package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
- package/one/things/plans/better-auth-any-backend.md +1852 -0
- package/one/things/plans/better-auth-available-features.md +235 -0
- package/one/things/plans/big-plan.md +38 -0
- package/one/things/plans/convex-better-auth.md +1109 -0
- package/one/things/plans/convex-on-off.md +389 -0
- package/one/things/plans/desktop.md +1121 -0
- package/one/things/plans/effect-components.md +1669 -0
- package/one/things/plans/effect.md +973 -0
- package/one/things/plans/email.md +953 -0
- package/one/things/plans/enhance-auth.md +1669 -0
- package/one/things/plans/install-components.md +198 -0
- package/one/things/plans/landing.md +728 -0
- package/one/things/plans/layout.md +205 -0
- package/one/things/plans/mail-backend.md +1308 -0
- package/one/things/plans/mail.md +2624 -0
- package/one/things/plans/next-features.md +83 -0
- package/one/things/plans/one.md +658 -0
- package/one/things/plans/ontology-6-dimensions.md +2216 -0
- package/one/things/plans/ontology-driven-strategy.md +866 -0
- package/one/things/plans/ontology-ui-approach.md +357 -0
- package/one/things/plans/open-agent.md +785 -0
- package/one/things/plans/performace.md +90 -0
- package/one/things/plans/releases.md +809 -0
- package/one/things/plans/repos.md +76 -0
- package/one/things/plans/separate-copy-2.md +1293 -0
- package/one/things/plans/separate-copy-3.md +2458 -0
- package/one/things/plans/separate-copy.md +1293 -0
- package/one/things/plans/separate.md +1983 -0
- package/one/things/plans/shadcn-integration-summary.md +450 -0
- package/one/things/plans/sidebar.md +172 -0
- package/one/things/plans/small-fixes.md +5 -0
- package/one/things/plans/test-backend-connection.md +476 -0
- package/one/things/plans/workflow-files.md +1196 -0
- package/one/things/plans/workflow.md +1372 -0
- package/one/things/products/cascade-landing-page.md +737 -0
- package/one/things/products/cascade.md +1518 -0
- package/one/things/products/context-engineering.md +1427 -0
- package/one/things/products/onthology.md +0 -0
- package/one/things/products/ontology-ui-shadcn.md +1280 -0
- package/one/things/products/ontology-ui.md +1387 -0
- package/one/things/products/ontology.md +717 -0
- package/one/things/products/sdk.md +557 -0
- package/one/things/promptkit.md +903 -0
- package/one/things/service-providers-new.md +982 -0
- package/one/things/service-providers.md +1092 -0
- package/one/things/things.md +349 -0
- package/one/things/todo.md +1248 -0
- package/package.json +5 -2
|
@@ -0,0 +1,1280 @@
|
|
|
1
|
+
# Ontology UI with shadcn/ui Integration
|
|
2
|
+
|
|
3
|
+
> **⚠️ DEPRECATED:** This document has been superseded by a cleaner approach. Please use:
|
|
4
|
+
> - `one/things/features/ontology-ui.md` - Clean UI metadata specification
|
|
5
|
+
> - `one/things/components/card.md` - Implementation using shadcn/ui naturally
|
|
6
|
+
> - `one/things/plans/ontology-ui-approach.md` - Philosophy explanation
|
|
7
|
+
>
|
|
8
|
+
> **Why the change?** The new approach keeps ontology-ui.md as a clean specification and uses shadcn/ui as an implementation detail in card.md, resulting in 50% less documentation with no redundancy.
|
|
9
|
+
|
|
10
|
+
**Ontology-driven UI using shadcn/ui components for consistent, accessible design**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
The ONE ontology UI specification is fully integrated with [shadcn/ui](https://ui.shadcn.com/) - a collection of beautifully designed, accessible components built with Radix UI and Tailwind CSS.
|
|
17
|
+
|
|
18
|
+
**Why shadcn/ui:**
|
|
19
|
+
- ✅ **Accessible** - Built on Radix UI primitives (WAI-ARIA compliant)
|
|
20
|
+
- ✅ **Customizable** - Full control via Tailwind CSS
|
|
21
|
+
- ✅ **Copy-paste** - Not an npm dependency, you own the code
|
|
22
|
+
- ✅ **TypeScript** - Fully typed components
|
|
23
|
+
- ✅ **Consistent** - Professional design system out of the box
|
|
24
|
+
- ✅ **Well-documented** - Comprehensive docs and examples
|
|
25
|
+
|
|
26
|
+
**Integration Benefits:**
|
|
27
|
+
- ✅ Every field component maps to shadcn/ui component
|
|
28
|
+
- ✅ Consistent design across all 66 thing types
|
|
29
|
+
- ✅ Accessible by default (screen readers, keyboard nav)
|
|
30
|
+
- ✅ Theme support (light/dark mode)
|
|
31
|
+
- ✅ Responsive and mobile-friendly
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Setup
|
|
36
|
+
|
|
37
|
+
### 1. Install shadcn/ui
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cd frontend
|
|
41
|
+
|
|
42
|
+
# Initialize shadcn/ui
|
|
43
|
+
npx shadcn-ui@latest init
|
|
44
|
+
|
|
45
|
+
# Choose:
|
|
46
|
+
# Style: Default
|
|
47
|
+
# Base color: Slate
|
|
48
|
+
# CSS variables: Yes
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 2. Install Required Components
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Core components
|
|
55
|
+
npx shadcn-ui@latest add card
|
|
56
|
+
npx shadcn-ui@latest add button
|
|
57
|
+
npx shadcn-ui@latest add badge
|
|
58
|
+
npx shadcn-ui@latest add avatar
|
|
59
|
+
npx shadcn-ui@latest add separator
|
|
60
|
+
|
|
61
|
+
# Form components
|
|
62
|
+
npx shadcn-ui@latest add input
|
|
63
|
+
npx shadcn-ui@latest add textarea
|
|
64
|
+
npx shadcn-ui@latest add checkbox
|
|
65
|
+
npx shadcn-ui@latest add switch
|
|
66
|
+
npx shadcn-ui@latest add select
|
|
67
|
+
|
|
68
|
+
# Display components
|
|
69
|
+
npx shadcn-ui@latest add table
|
|
70
|
+
npx shadcn-ui@latest add dialog
|
|
71
|
+
npx shadcn-ui@latest add tooltip
|
|
72
|
+
npx shadcn-ui@latest add dropdown-menu
|
|
73
|
+
npx shadcn-ui@latest add popover
|
|
74
|
+
|
|
75
|
+
# Data components
|
|
76
|
+
npx shadcn-ui@latest add skeleton
|
|
77
|
+
npx shadcn-ui@latest add progress
|
|
78
|
+
npx shadcn-ui@latest add calendar
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Project Structure
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
frontend/
|
|
85
|
+
├── src/
|
|
86
|
+
│ ├── components/
|
|
87
|
+
│ │ ├── ui/ # shadcn/ui components (auto-generated)
|
|
88
|
+
│ │ │ ├── card.tsx
|
|
89
|
+
│ │ │ ├── button.tsx
|
|
90
|
+
│ │ │ ├── badge.tsx
|
|
91
|
+
│ │ │ └── ...
|
|
92
|
+
│ │ ├── generic/ # Ontology-driven components
|
|
93
|
+
│ │ │ ├── ThingCard.tsx
|
|
94
|
+
│ │ │ ├── Field.tsx
|
|
95
|
+
│ │ │ └── Actions.tsx
|
|
96
|
+
│ │ └── fields/ # Field-specific components
|
|
97
|
+
│ │ ├── Heading.tsx
|
|
98
|
+
│ │ ├── Text.tsx
|
|
99
|
+
│ │ ├── Price.tsx
|
|
100
|
+
│ │ └── ...
|
|
101
|
+
│ ├── ontology/
|
|
102
|
+
│ │ ├── config/ # UI configs for all types
|
|
103
|
+
│ │ │ ├── course.ts
|
|
104
|
+
│ │ │ ├── product.ts
|
|
105
|
+
│ │ │ └── ...
|
|
106
|
+
│ │ └── hooks/
|
|
107
|
+
│ │ └── useThingConfig.ts
|
|
108
|
+
│ └── lib/
|
|
109
|
+
│ └── utils.ts # shadcn/ui utilities
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Field Component Mapping
|
|
115
|
+
|
|
116
|
+
Every ontology field component maps to a shadcn/ui component:
|
|
117
|
+
|
|
118
|
+
| Field Component | shadcn/ui Component | Usage |
|
|
119
|
+
|----------------|---------------------|-------|
|
|
120
|
+
| `Heading` | Custom (Typography) | Headings with size variants |
|
|
121
|
+
| `Text` | Custom (Typography) | Body text with truncation |
|
|
122
|
+
| `Price` | `Badge` + Custom formatting | Formatted prices |
|
|
123
|
+
| `Image` | Custom `<img>` + `Skeleton` | Lazy-loaded images |
|
|
124
|
+
| `Badge` | `Badge` | Status badges |
|
|
125
|
+
| `TagList` | Multiple `Badge` | Tag collections |
|
|
126
|
+
| `Date` | Custom formatting | Formatted dates |
|
|
127
|
+
| `Avatar` | `Avatar` | User avatars |
|
|
128
|
+
| `Button` | `Button` | Action buttons |
|
|
129
|
+
| `Link` | Custom `<a>` | Hyperlinks |
|
|
130
|
+
| `Checkbox` | `Checkbox` | Checkboxes |
|
|
131
|
+
| `Switch` | `Switch` | Toggle switches |
|
|
132
|
+
| `Select` | `Select` | Dropdowns |
|
|
133
|
+
| `Input` | `Input` | Text inputs |
|
|
134
|
+
| `Textarea` | `Textarea` | Multi-line text |
|
|
135
|
+
| `Rating` | Custom stars | Star ratings |
|
|
136
|
+
| `Progress` | `Progress` | Progress bars |
|
|
137
|
+
| `Table` | `Table` | Data tables |
|
|
138
|
+
| `Dialog` | `Dialog` | Modal dialogs |
|
|
139
|
+
| `Tooltip` | `Tooltip` | Hover tooltips |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## ThingCard with shadcn/ui
|
|
144
|
+
|
|
145
|
+
### Implementation
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
// frontend/src/components/generic/ThingCard.tsx
|
|
149
|
+
import { type Thing } from '@one-platform/core'
|
|
150
|
+
import { useThingConfig } from '@/ontology/hooks/useThingConfig'
|
|
151
|
+
import { Card, CardContent, CardFooter, CardHeader } from '@/components/ui/card'
|
|
152
|
+
import { Separator } from '@/components/ui/separator'
|
|
153
|
+
import { Field } from './Field'
|
|
154
|
+
import { Actions } from './Actions'
|
|
155
|
+
import { ConnectionBadges } from './ConnectionBadges'
|
|
156
|
+
import { cn } from '@/lib/utils'
|
|
157
|
+
|
|
158
|
+
interface ThingCardProps {
|
|
159
|
+
thing: Thing
|
|
160
|
+
view?: 'card' | 'list' | 'detail'
|
|
161
|
+
onClick?: (thing: Thing) => void
|
|
162
|
+
showActions?: boolean
|
|
163
|
+
showConnections?: boolean
|
|
164
|
+
className?: string
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function ThingCard({
|
|
168
|
+
thing,
|
|
169
|
+
view = 'card',
|
|
170
|
+
onClick,
|
|
171
|
+
showActions = true,
|
|
172
|
+
showConnections = true,
|
|
173
|
+
className
|
|
174
|
+
}: ThingCardProps) {
|
|
175
|
+
const config = useThingConfig(thing.type)
|
|
176
|
+
const viewConfig = config.ui.views[view]
|
|
177
|
+
|
|
178
|
+
if (!viewConfig) return null
|
|
179
|
+
|
|
180
|
+
const fields = viewConfig.fields === '*'
|
|
181
|
+
? Object.keys(config.properties)
|
|
182
|
+
: viewConfig.fields
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Card
|
|
186
|
+
className={cn(
|
|
187
|
+
'cursor-pointer transition-all hover:shadow-lg',
|
|
188
|
+
className
|
|
189
|
+
)}
|
|
190
|
+
onClick={onClick}
|
|
191
|
+
>
|
|
192
|
+
<CardHeader className="space-y-0 pb-3">
|
|
193
|
+
{/* Render header fields (typically thumbnail + title) */}
|
|
194
|
+
{fields.slice(0, 2).map(fieldName => {
|
|
195
|
+
const fieldConfig = config.ui.fields[fieldName]
|
|
196
|
+
if (fieldConfig?.hidden) return null
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Field
|
|
200
|
+
key={fieldName}
|
|
201
|
+
name={fieldName}
|
|
202
|
+
value={thing.properties[fieldName]}
|
|
203
|
+
config={fieldConfig}
|
|
204
|
+
thing={thing}
|
|
205
|
+
/>
|
|
206
|
+
)
|
|
207
|
+
})}
|
|
208
|
+
</CardHeader>
|
|
209
|
+
|
|
210
|
+
<CardContent className="space-y-2">
|
|
211
|
+
{/* Render body fields */}
|
|
212
|
+
{fields.slice(2).map(fieldName => {
|
|
213
|
+
const fieldConfig = config.ui.fields[fieldName]
|
|
214
|
+
if (fieldConfig?.hidden) return null
|
|
215
|
+
if (fieldConfig?.showOnlyIf && !thing.properties[fieldName]) return null
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<Field
|
|
219
|
+
key={fieldName}
|
|
220
|
+
name={fieldName}
|
|
221
|
+
value={thing.properties[fieldName]}
|
|
222
|
+
config={fieldConfig}
|
|
223
|
+
thing={thing}
|
|
224
|
+
/>
|
|
225
|
+
)
|
|
226
|
+
})}
|
|
227
|
+
</CardContent>
|
|
228
|
+
|
|
229
|
+
{/* Connection badges */}
|
|
230
|
+
{showConnections && config.ui.connections && (
|
|
231
|
+
<>
|
|
232
|
+
<Separator />
|
|
233
|
+
<CardContent className="pt-3">
|
|
234
|
+
<ConnectionBadges
|
|
235
|
+
thing={thing}
|
|
236
|
+
config={config.ui.connections}
|
|
237
|
+
/>
|
|
238
|
+
</CardContent>
|
|
239
|
+
</>
|
|
240
|
+
)}
|
|
241
|
+
|
|
242
|
+
{/* Actions */}
|
|
243
|
+
{showActions && (config.ui.actions.primary || config.ui.actions.secondary) && (
|
|
244
|
+
<>
|
|
245
|
+
<Separator />
|
|
246
|
+
<CardFooter className="pt-3">
|
|
247
|
+
<Actions
|
|
248
|
+
thing={thing}
|
|
249
|
+
primary={config.ui.actions.primary}
|
|
250
|
+
secondary={config.ui.actions.secondary}
|
|
251
|
+
/>
|
|
252
|
+
</CardFooter>
|
|
253
|
+
</>
|
|
254
|
+
)}
|
|
255
|
+
</Card>
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Field Component with shadcn/ui
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
// frontend/src/components/generic/Field.tsx
|
|
266
|
+
import { type FieldUI } from '@/ontology/types'
|
|
267
|
+
import { type Thing } from '@one-platform/core'
|
|
268
|
+
|
|
269
|
+
// shadcn/ui components
|
|
270
|
+
import { Badge } from '@/components/ui/badge'
|
|
271
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
|
|
272
|
+
import { Checkbox } from '@/components/ui/checkbox'
|
|
273
|
+
import { Switch } from '@/components/ui/switch'
|
|
274
|
+
import { Progress } from '@/components/ui/progress'
|
|
275
|
+
import { Separator } from '@/components/ui/separator'
|
|
276
|
+
import { Skeleton } from '@/components/ui/skeleton'
|
|
277
|
+
|
|
278
|
+
// Custom field components
|
|
279
|
+
import { Heading } from '@/components/fields/Heading'
|
|
280
|
+
import { Text } from '@/components/fields/Text'
|
|
281
|
+
import { Price } from '@/components/fields/Price'
|
|
282
|
+
import { Image } from '@/components/fields/Image'
|
|
283
|
+
import { TagList } from '@/components/fields/TagList'
|
|
284
|
+
import { DateField } from '@/components/fields/DateField'
|
|
285
|
+
import { Link } from '@/components/fields/Link'
|
|
286
|
+
|
|
287
|
+
interface FieldProps {
|
|
288
|
+
name: string
|
|
289
|
+
value: any
|
|
290
|
+
config: FieldUI
|
|
291
|
+
thing: Thing
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function Field({ name, value, config, thing }: FieldProps) {
|
|
295
|
+
if (value === null || value === undefined) return null
|
|
296
|
+
|
|
297
|
+
const formattedValue = config.format
|
|
298
|
+
? config.format(value, thing)
|
|
299
|
+
: value
|
|
300
|
+
|
|
301
|
+
switch (config.component) {
|
|
302
|
+
case 'Heading':
|
|
303
|
+
return <Heading {...config}>{formattedValue}</Heading>
|
|
304
|
+
|
|
305
|
+
case 'Text':
|
|
306
|
+
return <Text {...config}>{formattedValue}</Text>
|
|
307
|
+
|
|
308
|
+
case 'Price':
|
|
309
|
+
return <Price {...config} value={formattedValue} />
|
|
310
|
+
|
|
311
|
+
case 'Image':
|
|
312
|
+
return <Image {...config} src={formattedValue} alt={thing.name} />
|
|
313
|
+
|
|
314
|
+
case 'Badge':
|
|
315
|
+
const badgeColor = config.colors?.[value] || config.color
|
|
316
|
+
const badgeLabel = config.labels?.[value] || config.label || value
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<Badge variant={badgeColor as any} className="inline-flex items-center gap-1">
|
|
320
|
+
{config.icon && <span className="h-3 w-3">{/* icon */}</span>}
|
|
321
|
+
{badgeLabel}
|
|
322
|
+
</Badge>
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
case 'TagList':
|
|
326
|
+
return <TagList {...config} tags={formattedValue} />
|
|
327
|
+
|
|
328
|
+
case 'Date':
|
|
329
|
+
return <DateField {...config} value={formattedValue} />
|
|
330
|
+
|
|
331
|
+
case 'Avatar':
|
|
332
|
+
return (
|
|
333
|
+
<Avatar className={config.size === 'sm' ? 'h-8 w-8' : 'h-10 w-10'}>
|
|
334
|
+
<AvatarImage src={formattedValue} alt={thing.name} />
|
|
335
|
+
<AvatarFallback>
|
|
336
|
+
{config.fallback === 'initials'
|
|
337
|
+
? thing.name.split(' ').map(n => n[0]).join('').toUpperCase()
|
|
338
|
+
: config.fallback}
|
|
339
|
+
</AvatarFallback>
|
|
340
|
+
</Avatar>
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
case 'Link':
|
|
344
|
+
return <Link {...config} href={formattedValue} />
|
|
345
|
+
|
|
346
|
+
case 'Checkbox':
|
|
347
|
+
return (
|
|
348
|
+
<div className="flex items-center space-x-2">
|
|
349
|
+
<Checkbox
|
|
350
|
+
checked={formattedValue}
|
|
351
|
+
onCheckedChange={(checked) => {
|
|
352
|
+
// Update thing
|
|
353
|
+
}}
|
|
354
|
+
/>
|
|
355
|
+
{config.label && (
|
|
356
|
+
<label className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
|
357
|
+
{config.label}
|
|
358
|
+
</label>
|
|
359
|
+
)}
|
|
360
|
+
</div>
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
case 'Switch':
|
|
364
|
+
return (
|
|
365
|
+
<div className="flex items-center space-x-2">
|
|
366
|
+
<Switch
|
|
367
|
+
checked={formattedValue}
|
|
368
|
+
onCheckedChange={(checked) => {
|
|
369
|
+
// Update thing
|
|
370
|
+
}}
|
|
371
|
+
/>
|
|
372
|
+
{config.label && (
|
|
373
|
+
<label className="text-sm font-medium">{config.label}</label>
|
|
374
|
+
)}
|
|
375
|
+
</div>
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
case 'Progress':
|
|
379
|
+
return (
|
|
380
|
+
<div className="space-y-2">
|
|
381
|
+
{config.label && (
|
|
382
|
+
<div className="flex justify-between text-sm">
|
|
383
|
+
<span>{config.label}</span>
|
|
384
|
+
<span>{formattedValue}%</span>
|
|
385
|
+
</div>
|
|
386
|
+
)}
|
|
387
|
+
<Progress value={formattedValue} />
|
|
388
|
+
</div>
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
case 'Separator':
|
|
392
|
+
return <Separator />
|
|
393
|
+
|
|
394
|
+
case 'Skeleton':
|
|
395
|
+
return <Skeleton className={config.className} />
|
|
396
|
+
|
|
397
|
+
default:
|
|
398
|
+
return <Text size="sm">{String(formattedValue)}</Text>
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## Actions Component with shadcn/ui
|
|
406
|
+
|
|
407
|
+
```tsx
|
|
408
|
+
// frontend/src/components/generic/Actions.tsx
|
|
409
|
+
import { type Thing } from '@one-platform/core'
|
|
410
|
+
import { type ActionConfig } from '@/ontology/types'
|
|
411
|
+
import { Button } from '@/components/ui/button'
|
|
412
|
+
import {
|
|
413
|
+
DropdownMenu,
|
|
414
|
+
DropdownMenuContent,
|
|
415
|
+
DropdownMenuItem,
|
|
416
|
+
DropdownMenuSeparator,
|
|
417
|
+
DropdownMenuTrigger,
|
|
418
|
+
} from '@/components/ui/dropdown-menu'
|
|
419
|
+
import {
|
|
420
|
+
AlertDialog,
|
|
421
|
+
AlertDialogAction,
|
|
422
|
+
AlertDialogCancel,
|
|
423
|
+
AlertDialogContent,
|
|
424
|
+
AlertDialogDescription,
|
|
425
|
+
AlertDialogFooter,
|
|
426
|
+
AlertDialogHeader,
|
|
427
|
+
AlertDialogTitle,
|
|
428
|
+
} from '@/components/ui/alert-dialog'
|
|
429
|
+
import { useAction } from '@/hooks/useAction'
|
|
430
|
+
import { MoreVertical } from 'lucide-react'
|
|
431
|
+
import { useState } from 'react'
|
|
432
|
+
|
|
433
|
+
interface ActionsProps {
|
|
434
|
+
thing: Thing
|
|
435
|
+
primary?: ActionConfig
|
|
436
|
+
secondary?: ActionConfig[]
|
|
437
|
+
context?: ActionConfig[]
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export function Actions({ thing, primary, secondary, context }: ActionsProps) {
|
|
441
|
+
const { executeAction, loading } = useAction()
|
|
442
|
+
const [confirmAction, setConfirmAction] = useState<ActionConfig | null>(null)
|
|
443
|
+
|
|
444
|
+
const handleAction = async (action: ActionConfig) => {
|
|
445
|
+
// Show confirmation dialog if required
|
|
446
|
+
if (action.confirm) {
|
|
447
|
+
setConfirmAction(action)
|
|
448
|
+
return
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
await executeAction(action.action, thing)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return (
|
|
455
|
+
<>
|
|
456
|
+
<div className="flex items-center gap-2 w-full">
|
|
457
|
+
{/* Primary action */}
|
|
458
|
+
{primary && (
|
|
459
|
+
<Button
|
|
460
|
+
variant={primary.variant === 'danger' ? 'destructive' : 'default'}
|
|
461
|
+
className="flex-1"
|
|
462
|
+
disabled={loading}
|
|
463
|
+
onClick={() => handleAction(primary)}
|
|
464
|
+
>
|
|
465
|
+
{loading ? 'Loading...' : primary.label}
|
|
466
|
+
</Button>
|
|
467
|
+
)}
|
|
468
|
+
|
|
469
|
+
{/* Secondary actions */}
|
|
470
|
+
{secondary && secondary.length > 0 && (
|
|
471
|
+
<div className="flex gap-2">
|
|
472
|
+
{secondary.map(action => (
|
|
473
|
+
<Button
|
|
474
|
+
key={action.action}
|
|
475
|
+
variant={action.variant === 'ghost' ? 'outline' : 'default'}
|
|
476
|
+
size="icon"
|
|
477
|
+
disabled={loading}
|
|
478
|
+
onClick={() => handleAction(action)}
|
|
479
|
+
>
|
|
480
|
+
{/* Icon from lucide-react */}
|
|
481
|
+
<span className="h-4 w-4" />
|
|
482
|
+
</Button>
|
|
483
|
+
))}
|
|
484
|
+
</div>
|
|
485
|
+
)}
|
|
486
|
+
|
|
487
|
+
{/* Context menu (more actions) */}
|
|
488
|
+
{context && context.length > 0 && (
|
|
489
|
+
<DropdownMenu>
|
|
490
|
+
<DropdownMenuTrigger asChild>
|
|
491
|
+
<Button variant="ghost" size="icon">
|
|
492
|
+
<MoreVertical className="h-4 w-4" />
|
|
493
|
+
</Button>
|
|
494
|
+
</DropdownMenuTrigger>
|
|
495
|
+
<DropdownMenuContent align="end">
|
|
496
|
+
{context.map((action, index) => (
|
|
497
|
+
<div key={action.action}>
|
|
498
|
+
{index > 0 && action.variant === 'danger' && (
|
|
499
|
+
<DropdownMenuSeparator />
|
|
500
|
+
)}
|
|
501
|
+
<DropdownMenuItem
|
|
502
|
+
onClick={() => handleAction(action)}
|
|
503
|
+
className={
|
|
504
|
+
action.variant === 'danger' ? 'text-destructive' : ''
|
|
505
|
+
}
|
|
506
|
+
>
|
|
507
|
+
{action.label}
|
|
508
|
+
</DropdownMenuItem>
|
|
509
|
+
</div>
|
|
510
|
+
))}
|
|
511
|
+
</DropdownMenuContent>
|
|
512
|
+
</DropdownMenu>
|
|
513
|
+
)}
|
|
514
|
+
</div>
|
|
515
|
+
|
|
516
|
+
{/* Confirmation dialog */}
|
|
517
|
+
{confirmAction && (
|
|
518
|
+
<AlertDialog
|
|
519
|
+
open={!!confirmAction}
|
|
520
|
+
onOpenChange={() => setConfirmAction(null)}
|
|
521
|
+
>
|
|
522
|
+
<AlertDialogContent>
|
|
523
|
+
<AlertDialogHeader>
|
|
524
|
+
<AlertDialogTitle>Are you sure?</AlertDialogTitle>
|
|
525
|
+
<AlertDialogDescription>
|
|
526
|
+
{confirmAction.confirm}
|
|
527
|
+
</AlertDialogDescription>
|
|
528
|
+
</AlertDialogHeader>
|
|
529
|
+
<AlertDialogFooter>
|
|
530
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
531
|
+
<AlertDialogAction
|
|
532
|
+
onClick={async () => {
|
|
533
|
+
await executeAction(confirmAction.action, thing)
|
|
534
|
+
setConfirmAction(null)
|
|
535
|
+
}}
|
|
536
|
+
>
|
|
537
|
+
Continue
|
|
538
|
+
</AlertDialogAction>
|
|
539
|
+
</AlertDialogFooter>
|
|
540
|
+
</AlertDialogContent>
|
|
541
|
+
</AlertDialog>
|
|
542
|
+
)}
|
|
543
|
+
</>
|
|
544
|
+
)
|
|
545
|
+
}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
## Connection Badges with shadcn/ui
|
|
551
|
+
|
|
552
|
+
```tsx
|
|
553
|
+
// frontend/src/components/generic/ConnectionBadges.tsx
|
|
554
|
+
import { type Thing } from '@one-platform/core'
|
|
555
|
+
import { type ConnectionUI } from '@/ontology/types'
|
|
556
|
+
import { useConnections } from '@/hooks/useConnections'
|
|
557
|
+
import { Badge } from '@/components/ui/badge'
|
|
558
|
+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
|
|
559
|
+
import { Separator } from '@/components/ui/separator'
|
|
560
|
+
|
|
561
|
+
interface ConnectionBadgesProps {
|
|
562
|
+
thing: Thing
|
|
563
|
+
config: Record<string, ConnectionUI>
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export function ConnectionBadges({ thing, config }: ConnectionBadgesProps) {
|
|
567
|
+
const connections = useConnections(thing._id)
|
|
568
|
+
|
|
569
|
+
const badges = Object.entries(config).map(([type, connectionConfig]) => {
|
|
570
|
+
const items = connections.filter(c => c.relationshipType === type)
|
|
571
|
+
if (items.length === 0) return null
|
|
572
|
+
|
|
573
|
+
const label = connectionConfig.label
|
|
574
|
+
.replace('{count}', items.length.toString())
|
|
575
|
+
.replace('{name}', items[0]?.name || '')
|
|
576
|
+
|
|
577
|
+
switch (connectionConfig.display) {
|
|
578
|
+
case 'badge':
|
|
579
|
+
return (
|
|
580
|
+
<Badge key={type} variant="secondary" className="text-xs">
|
|
581
|
+
{label}
|
|
582
|
+
</Badge>
|
|
583
|
+
)
|
|
584
|
+
|
|
585
|
+
case 'avatar':
|
|
586
|
+
return (
|
|
587
|
+
<div key={type} className="flex items-center gap-2">
|
|
588
|
+
<Avatar className="h-6 w-6">
|
|
589
|
+
<AvatarImage src={items[0]?.properties?.avatar} />
|
|
590
|
+
<AvatarFallback>
|
|
591
|
+
{items[0]?.name?.[0]?.toUpperCase()}
|
|
592
|
+
</AvatarFallback>
|
|
593
|
+
</Avatar>
|
|
594
|
+
<span className="text-sm text-muted-foreground">
|
|
595
|
+
{label}
|
|
596
|
+
</span>
|
|
597
|
+
</div>
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
case 'inline':
|
|
601
|
+
return (
|
|
602
|
+
<span key={type} className="text-sm text-muted-foreground">
|
|
603
|
+
{label}
|
|
604
|
+
</span>
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
case 'list':
|
|
608
|
+
return (
|
|
609
|
+
<div key={type} className="flex flex-wrap gap-1">
|
|
610
|
+
{items.slice(0, connectionConfig.max || 5).map(item => (
|
|
611
|
+
<Badge key={item._id} variant="outline" className="text-xs">
|
|
612
|
+
{item.name}
|
|
613
|
+
</Badge>
|
|
614
|
+
))}
|
|
615
|
+
</div>
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
default:
|
|
619
|
+
return null
|
|
620
|
+
}
|
|
621
|
+
})
|
|
622
|
+
|
|
623
|
+
const validBadges = badges.filter(Boolean)
|
|
624
|
+
if (validBadges.length === 0) return null
|
|
625
|
+
|
|
626
|
+
return (
|
|
627
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
628
|
+
{validBadges}
|
|
629
|
+
</div>
|
|
630
|
+
)
|
|
631
|
+
}
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
## Field Components with shadcn/ui
|
|
637
|
+
|
|
638
|
+
### Price Component
|
|
639
|
+
|
|
640
|
+
```tsx
|
|
641
|
+
// frontend/src/components/fields/Price.tsx
|
|
642
|
+
import { Badge } from '@/components/ui/badge'
|
|
643
|
+
import { cn } from '@/lib/utils'
|
|
644
|
+
|
|
645
|
+
interface PriceProps {
|
|
646
|
+
value: number
|
|
647
|
+
currency?: string
|
|
648
|
+
format?: 'full' | 'compact'
|
|
649
|
+
badge?: boolean
|
|
650
|
+
size?: 'sm' | 'md' | 'lg'
|
|
651
|
+
strikethrough?: boolean
|
|
652
|
+
free?: { label: string; badge: boolean }
|
|
653
|
+
className?: string
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export function Price({
|
|
657
|
+
value,
|
|
658
|
+
currency = 'USD',
|
|
659
|
+
format = 'compact',
|
|
660
|
+
badge = false,
|
|
661
|
+
size = 'md',
|
|
662
|
+
strikethrough = false,
|
|
663
|
+
free,
|
|
664
|
+
className
|
|
665
|
+
}: PriceProps) {
|
|
666
|
+
// Show "Free" if value is 0 and free config provided
|
|
667
|
+
if (value === 0 && free) {
|
|
668
|
+
return free.badge ? (
|
|
669
|
+
<Badge variant="secondary">{free.label}</Badge>
|
|
670
|
+
) : (
|
|
671
|
+
<span className="text-sm font-medium text-muted-foreground">
|
|
672
|
+
{free.label}
|
|
673
|
+
</span>
|
|
674
|
+
)
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
const formatted = new Intl.NumberFormat('en-US', {
|
|
678
|
+
style: 'currency',
|
|
679
|
+
currency,
|
|
680
|
+
minimumFractionDigits: format === 'compact' ? 0 : 2,
|
|
681
|
+
maximumFractionDigits: format === 'compact' ? 0 : 2
|
|
682
|
+
}).format(value)
|
|
683
|
+
|
|
684
|
+
const sizeClasses = {
|
|
685
|
+
sm: 'text-sm',
|
|
686
|
+
md: 'text-base',
|
|
687
|
+
lg: 'text-lg'
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const content = (
|
|
691
|
+
<span
|
|
692
|
+
className={cn(
|
|
693
|
+
'font-semibold',
|
|
694
|
+
sizeClasses[size],
|
|
695
|
+
strikethrough && 'line-through text-muted-foreground',
|
|
696
|
+
className
|
|
697
|
+
)}
|
|
698
|
+
>
|
|
699
|
+
{formatted}
|
|
700
|
+
</span>
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
return badge ? (
|
|
704
|
+
<Badge variant="default" className="font-semibold">
|
|
705
|
+
{formatted}
|
|
706
|
+
</Badge>
|
|
707
|
+
) : (
|
|
708
|
+
content
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
### Image Component
|
|
714
|
+
|
|
715
|
+
```tsx
|
|
716
|
+
// frontend/src/components/fields/Image.tsx
|
|
717
|
+
import { useState } from 'react'
|
|
718
|
+
import { Skeleton } from '@/components/ui/skeleton'
|
|
719
|
+
import { cn } from '@/lib/utils'
|
|
720
|
+
|
|
721
|
+
interface ImageProps {
|
|
722
|
+
src: string
|
|
723
|
+
alt: string
|
|
724
|
+
aspect?: 'square' | 'video' | 'wide' | 'portrait'
|
|
725
|
+
lazy?: boolean
|
|
726
|
+
placeholder?: string
|
|
727
|
+
fallback?: string
|
|
728
|
+
sizes?: string
|
|
729
|
+
className?: string
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
export function Image({
|
|
733
|
+
src,
|
|
734
|
+
alt,
|
|
735
|
+
aspect = 'video',
|
|
736
|
+
lazy = true,
|
|
737
|
+
placeholder,
|
|
738
|
+
fallback,
|
|
739
|
+
sizes,
|
|
740
|
+
className
|
|
741
|
+
}: ImageProps) {
|
|
742
|
+
const [loading, setLoading] = useState(true)
|
|
743
|
+
const [error, setError] = useState(false)
|
|
744
|
+
|
|
745
|
+
const aspectClasses = {
|
|
746
|
+
square: 'aspect-square',
|
|
747
|
+
video: 'aspect-video',
|
|
748
|
+
wide: 'aspect-[21/9]',
|
|
749
|
+
portrait: 'aspect-[3/4]'
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return (
|
|
753
|
+
<div className={cn('relative overflow-hidden rounded-md', aspectClasses[aspect])}>
|
|
754
|
+
{loading && (
|
|
755
|
+
<Skeleton className="absolute inset-0" />
|
|
756
|
+
)}
|
|
757
|
+
<img
|
|
758
|
+
src={error && fallback ? fallback : src}
|
|
759
|
+
alt={alt}
|
|
760
|
+
loading={lazy ? 'lazy' : 'eager'}
|
|
761
|
+
sizes={sizes}
|
|
762
|
+
className={cn(
|
|
763
|
+
'h-full w-full object-cover transition-opacity',
|
|
764
|
+
loading ? 'opacity-0' : 'opacity-100',
|
|
765
|
+
className
|
|
766
|
+
)}
|
|
767
|
+
onLoad={() => setLoading(false)}
|
|
768
|
+
onError={() => {
|
|
769
|
+
setError(true)
|
|
770
|
+
setLoading(false)
|
|
771
|
+
}}
|
|
772
|
+
/>
|
|
773
|
+
</div>
|
|
774
|
+
)
|
|
775
|
+
}
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
### TagList Component
|
|
779
|
+
|
|
780
|
+
```tsx
|
|
781
|
+
// frontend/src/components/fields/TagList.tsx
|
|
782
|
+
import { Badge } from '@/components/ui/badge'
|
|
783
|
+
import {
|
|
784
|
+
Tooltip,
|
|
785
|
+
TooltipContent,
|
|
786
|
+
TooltipProvider,
|
|
787
|
+
TooltipTrigger,
|
|
788
|
+
} from '@/components/ui/tooltip'
|
|
789
|
+
|
|
790
|
+
interface TagListProps {
|
|
791
|
+
tags: string[]
|
|
792
|
+
max?: number
|
|
793
|
+
color?: string
|
|
794
|
+
moreLabel?: string
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
export function TagList({
|
|
798
|
+
tags,
|
|
799
|
+
max = 3,
|
|
800
|
+
color = 'default',
|
|
801
|
+
moreLabel = '+{count} more'
|
|
802
|
+
}: TagListProps) {
|
|
803
|
+
if (!tags || tags.length === 0) return null
|
|
804
|
+
|
|
805
|
+
const visibleTags = tags.slice(0, max)
|
|
806
|
+
const hiddenTags = tags.slice(max)
|
|
807
|
+
|
|
808
|
+
return (
|
|
809
|
+
<div className="flex flex-wrap gap-1">
|
|
810
|
+
{visibleTags.map(tag => (
|
|
811
|
+
<Badge key={tag} variant="secondary" className="text-xs">
|
|
812
|
+
{tag}
|
|
813
|
+
</Badge>
|
|
814
|
+
))}
|
|
815
|
+
|
|
816
|
+
{hiddenTags.length > 0 && (
|
|
817
|
+
<TooltipProvider>
|
|
818
|
+
<Tooltip>
|
|
819
|
+
<TooltipTrigger asChild>
|
|
820
|
+
<Badge variant="outline" className="text-xs cursor-help">
|
|
821
|
+
{moreLabel.replace('{count}', hiddenTags.length.toString())}
|
|
822
|
+
</Badge>
|
|
823
|
+
</TooltipTrigger>
|
|
824
|
+
<TooltipContent>
|
|
825
|
+
<div className="flex flex-wrap gap-1 max-w-xs">
|
|
826
|
+
{hiddenTags.map(tag => (
|
|
827
|
+
<Badge key={tag} variant="secondary" className="text-xs">
|
|
828
|
+
{tag}
|
|
829
|
+
</Badge>
|
|
830
|
+
))}
|
|
831
|
+
</div>
|
|
832
|
+
</TooltipContent>
|
|
833
|
+
</Tooltip>
|
|
834
|
+
</TooltipProvider>
|
|
835
|
+
)}
|
|
836
|
+
</div>
|
|
837
|
+
)
|
|
838
|
+
}
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
---
|
|
842
|
+
|
|
843
|
+
## Empty State with shadcn/ui
|
|
844
|
+
|
|
845
|
+
```tsx
|
|
846
|
+
// frontend/src/components/generic/EmptyState.tsx
|
|
847
|
+
import { type EmptyStateConfig } from '@/ontology/types'
|
|
848
|
+
import { Button } from '@/components/ui/button'
|
|
849
|
+
import { Card, CardContent } from '@/components/ui/card'
|
|
850
|
+
|
|
851
|
+
interface EmptyStateProps {
|
|
852
|
+
config: EmptyStateConfig
|
|
853
|
+
onAction?: () => void
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
export function EmptyState({ config, onAction }: EmptyStateProps) {
|
|
857
|
+
return (
|
|
858
|
+
<Card className="border-dashed">
|
|
859
|
+
<CardContent className="flex flex-col items-center justify-center py-12">
|
|
860
|
+
<div className="flex h-20 w-20 items-center justify-center rounded-full bg-muted mb-4">
|
|
861
|
+
{/* Icon from lucide-react */}
|
|
862
|
+
<span className="h-10 w-10 text-muted-foreground" />
|
|
863
|
+
</div>
|
|
864
|
+
|
|
865
|
+
<h3 className="text-xl font-semibold mb-2">
|
|
866
|
+
{config.title}
|
|
867
|
+
</h3>
|
|
868
|
+
|
|
869
|
+
<p className="text-sm text-muted-foreground text-center mb-6 max-w-sm">
|
|
870
|
+
{config.description}
|
|
871
|
+
</p>
|
|
872
|
+
|
|
873
|
+
{config.action && (
|
|
874
|
+
<Button onClick={onAction}>
|
|
875
|
+
{config.action.label}
|
|
876
|
+
</Button>
|
|
877
|
+
)}
|
|
878
|
+
</CardContent>
|
|
879
|
+
</Card>
|
|
880
|
+
)
|
|
881
|
+
}
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
---
|
|
885
|
+
|
|
886
|
+
## ThingTable with shadcn/ui
|
|
887
|
+
|
|
888
|
+
```tsx
|
|
889
|
+
// frontend/src/components/generic/ThingTable.tsx
|
|
890
|
+
import { type Thing } from '@one-platform/core'
|
|
891
|
+
import { useThingConfig } from '@/ontology/hooks/useThingConfig'
|
|
892
|
+
import {
|
|
893
|
+
Table,
|
|
894
|
+
TableBody,
|
|
895
|
+
TableCell,
|
|
896
|
+
TableHead,
|
|
897
|
+
TableHeader,
|
|
898
|
+
TableRow,
|
|
899
|
+
} from '@/components/ui/table'
|
|
900
|
+
import { Button } from '@/components/ui/button'
|
|
901
|
+
import { Field } from './Field'
|
|
902
|
+
import { ArrowUpDown } from 'lucide-react'
|
|
903
|
+
|
|
904
|
+
interface ThingTableProps {
|
|
905
|
+
things: Thing[]
|
|
906
|
+
onRowClick?: (thing: Thing) => void
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
export function ThingTable({ things, onRowClick }: ThingTableProps) {
|
|
910
|
+
if (things.length === 0) return null
|
|
911
|
+
|
|
912
|
+
const config = useThingConfig(things[0].type)
|
|
913
|
+
const tableView = config.ui.views.table
|
|
914
|
+
|
|
915
|
+
if (!tableView) return null
|
|
916
|
+
|
|
917
|
+
return (
|
|
918
|
+
<div className="rounded-md border">
|
|
919
|
+
<Table>
|
|
920
|
+
<TableHeader>
|
|
921
|
+
<TableRow>
|
|
922
|
+
{tableView.fields.map(fieldName => {
|
|
923
|
+
const fieldConfig = config.ui.fields[fieldName]
|
|
924
|
+
return (
|
|
925
|
+
<TableHead key={fieldName}>
|
|
926
|
+
<Button
|
|
927
|
+
variant="ghost"
|
|
928
|
+
size="sm"
|
|
929
|
+
className="-ml-3 h-8"
|
|
930
|
+
onClick={() => {
|
|
931
|
+
// Handle sort
|
|
932
|
+
}}
|
|
933
|
+
>
|
|
934
|
+
{fieldConfig?.label || fieldName}
|
|
935
|
+
<ArrowUpDown className="ml-2 h-4 w-4" />
|
|
936
|
+
</Button>
|
|
937
|
+
</TableHead>
|
|
938
|
+
)
|
|
939
|
+
})}
|
|
940
|
+
</TableRow>
|
|
941
|
+
</TableHeader>
|
|
942
|
+
<TableBody>
|
|
943
|
+
{things.map(thing => (
|
|
944
|
+
<TableRow
|
|
945
|
+
key={thing._id}
|
|
946
|
+
className="cursor-pointer"
|
|
947
|
+
onClick={() => onRowClick?.(thing)}
|
|
948
|
+
>
|
|
949
|
+
{tableView.fields.map(fieldName => (
|
|
950
|
+
<TableCell key={fieldName}>
|
|
951
|
+
<Field
|
|
952
|
+
name={fieldName}
|
|
953
|
+
value={thing.properties[fieldName]}
|
|
954
|
+
config={config.ui.fields[fieldName]}
|
|
955
|
+
thing={thing}
|
|
956
|
+
/>
|
|
957
|
+
</TableCell>
|
|
958
|
+
))}
|
|
959
|
+
</TableRow>
|
|
960
|
+
))}
|
|
961
|
+
</TableBody>
|
|
962
|
+
</Table>
|
|
963
|
+
</div>
|
|
964
|
+
)
|
|
965
|
+
}
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
---
|
|
969
|
+
|
|
970
|
+
## Theme Support
|
|
971
|
+
|
|
972
|
+
### Dark Mode
|
|
973
|
+
|
|
974
|
+
shadcn/ui includes built-in dark mode support:
|
|
975
|
+
|
|
976
|
+
```tsx
|
|
977
|
+
// frontend/src/components/ThemeProvider.tsx
|
|
978
|
+
import { createContext, useContext, useEffect, useState } from 'react'
|
|
979
|
+
|
|
980
|
+
type Theme = 'dark' | 'light' | 'system'
|
|
981
|
+
|
|
982
|
+
const ThemeProviderContext = createContext<{
|
|
983
|
+
theme: Theme
|
|
984
|
+
setTheme: (theme: Theme) => void
|
|
985
|
+
}>({
|
|
986
|
+
theme: 'system',
|
|
987
|
+
setTheme: () => null,
|
|
988
|
+
})
|
|
989
|
+
|
|
990
|
+
export function ThemeProvider({
|
|
991
|
+
children,
|
|
992
|
+
defaultTheme = 'system',
|
|
993
|
+
}: {
|
|
994
|
+
children: React.ReactNode
|
|
995
|
+
defaultTheme?: Theme
|
|
996
|
+
}) {
|
|
997
|
+
const [theme, setTheme] = useState<Theme>(defaultTheme)
|
|
998
|
+
|
|
999
|
+
useEffect(() => {
|
|
1000
|
+
const root = window.document.documentElement
|
|
1001
|
+
root.classList.remove('light', 'dark')
|
|
1002
|
+
|
|
1003
|
+
if (theme === 'system') {
|
|
1004
|
+
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
|
|
1005
|
+
.matches
|
|
1006
|
+
? 'dark'
|
|
1007
|
+
: 'light'
|
|
1008
|
+
root.classList.add(systemTheme)
|
|
1009
|
+
return
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
root.classList.add(theme)
|
|
1013
|
+
}, [theme])
|
|
1014
|
+
|
|
1015
|
+
return (
|
|
1016
|
+
<ThemeProviderContext.Provider value={{ theme, setTheme }}>
|
|
1017
|
+
{children}
|
|
1018
|
+
</ThemeProviderContext.Provider>
|
|
1019
|
+
)
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
export const useTheme = () => useContext(ThemeProviderContext)
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
### Theme Toggle
|
|
1026
|
+
|
|
1027
|
+
```tsx
|
|
1028
|
+
// frontend/src/components/ThemeToggle.tsx
|
|
1029
|
+
import { Moon, Sun } from 'lucide-react'
|
|
1030
|
+
import { Button } from '@/components/ui/button'
|
|
1031
|
+
import {
|
|
1032
|
+
DropdownMenu,
|
|
1033
|
+
DropdownMenuContent,
|
|
1034
|
+
DropdownMenuItem,
|
|
1035
|
+
DropdownMenuTrigger,
|
|
1036
|
+
} from '@/components/ui/dropdown-menu'
|
|
1037
|
+
import { useTheme } from './ThemeProvider'
|
|
1038
|
+
|
|
1039
|
+
export function ThemeToggle() {
|
|
1040
|
+
const { setTheme } = useTheme()
|
|
1041
|
+
|
|
1042
|
+
return (
|
|
1043
|
+
<DropdownMenu>
|
|
1044
|
+
<DropdownMenuTrigger asChild>
|
|
1045
|
+
<Button variant="ghost" size="icon">
|
|
1046
|
+
<Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
|
1047
|
+
<Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
|
1048
|
+
<span className="sr-only">Toggle theme</span>
|
|
1049
|
+
</Button>
|
|
1050
|
+
</DropdownMenuTrigger>
|
|
1051
|
+
<DropdownMenuContent align="end">
|
|
1052
|
+
<DropdownMenuItem onClick={() => setTheme('light')}>
|
|
1053
|
+
Light
|
|
1054
|
+
</DropdownMenuItem>
|
|
1055
|
+
<DropdownMenuItem onClick={() => setTheme('dark')}>
|
|
1056
|
+
Dark
|
|
1057
|
+
</DropdownMenuItem>
|
|
1058
|
+
<DropdownMenuItem onClick={() => setTheme('system')}>
|
|
1059
|
+
System
|
|
1060
|
+
</DropdownMenuItem>
|
|
1061
|
+
</DropdownMenuContent>
|
|
1062
|
+
</DropdownMenu>
|
|
1063
|
+
)
|
|
1064
|
+
}
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
---
|
|
1068
|
+
|
|
1069
|
+
## Responsive Design
|
|
1070
|
+
|
|
1071
|
+
shadcn/ui components are responsive by default. Use Tailwind's responsive utilities:
|
|
1072
|
+
|
|
1073
|
+
```tsx
|
|
1074
|
+
<Card className="w-full sm:w-1/2 lg:w-1/3">
|
|
1075
|
+
{/* Responsive card width */}
|
|
1076
|
+
</Card>
|
|
1077
|
+
|
|
1078
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
1079
|
+
{/* Responsive grid */}
|
|
1080
|
+
</div>
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
---
|
|
1084
|
+
|
|
1085
|
+
## Accessibility
|
|
1086
|
+
|
|
1087
|
+
shadcn/ui components are built on Radix UI, which provides:
|
|
1088
|
+
|
|
1089
|
+
- ✅ **Keyboard navigation** - Full keyboard support
|
|
1090
|
+
- ✅ **Screen reader support** - ARIA labels and descriptions
|
|
1091
|
+
- ✅ **Focus management** - Proper focus handling
|
|
1092
|
+
- ✅ **Color contrast** - WCAG AA compliant
|
|
1093
|
+
- ✅ **RTL support** - Right-to-left languages
|
|
1094
|
+
|
|
1095
|
+
### Example: Accessible Form
|
|
1096
|
+
|
|
1097
|
+
```tsx
|
|
1098
|
+
<form className="space-y-4">
|
|
1099
|
+
<div className="space-y-2">
|
|
1100
|
+
<Label htmlFor="title">Course Title</Label>
|
|
1101
|
+
<Input
|
|
1102
|
+
id="title"
|
|
1103
|
+
placeholder="Enter title"
|
|
1104
|
+
aria-describedby="title-description"
|
|
1105
|
+
/>
|
|
1106
|
+
<p id="title-description" className="text-sm text-muted-foreground">
|
|
1107
|
+
This will be the main title displayed to students
|
|
1108
|
+
</p>
|
|
1109
|
+
</div>
|
|
1110
|
+
</form>
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
---
|
|
1114
|
+
|
|
1115
|
+
## Usage Examples
|
|
1116
|
+
|
|
1117
|
+
### Course Card
|
|
1118
|
+
|
|
1119
|
+
```tsx
|
|
1120
|
+
import { ThingCard } from '@/components/generic/ThingCard'
|
|
1121
|
+
|
|
1122
|
+
export function CoursesPage() {
|
|
1123
|
+
const courses = await getCourses()
|
|
1124
|
+
|
|
1125
|
+
return (
|
|
1126
|
+
<div className="container mx-auto py-8">
|
|
1127
|
+
<h1 className="text-3xl font-bold mb-6">Courses</h1>
|
|
1128
|
+
|
|
1129
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
1130
|
+
{courses.map(course => (
|
|
1131
|
+
<ThingCard
|
|
1132
|
+
key={course._id}
|
|
1133
|
+
thing={course}
|
|
1134
|
+
onClick={(thing) => {
|
|
1135
|
+
router.push(`/courses/${thing._id}`)
|
|
1136
|
+
}}
|
|
1137
|
+
/>
|
|
1138
|
+
))}
|
|
1139
|
+
</div>
|
|
1140
|
+
</div>
|
|
1141
|
+
)
|
|
1142
|
+
}
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
### Product Grid with Filters
|
|
1146
|
+
|
|
1147
|
+
```tsx
|
|
1148
|
+
import { ThingCard } from '@/components/generic/ThingCard'
|
|
1149
|
+
import {
|
|
1150
|
+
Select,
|
|
1151
|
+
SelectContent,
|
|
1152
|
+
SelectItem,
|
|
1153
|
+
SelectTrigger,
|
|
1154
|
+
SelectValue,
|
|
1155
|
+
} from '@/components/ui/select'
|
|
1156
|
+
import { Input } from '@/components/ui/input'
|
|
1157
|
+
|
|
1158
|
+
export function ProductsPage() {
|
|
1159
|
+
const [products, setProducts] = useState([])
|
|
1160
|
+
const [category, setCategory] = useState('all')
|
|
1161
|
+
|
|
1162
|
+
return (
|
|
1163
|
+
<div className="container mx-auto py-8">
|
|
1164
|
+
<div className="flex items-center gap-4 mb-6">
|
|
1165
|
+
<Input
|
|
1166
|
+
placeholder="Search products..."
|
|
1167
|
+
className="max-w-sm"
|
|
1168
|
+
/>
|
|
1169
|
+
<Select value={category} onValueChange={setCategory}>
|
|
1170
|
+
<SelectTrigger className="w-[180px]">
|
|
1171
|
+
<SelectValue placeholder="Category" />
|
|
1172
|
+
</SelectTrigger>
|
|
1173
|
+
<SelectContent>
|
|
1174
|
+
<SelectItem value="all">All Categories</SelectItem>
|
|
1175
|
+
<SelectItem value="books">Books</SelectItem>
|
|
1176
|
+
<SelectItem value="courses">Courses</SelectItem>
|
|
1177
|
+
</SelectContent>
|
|
1178
|
+
</Select>
|
|
1179
|
+
</div>
|
|
1180
|
+
|
|
1181
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
1182
|
+
{products.map(product => (
|
|
1183
|
+
<ThingCard key={product._id} thing={product} />
|
|
1184
|
+
))}
|
|
1185
|
+
</div>
|
|
1186
|
+
</div>
|
|
1187
|
+
)
|
|
1188
|
+
}
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
---
|
|
1192
|
+
|
|
1193
|
+
## Customization
|
|
1194
|
+
|
|
1195
|
+
### Custom Theme Colors
|
|
1196
|
+
|
|
1197
|
+
```css
|
|
1198
|
+
/* frontend/src/styles/globals.css */
|
|
1199
|
+
@layer base {
|
|
1200
|
+
:root {
|
|
1201
|
+
--background: 0 0% 100%;
|
|
1202
|
+
--foreground: 222.2 84% 4.9%;
|
|
1203
|
+
--primary: 221.2 83.2% 53.3%;
|
|
1204
|
+
--primary-foreground: 210 40% 98%;
|
|
1205
|
+
/* ... other colors */
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
.dark {
|
|
1209
|
+
--background: 222.2 84% 4.9%;
|
|
1210
|
+
--foreground: 210 40% 98%;
|
|
1211
|
+
--primary: 217.2 91.2% 59.8%;
|
|
1212
|
+
--primary-foreground: 222.2 47.4% 11.2%;
|
|
1213
|
+
/* ... other colors */
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
```
|
|
1217
|
+
|
|
1218
|
+
### Organization-Specific Overrides
|
|
1219
|
+
|
|
1220
|
+
```tsx
|
|
1221
|
+
// Custom badge colors per organization
|
|
1222
|
+
const config = {
|
|
1223
|
+
...defaultCourseConfig,
|
|
1224
|
+
ui: {
|
|
1225
|
+
...defaultCourseConfig.ui,
|
|
1226
|
+
fields: {
|
|
1227
|
+
...defaultCourseConfig.ui.fields,
|
|
1228
|
+
level: {
|
|
1229
|
+
...defaultCourseConfig.ui.fields.level,
|
|
1230
|
+
colors: {
|
|
1231
|
+
beginner: 'blue', // Override to blue
|
|
1232
|
+
intermediate: 'purple',
|
|
1233
|
+
advanced: 'orange'
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
---
|
|
1242
|
+
|
|
1243
|
+
## Next Steps
|
|
1244
|
+
|
|
1245
|
+
### Week 1: Setup
|
|
1246
|
+
- [ ] Install shadcn/ui
|
|
1247
|
+
- [ ] Add all required components
|
|
1248
|
+
- [ ] Setup theme provider
|
|
1249
|
+
- [ ] Configure Tailwind
|
|
1250
|
+
|
|
1251
|
+
### Week 2: Core Components
|
|
1252
|
+
- [ ] Build ThingCard with shadcn/ui
|
|
1253
|
+
- [ ] Build Field component
|
|
1254
|
+
- [ ] Build Actions component
|
|
1255
|
+
- [ ] Test with 3 thing types
|
|
1256
|
+
|
|
1257
|
+
### Week 3: Field Components
|
|
1258
|
+
- [ ] Build all field components
|
|
1259
|
+
- [ ] Add Price, Image, TagList
|
|
1260
|
+
- [ ] Add DateField, Avatar, Link
|
|
1261
|
+
- [ ] Test responsive design
|
|
1262
|
+
|
|
1263
|
+
### Week 4: Advanced
|
|
1264
|
+
- [ ] Build ThingTable
|
|
1265
|
+
- [ ] Add dark mode support
|
|
1266
|
+
- [ ] Add accessibility features
|
|
1267
|
+
- [ ] Performance optimization
|
|
1268
|
+
|
|
1269
|
+
---
|
|
1270
|
+
|
|
1271
|
+
## Resources
|
|
1272
|
+
|
|
1273
|
+
- **shadcn/ui Docs**: https://ui.shadcn.com
|
|
1274
|
+
- **Radix UI Docs**: https://www.radix-ui.com
|
|
1275
|
+
- **Tailwind CSS**: https://tailwindcss.com
|
|
1276
|
+
- **Lucide Icons**: https://lucide.dev
|
|
1277
|
+
|
|
1278
|
+
---
|
|
1279
|
+
|
|
1280
|
+
**With shadcn/ui, every thing type gets beautiful, accessible UI automatically.**
|