oneie 2.0.2 → 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/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,929 @@
|
|
|
1
|
+
# Card Component (shadcn/ui)
|
|
2
|
+
|
|
3
|
+
> **⚠️ DEPRECATED:** This document has been superseded by a cleaner approach. Please use:
|
|
4
|
+
> - `one/things/components/card.md` - Card implementation (uses shadcn/ui naturally)
|
|
5
|
+
> - `one/things/features/ontology-ui.md` - Clean UI metadata specification
|
|
6
|
+
> - `one/things/plans/ontology-ui-approach.md` - Philosophy explanation
|
|
7
|
+
>
|
|
8
|
+
> **Why the change?** The new approach integrates shadcn/ui naturally into card.md without separate documentation, resulting in cleaner, simpler docs with no redundancy.
|
|
9
|
+
|
|
10
|
+
**Generic card component using shadcn/ui that renders ANY thing type from the ontology**
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Install shadcn/ui components
|
|
18
|
+
npx shadcn-ui@latest add card button badge avatar separator
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { ThingCard } from '@/components/generic/ThingCard'
|
|
23
|
+
|
|
24
|
+
// Works for ALL 66 types!
|
|
25
|
+
<ThingCard thing={course} />
|
|
26
|
+
<ThingCard thing={product} />
|
|
27
|
+
<ThingCard thing={post} />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Full Implementation
|
|
33
|
+
|
|
34
|
+
### ThingCard Component
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// frontend/src/components/generic/ThingCard.tsx
|
|
38
|
+
import { type Thing } from '@one-platform/core'
|
|
39
|
+
import { useThingConfig } from '@/ontology/hooks/useThingConfig'
|
|
40
|
+
import {
|
|
41
|
+
Card,
|
|
42
|
+
CardContent,
|
|
43
|
+
CardDescription,
|
|
44
|
+
CardFooter,
|
|
45
|
+
CardHeader,
|
|
46
|
+
CardTitle,
|
|
47
|
+
} from '@/components/ui/card'
|
|
48
|
+
import { Separator } from '@/components/ui/separator'
|
|
49
|
+
import { Field } from './Field'
|
|
50
|
+
import { Actions } from './Actions'
|
|
51
|
+
import { ConnectionBadges } from './ConnectionBadges'
|
|
52
|
+
import { cn } from '@/lib/utils'
|
|
53
|
+
|
|
54
|
+
interface ThingCardProps {
|
|
55
|
+
thing: Thing
|
|
56
|
+
view?: 'card' | 'list' | 'detail'
|
|
57
|
+
onClick?: (thing: Thing) => void
|
|
58
|
+
showActions?: boolean
|
|
59
|
+
showConnections?: boolean
|
|
60
|
+
className?: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function ThingCard({
|
|
64
|
+
thing,
|
|
65
|
+
view = 'card',
|
|
66
|
+
onClick,
|
|
67
|
+
showActions = true,
|
|
68
|
+
showConnections = true,
|
|
69
|
+
className
|
|
70
|
+
}: ThingCardProps) {
|
|
71
|
+
// Get UI config from ontology
|
|
72
|
+
const config = useThingConfig(thing.type)
|
|
73
|
+
const viewConfig = config.ui.views[view]
|
|
74
|
+
|
|
75
|
+
if (!viewConfig) {
|
|
76
|
+
console.warn(`View "${view}" not defined for type "${thing.type}"`)
|
|
77
|
+
return null
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Get fields to display
|
|
81
|
+
const fields = viewConfig.fields === '*'
|
|
82
|
+
? Object.keys(config.properties)
|
|
83
|
+
: viewConfig.fields
|
|
84
|
+
|
|
85
|
+
// Separate header fields (first 2) from body fields
|
|
86
|
+
const headerFields = fields.slice(0, 2)
|
|
87
|
+
const bodyFields = fields.slice(2)
|
|
88
|
+
|
|
89
|
+
// Check if card should be clickable
|
|
90
|
+
const isClickable = onClick || config.ui.actions.primary
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Card
|
|
94
|
+
className={cn(
|
|
95
|
+
isClickable && 'cursor-pointer transition-all hover:shadow-lg hover:scale-[1.02]',
|
|
96
|
+
className
|
|
97
|
+
)}
|
|
98
|
+
onClick={() => {
|
|
99
|
+
if (onClick) {
|
|
100
|
+
onClick(thing)
|
|
101
|
+
} else if (config.ui.actions.primary && !showActions) {
|
|
102
|
+
// Execute primary action if actions are hidden
|
|
103
|
+
handlePrimaryAction(thing, config.ui.actions.primary.action)
|
|
104
|
+
}
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
{/* Header: Typically thumbnail + title */}
|
|
108
|
+
<CardHeader className="space-y-0 pb-3">
|
|
109
|
+
{headerFields.map(fieldName => {
|
|
110
|
+
const fieldConfig = config.ui.fields[fieldName]
|
|
111
|
+
if (fieldConfig?.hidden) return null
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Field
|
|
115
|
+
key={fieldName}
|
|
116
|
+
name={fieldName}
|
|
117
|
+
value={thing.properties[fieldName]}
|
|
118
|
+
config={fieldConfig}
|
|
119
|
+
thing={thing}
|
|
120
|
+
/>
|
|
121
|
+
)
|
|
122
|
+
})}
|
|
123
|
+
</CardHeader>
|
|
124
|
+
|
|
125
|
+
{/* Body: Description, price, badges, etc. */}
|
|
126
|
+
{bodyFields.length > 0 && (
|
|
127
|
+
<CardContent className="space-y-2 pb-3">
|
|
128
|
+
{bodyFields.map(fieldName => {
|
|
129
|
+
const fieldConfig = config.ui.fields[fieldName]
|
|
130
|
+
|
|
131
|
+
// Skip hidden fields
|
|
132
|
+
if (fieldConfig?.hidden) return null
|
|
133
|
+
|
|
134
|
+
// Skip showOnlyIf fields that are false
|
|
135
|
+
if (fieldConfig?.showOnlyIf && !thing.properties[fieldName]) {
|
|
136
|
+
return null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
<Field
|
|
141
|
+
key={fieldName}
|
|
142
|
+
name={fieldName}
|
|
143
|
+
value={thing.properties[fieldName]}
|
|
144
|
+
config={fieldConfig}
|
|
145
|
+
thing={thing}
|
|
146
|
+
/>
|
|
147
|
+
)
|
|
148
|
+
})}
|
|
149
|
+
</CardContent>
|
|
150
|
+
)}
|
|
151
|
+
|
|
152
|
+
{/* Connection badges */}
|
|
153
|
+
{showConnections && config.ui.connections && (
|
|
154
|
+
<>
|
|
155
|
+
<Separator className="mb-3" />
|
|
156
|
+
<CardContent className="pt-0 pb-3">
|
|
157
|
+
<ConnectionBadges
|
|
158
|
+
thing={thing}
|
|
159
|
+
config={config.ui.connections}
|
|
160
|
+
/>
|
|
161
|
+
</CardContent>
|
|
162
|
+
</>
|
|
163
|
+
)}
|
|
164
|
+
|
|
165
|
+
{/* Actions footer */}
|
|
166
|
+
{showActions && (config.ui.actions.primary || config.ui.actions.secondary) && (
|
|
167
|
+
<>
|
|
168
|
+
<Separator />
|
|
169
|
+
<CardFooter className="pt-3">
|
|
170
|
+
<Actions
|
|
171
|
+
thing={thing}
|
|
172
|
+
primary={config.ui.actions.primary}
|
|
173
|
+
secondary={config.ui.actions.secondary}
|
|
174
|
+
context={config.ui.actions.context}
|
|
175
|
+
/>
|
|
176
|
+
</CardFooter>
|
|
177
|
+
</>
|
|
178
|
+
)}
|
|
179
|
+
</Card>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Helper function to handle primary action
|
|
184
|
+
function handlePrimaryAction(thing: Thing, action: string) {
|
|
185
|
+
// Route to appropriate handler
|
|
186
|
+
switch (action) {
|
|
187
|
+
case 'enroll':
|
|
188
|
+
case 'purchase':
|
|
189
|
+
case 'addToCart':
|
|
190
|
+
// Navigate to action page
|
|
191
|
+
window.location.href = `/${action}/${thing._id}`
|
|
192
|
+
break
|
|
193
|
+
case 'preview':
|
|
194
|
+
case 'read':
|
|
195
|
+
case 'viewProfile':
|
|
196
|
+
// Navigate to detail page
|
|
197
|
+
window.location.href = `/${thing.type}/${thing._id}`
|
|
198
|
+
break
|
|
199
|
+
default:
|
|
200
|
+
console.warn(`Unhandled action: ${action}`)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Variants
|
|
208
|
+
|
|
209
|
+
### Compact Card
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
// frontend/src/components/generic/ThingCard.Compact.tsx
|
|
213
|
+
export function ThingCardCompact({ thing }: { thing: Thing }) {
|
|
214
|
+
const config = useThingConfig(thing.type)
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<Card className="hover:shadow-md transition-shadow">
|
|
218
|
+
<CardContent className="p-4 flex items-center gap-4">
|
|
219
|
+
{/* Thumbnail */}
|
|
220
|
+
<Field
|
|
221
|
+
name="thumbnail"
|
|
222
|
+
value={thing.properties.thumbnail}
|
|
223
|
+
config={config.ui.fields.thumbnail}
|
|
224
|
+
thing={thing}
|
|
225
|
+
/>
|
|
226
|
+
|
|
227
|
+
{/* Title + description */}
|
|
228
|
+
<div className="flex-1 min-w-0">
|
|
229
|
+
<CardTitle className="text-base truncate">
|
|
230
|
+
{thing.name}
|
|
231
|
+
</CardTitle>
|
|
232
|
+
<CardDescription className="text-sm truncate">
|
|
233
|
+
{thing.properties.description}
|
|
234
|
+
</CardDescription>
|
|
235
|
+
</div>
|
|
236
|
+
|
|
237
|
+
{/* Price */}
|
|
238
|
+
{thing.properties.price !== undefined && (
|
|
239
|
+
<Field
|
|
240
|
+
name="price"
|
|
241
|
+
value={thing.properties.price}
|
|
242
|
+
config={config.ui.fields.price}
|
|
243
|
+
thing={thing}
|
|
244
|
+
/>
|
|
245
|
+
)}
|
|
246
|
+
</CardContent>
|
|
247
|
+
</Card>
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Horizontal Card
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
// frontend/src/components/generic/ThingCard.Horizontal.tsx
|
|
256
|
+
export function ThingCardHorizontal({ thing }: { thing: Thing }) {
|
|
257
|
+
const config = useThingConfig(thing.type)
|
|
258
|
+
const listView = config.ui.views.list
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<Card className="hover:shadow-md transition-shadow">
|
|
262
|
+
<div className="flex">
|
|
263
|
+
{/* Left: Image */}
|
|
264
|
+
<div className="w-48 flex-shrink-0">
|
|
265
|
+
<Field
|
|
266
|
+
name={listView.fields[0]}
|
|
267
|
+
value={thing.properties[listView.fields[0]]}
|
|
268
|
+
config={config.ui.fields[listView.fields[0]]}
|
|
269
|
+
thing={thing}
|
|
270
|
+
/>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
{/* Right: Content */}
|
|
274
|
+
<div className="flex-1 p-6">
|
|
275
|
+
<div className="space-y-3">
|
|
276
|
+
{listView.fields.slice(1).map(fieldName => (
|
|
277
|
+
<Field
|
|
278
|
+
key={fieldName}
|
|
279
|
+
name={fieldName}
|
|
280
|
+
value={thing.properties[fieldName]}
|
|
281
|
+
config={config.ui.fields[fieldName]}
|
|
282
|
+
thing={thing}
|
|
283
|
+
/>
|
|
284
|
+
))}
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
{/* Actions */}
|
|
288
|
+
<div className="mt-4">
|
|
289
|
+
<Actions
|
|
290
|
+
thing={thing}
|
|
291
|
+
primary={config.ui.actions.primary}
|
|
292
|
+
secondary={config.ui.actions.secondary}
|
|
293
|
+
/>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
</Card>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Featured Card
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
// frontend/src/components/generic/ThingCard.Featured.tsx
|
|
306
|
+
export function ThingCardFeatured({ thing }: { thing: Thing }) {
|
|
307
|
+
const config = useThingConfig(thing.type)
|
|
308
|
+
|
|
309
|
+
return (
|
|
310
|
+
<Card className="border-primary shadow-lg">
|
|
311
|
+
<CardHeader className="relative">
|
|
312
|
+
{/* Featured badge */}
|
|
313
|
+
<div className="absolute top-4 right-4 z-10">
|
|
314
|
+
<Badge variant="default" className="gap-1">
|
|
315
|
+
<Star className="h-3 w-3 fill-current" />
|
|
316
|
+
Featured
|
|
317
|
+
</Badge>
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
{/* Large thumbnail */}
|
|
321
|
+
<Field
|
|
322
|
+
name="thumbnail"
|
|
323
|
+
value={thing.properties.thumbnail}
|
|
324
|
+
config={{
|
|
325
|
+
...config.ui.fields.thumbnail,
|
|
326
|
+
aspect: 'wide'
|
|
327
|
+
}}
|
|
328
|
+
thing={thing}
|
|
329
|
+
/>
|
|
330
|
+
</CardHeader>
|
|
331
|
+
|
|
332
|
+
<CardContent className="space-y-4">
|
|
333
|
+
{/* Title */}
|
|
334
|
+
<CardTitle className="text-2xl">{thing.name}</CardTitle>
|
|
335
|
+
|
|
336
|
+
{/* Description */}
|
|
337
|
+
<CardDescription className="text-base">
|
|
338
|
+
{thing.properties.description}
|
|
339
|
+
</CardDescription>
|
|
340
|
+
|
|
341
|
+
{/* Additional fields */}
|
|
342
|
+
<div className="flex items-center gap-4">
|
|
343
|
+
<Field
|
|
344
|
+
name="price"
|
|
345
|
+
value={thing.properties.price}
|
|
346
|
+
config={config.ui.fields.price}
|
|
347
|
+
thing={thing}
|
|
348
|
+
/>
|
|
349
|
+
<Field
|
|
350
|
+
name="level"
|
|
351
|
+
value={thing.properties.level}
|
|
352
|
+
config={config.ui.fields.level}
|
|
353
|
+
thing={thing}
|
|
354
|
+
/>
|
|
355
|
+
</div>
|
|
356
|
+
</CardContent>
|
|
357
|
+
|
|
358
|
+
<CardFooter>
|
|
359
|
+
<Actions
|
|
360
|
+
thing={thing}
|
|
361
|
+
primary={config.ui.actions.primary}
|
|
362
|
+
secondary={config.ui.actions.secondary}
|
|
363
|
+
/>
|
|
364
|
+
</CardFooter>
|
|
365
|
+
</Card>
|
|
366
|
+
)
|
|
367
|
+
}
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Grid Layouts
|
|
373
|
+
|
|
374
|
+
### Basic Grid
|
|
375
|
+
|
|
376
|
+
```tsx
|
|
377
|
+
// frontend/src/components/generic/ThingGrid.tsx
|
|
378
|
+
import { ThingCard } from './ThingCard'
|
|
379
|
+
|
|
380
|
+
interface ThingGridProps {
|
|
381
|
+
things: Thing[]
|
|
382
|
+
columns?: 2 | 3 | 4
|
|
383
|
+
gap?: 'sm' | 'md' | 'lg'
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export function ThingGrid({
|
|
387
|
+
things,
|
|
388
|
+
columns = 3,
|
|
389
|
+
gap = 'md'
|
|
390
|
+
}: ThingGridProps) {
|
|
391
|
+
const columnClasses = {
|
|
392
|
+
2: 'grid-cols-1 md:grid-cols-2',
|
|
393
|
+
3: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
|
394
|
+
4: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4'
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const gapClasses = {
|
|
398
|
+
sm: 'gap-4',
|
|
399
|
+
md: 'gap-6',
|
|
400
|
+
lg: 'gap-8'
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<div className={cn('grid', columnClasses[columns], gapClasses[gap])}>
|
|
405
|
+
{things.map(thing => (
|
|
406
|
+
<ThingCard key={thing._id} thing={thing} />
|
|
407
|
+
))}
|
|
408
|
+
</div>
|
|
409
|
+
)
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Masonry Grid
|
|
414
|
+
|
|
415
|
+
```tsx
|
|
416
|
+
// frontend/src/components/generic/ThingMasonry.tsx
|
|
417
|
+
import { ThingCard } from './ThingCard'
|
|
418
|
+
|
|
419
|
+
export function ThingMasonry({ things }: { things: Thing[] }) {
|
|
420
|
+
return (
|
|
421
|
+
<div className="columns-1 md:columns-2 lg:columns-3 gap-6">
|
|
422
|
+
{things.map(thing => (
|
|
423
|
+
<div key={thing._id} className="break-inside-avoid mb-6">
|
|
424
|
+
<ThingCard thing={thing} />
|
|
425
|
+
</div>
|
|
426
|
+
))}
|
|
427
|
+
</div>
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## List Layouts
|
|
435
|
+
|
|
436
|
+
### Simple List
|
|
437
|
+
|
|
438
|
+
```tsx
|
|
439
|
+
// frontend/src/components/generic/ThingList.tsx
|
|
440
|
+
import { ThingCard } from './ThingCard'
|
|
441
|
+
import { Separator } from '@/components/ui/separator'
|
|
442
|
+
|
|
443
|
+
export function ThingList({ things }: { things: Thing[] }) {
|
|
444
|
+
return (
|
|
445
|
+
<div className="space-y-4">
|
|
446
|
+
{things.map((thing, index) => (
|
|
447
|
+
<div key={thing._id}>
|
|
448
|
+
<ThingCard thing={thing} view="list" />
|
|
449
|
+
{index < things.length - 1 && <Separator className="my-4" />}
|
|
450
|
+
</div>
|
|
451
|
+
))}
|
|
452
|
+
</div>
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Grouped List
|
|
458
|
+
|
|
459
|
+
```tsx
|
|
460
|
+
// frontend/src/components/generic/ThingListGrouped.tsx
|
|
461
|
+
import { ThingCard } from './ThingCard'
|
|
462
|
+
import { Separator } from '@/components/ui/separator'
|
|
463
|
+
|
|
464
|
+
interface ThingListGroupedProps {
|
|
465
|
+
things: Thing[]
|
|
466
|
+
groupBy: string // e.g., 'category', 'level'
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export function ThingListGrouped({ things, groupBy }: ThingListGroupedProps) {
|
|
470
|
+
// Group things
|
|
471
|
+
const grouped = things.reduce((acc, thing) => {
|
|
472
|
+
const key = thing.properties[groupBy] || 'Other'
|
|
473
|
+
if (!acc[key]) acc[key] = []
|
|
474
|
+
acc[key].push(thing)
|
|
475
|
+
return acc
|
|
476
|
+
}, {} as Record<string, Thing[]>)
|
|
477
|
+
|
|
478
|
+
return (
|
|
479
|
+
<div className="space-y-8">
|
|
480
|
+
{Object.entries(grouped).map(([group, items]) => (
|
|
481
|
+
<div key={group}>
|
|
482
|
+
<h3 className="text-xl font-semibold mb-4">{group}</h3>
|
|
483
|
+
<div className="space-y-4">
|
|
484
|
+
{items.map((thing, index) => (
|
|
485
|
+
<div key={thing._id}>
|
|
486
|
+
<ThingCard thing={thing} view="list" />
|
|
487
|
+
{index < items.length - 1 && <Separator className="my-4" />}
|
|
488
|
+
</div>
|
|
489
|
+
))}
|
|
490
|
+
</div>
|
|
491
|
+
</div>
|
|
492
|
+
))}
|
|
493
|
+
</div>
|
|
494
|
+
)
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## Interactive Features
|
|
501
|
+
|
|
502
|
+
### With Selection
|
|
503
|
+
|
|
504
|
+
```tsx
|
|
505
|
+
// frontend/src/components/generic/ThingCardSelectable.tsx
|
|
506
|
+
import { Checkbox } from '@/components/ui/checkbox'
|
|
507
|
+
|
|
508
|
+
interface ThingCardSelectableProps {
|
|
509
|
+
thing: Thing
|
|
510
|
+
selected: boolean
|
|
511
|
+
onSelectedChange: (selected: boolean) => void
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export function ThingCardSelectable({
|
|
515
|
+
thing,
|
|
516
|
+
selected,
|
|
517
|
+
onSelectedChange
|
|
518
|
+
}: ThingCardSelectableProps) {
|
|
519
|
+
return (
|
|
520
|
+
<Card className={cn(selected && 'ring-2 ring-primary')}>
|
|
521
|
+
<div className="absolute top-4 right-4 z-10">
|
|
522
|
+
<Checkbox
|
|
523
|
+
checked={selected}
|
|
524
|
+
onCheckedChange={onSelectedChange}
|
|
525
|
+
onClick={(e) => e.stopPropagation()}
|
|
526
|
+
/>
|
|
527
|
+
</div>
|
|
528
|
+
|
|
529
|
+
<ThingCard thing={thing} showActions={false} />
|
|
530
|
+
</Card>
|
|
531
|
+
)
|
|
532
|
+
}
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
### With Drag & Drop
|
|
536
|
+
|
|
537
|
+
```tsx
|
|
538
|
+
// frontend/src/components/generic/ThingCardDraggable.tsx
|
|
539
|
+
import { useSortable } from '@dnd-kit/sortable'
|
|
540
|
+
import { CSS } from '@dnd-kit/utilities'
|
|
541
|
+
import { GripVertical } from 'lucide-react'
|
|
542
|
+
|
|
543
|
+
export function ThingCardDraggable({ thing }: { thing: Thing }) {
|
|
544
|
+
const {
|
|
545
|
+
attributes,
|
|
546
|
+
listeners,
|
|
547
|
+
setNodeRef,
|
|
548
|
+
transform,
|
|
549
|
+
transition,
|
|
550
|
+
isDragging
|
|
551
|
+
} = useSortable({ id: thing._id })
|
|
552
|
+
|
|
553
|
+
const style = {
|
|
554
|
+
transform: CSS.Transform.toString(transform),
|
|
555
|
+
transition,
|
|
556
|
+
opacity: isDragging ? 0.5 : 1
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
return (
|
|
560
|
+
<div ref={setNodeRef} style={style}>
|
|
561
|
+
<Card>
|
|
562
|
+
<div className="flex items-start gap-2 p-4">
|
|
563
|
+
{/* Drag handle */}
|
|
564
|
+
<button
|
|
565
|
+
className="cursor-grab active:cursor-grabbing mt-2"
|
|
566
|
+
{...attributes}
|
|
567
|
+
{...listeners}
|
|
568
|
+
>
|
|
569
|
+
<GripVertical className="h-5 w-5 text-muted-foreground" />
|
|
570
|
+
</button>
|
|
571
|
+
|
|
572
|
+
{/* Card content */}
|
|
573
|
+
<div className="flex-1">
|
|
574
|
+
<ThingCard thing={thing} showActions={false} />
|
|
575
|
+
</div>
|
|
576
|
+
</div>
|
|
577
|
+
</Card>
|
|
578
|
+
</div>
|
|
579
|
+
)
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
---
|
|
584
|
+
|
|
585
|
+
## Loading States
|
|
586
|
+
|
|
587
|
+
### Skeleton Card
|
|
588
|
+
|
|
589
|
+
```tsx
|
|
590
|
+
// frontend/src/components/generic/ThingCard.Skeleton.tsx
|
|
591
|
+
import { Card, CardContent, CardFooter, CardHeader } from '@/components/ui/card'
|
|
592
|
+
import { Skeleton } from '@/components/ui/skeleton'
|
|
593
|
+
|
|
594
|
+
export function ThingCardSkeleton() {
|
|
595
|
+
return (
|
|
596
|
+
<Card>
|
|
597
|
+
<CardHeader className="space-y-0 pb-3">
|
|
598
|
+
<Skeleton className="h-48 w-full rounded-md" />
|
|
599
|
+
<Skeleton className="h-6 w-3/4" />
|
|
600
|
+
</CardHeader>
|
|
601
|
+
|
|
602
|
+
<CardContent className="space-y-2">
|
|
603
|
+
<Skeleton className="h-4 w-full" />
|
|
604
|
+
<Skeleton className="h-4 w-full" />
|
|
605
|
+
<Skeleton className="h-4 w-2/3" />
|
|
606
|
+
</CardContent>
|
|
607
|
+
|
|
608
|
+
<CardFooter>
|
|
609
|
+
<Skeleton className="h-10 w-full" />
|
|
610
|
+
</CardFooter>
|
|
611
|
+
</Card>
|
|
612
|
+
)
|
|
613
|
+
}
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
### Usage with Loading
|
|
617
|
+
|
|
618
|
+
```tsx
|
|
619
|
+
export function ThingsPage() {
|
|
620
|
+
const { things, loading } = useThings()
|
|
621
|
+
|
|
622
|
+
if (loading) {
|
|
623
|
+
return (
|
|
624
|
+
<div className="grid grid-cols-3 gap-6">
|
|
625
|
+
{Array.from({ length: 6 }).map((_, i) => (
|
|
626
|
+
<ThingCardSkeleton key={i} />
|
|
627
|
+
))}
|
|
628
|
+
</div>
|
|
629
|
+
)
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
return (
|
|
633
|
+
<ThingGrid things={things} />
|
|
634
|
+
)
|
|
635
|
+
}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
---
|
|
639
|
+
|
|
640
|
+
## Error States
|
|
641
|
+
|
|
642
|
+
```tsx
|
|
643
|
+
// frontend/src/components/generic/ThingCard.Error.tsx
|
|
644
|
+
import { Card, CardContent } from '@/components/ui/card'
|
|
645
|
+
import { AlertCircle } from 'lucide-react'
|
|
646
|
+
import { Button } from '@/components/ui/button'
|
|
647
|
+
|
|
648
|
+
interface ThingCardErrorProps {
|
|
649
|
+
error: Error
|
|
650
|
+
onRetry?: () => void
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
export function ThingCardError({ error, onRetry }: ThingCardErrorProps) {
|
|
654
|
+
return (
|
|
655
|
+
<Card className="border-destructive">
|
|
656
|
+
<CardContent className="flex flex-col items-center justify-center py-12">
|
|
657
|
+
<AlertCircle className="h-12 w-12 text-destructive mb-4" />
|
|
658
|
+
<p className="text-sm text-muted-foreground text-center mb-4">
|
|
659
|
+
{error.message}
|
|
660
|
+
</p>
|
|
661
|
+
{onRetry && (
|
|
662
|
+
<Button variant="outline" onClick={onRetry}>
|
|
663
|
+
Try Again
|
|
664
|
+
</Button>
|
|
665
|
+
)}
|
|
666
|
+
</CardContent>
|
|
667
|
+
</Card>
|
|
668
|
+
)
|
|
669
|
+
}
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
---
|
|
673
|
+
|
|
674
|
+
## Real-World Examples
|
|
675
|
+
|
|
676
|
+
### E-commerce Product Grid
|
|
677
|
+
|
|
678
|
+
```tsx
|
|
679
|
+
// frontend/src/pages/products.tsx
|
|
680
|
+
import { ThingGrid } from '@/components/generic/ThingGrid'
|
|
681
|
+
import { ThingCardSkeleton } from '@/components/generic/ThingCard.Skeleton'
|
|
682
|
+
import { EmptyState } from '@/components/generic/EmptyState'
|
|
683
|
+
import { Input } from '@/components/ui/input'
|
|
684
|
+
import { Button } from '@/components/ui/button'
|
|
685
|
+
import { Filter } from 'lucide-react'
|
|
686
|
+
|
|
687
|
+
export function ProductsPage() {
|
|
688
|
+
const { products, loading, error } = useProducts()
|
|
689
|
+
const config = useThingConfig('product')
|
|
690
|
+
|
|
691
|
+
if (loading) {
|
|
692
|
+
return (
|
|
693
|
+
<div className="container mx-auto py-8">
|
|
694
|
+
<div className="grid grid-cols-4 gap-6">
|
|
695
|
+
{Array.from({ length: 8 }).map((_, i) => (
|
|
696
|
+
<ThingCardSkeleton key={i} />
|
|
697
|
+
))}
|
|
698
|
+
</div>
|
|
699
|
+
</div>
|
|
700
|
+
)
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
if (error) {
|
|
704
|
+
return <ThingCardError error={error} />
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (products.length === 0) {
|
|
708
|
+
return <EmptyState config={config.ui.empty} />
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
return (
|
|
712
|
+
<div className="container mx-auto py-8">
|
|
713
|
+
{/* Header */}
|
|
714
|
+
<div className="flex items-center justify-between mb-8">
|
|
715
|
+
<h1 className="text-3xl font-bold">Products</h1>
|
|
716
|
+
<div className="flex items-center gap-4">
|
|
717
|
+
<Input
|
|
718
|
+
placeholder="Search products..."
|
|
719
|
+
className="w-64"
|
|
720
|
+
/>
|
|
721
|
+
<Button variant="outline" size="icon">
|
|
722
|
+
<Filter className="h-4 w-4" />
|
|
723
|
+
</Button>
|
|
724
|
+
</div>
|
|
725
|
+
</div>
|
|
726
|
+
|
|
727
|
+
{/* Grid */}
|
|
728
|
+
<ThingGrid things={products} columns={4} />
|
|
729
|
+
</div>
|
|
730
|
+
)
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
### Course Catalog with Filters
|
|
735
|
+
|
|
736
|
+
```tsx
|
|
737
|
+
// frontend/src/pages/courses.tsx
|
|
738
|
+
import { ThingGrid } from '@/components/generic/ThingGrid'
|
|
739
|
+
import { Badge } from '@/components/ui/badge'
|
|
740
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
|
|
741
|
+
|
|
742
|
+
export function CoursesPage() {
|
|
743
|
+
const { courses } = useCourses()
|
|
744
|
+
const [level, setLevel] = useState('all')
|
|
745
|
+
|
|
746
|
+
const filtered = level === 'all'
|
|
747
|
+
? courses
|
|
748
|
+
: courses.filter(c => c.properties.level === level)
|
|
749
|
+
|
|
750
|
+
return (
|
|
751
|
+
<div className="container mx-auto py-8">
|
|
752
|
+
<h1 className="text-3xl font-bold mb-2">Courses</h1>
|
|
753
|
+
<p className="text-muted-foreground mb-8">
|
|
754
|
+
Browse our collection of courses
|
|
755
|
+
</p>
|
|
756
|
+
|
|
757
|
+
{/* Level filter */}
|
|
758
|
+
<Tabs value={level} onValueChange={setLevel} className="mb-8">
|
|
759
|
+
<TabsList>
|
|
760
|
+
<TabsTrigger value="all">All Levels</TabsTrigger>
|
|
761
|
+
<TabsTrigger value="beginner">Beginner</TabsTrigger>
|
|
762
|
+
<TabsTrigger value="intermediate">Intermediate</TabsTrigger>
|
|
763
|
+
<TabsTrigger value="advanced">Advanced</TabsTrigger>
|
|
764
|
+
</TabsList>
|
|
765
|
+
</Tabs>
|
|
766
|
+
|
|
767
|
+
{/* Course grid */}
|
|
768
|
+
<ThingGrid things={filtered} columns={3} />
|
|
769
|
+
</div>
|
|
770
|
+
)
|
|
771
|
+
}
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
### Blog with Featured Posts
|
|
775
|
+
|
|
776
|
+
```tsx
|
|
777
|
+
// frontend/src/pages/blog.tsx
|
|
778
|
+
import { ThingCard } from '@/components/generic/ThingCard'
|
|
779
|
+
import { ThingCardFeatured } from '@/components/generic/ThingCard.Featured'
|
|
780
|
+
import { ThingList } from '@/components/generic/ThingList'
|
|
781
|
+
|
|
782
|
+
export function BlogPage() {
|
|
783
|
+
const { posts } = usePosts()
|
|
784
|
+
|
|
785
|
+
const featured = posts.filter(p => p.properties.featured)
|
|
786
|
+
const regular = posts.filter(p => !p.properties.featured)
|
|
787
|
+
|
|
788
|
+
return (
|
|
789
|
+
<div className="container mx-auto py-8">
|
|
790
|
+
{/* Featured posts */}
|
|
791
|
+
{featured.length > 0 && (
|
|
792
|
+
<section className="mb-12">
|
|
793
|
+
<h2 className="text-2xl font-bold mb-6">Featured</h2>
|
|
794
|
+
<div className="grid grid-cols-2 gap-8">
|
|
795
|
+
{featured.map(post => (
|
|
796
|
+
<ThingCardFeatured key={post._id} thing={post} />
|
|
797
|
+
))}
|
|
798
|
+
</div>
|
|
799
|
+
</section>
|
|
800
|
+
)}
|
|
801
|
+
|
|
802
|
+
{/* Recent posts */}
|
|
803
|
+
<section>
|
|
804
|
+
<h2 className="text-2xl font-bold mb-6">Recent Posts</h2>
|
|
805
|
+
<ThingList things={regular} />
|
|
806
|
+
</section>
|
|
807
|
+
</div>
|
|
808
|
+
)
|
|
809
|
+
}
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
## Performance Tips
|
|
815
|
+
|
|
816
|
+
### Virtualized Grid
|
|
817
|
+
|
|
818
|
+
```tsx
|
|
819
|
+
// For large lists, use virtualization
|
|
820
|
+
import { useVirtualizer } from '@tanstack/react-virtual'
|
|
821
|
+
|
|
822
|
+
export function VirtualizedThingGrid({ things }: { things: Thing[] }) {
|
|
823
|
+
const parentRef = useRef<HTMLDivElement>(null)
|
|
824
|
+
|
|
825
|
+
const rowVirtualizer = useVirtualizer({
|
|
826
|
+
count: Math.ceil(things.length / 3),
|
|
827
|
+
getScrollElement: () => parentRef.current,
|
|
828
|
+
estimateSize: () => 400,
|
|
829
|
+
overscan: 5
|
|
830
|
+
})
|
|
831
|
+
|
|
832
|
+
return (
|
|
833
|
+
<div ref={parentRef} className="h-screen overflow-auto">
|
|
834
|
+
<div
|
|
835
|
+
style={{
|
|
836
|
+
height: `${rowVirtualizer.getTotalSize()}px`,
|
|
837
|
+
width: '100%',
|
|
838
|
+
position: 'relative'
|
|
839
|
+
}}
|
|
840
|
+
>
|
|
841
|
+
{rowVirtualizer.getVirtualItems().map(virtualRow => {
|
|
842
|
+
const startIndex = virtualRow.index * 3
|
|
843
|
+
const rowThings = things.slice(startIndex, startIndex + 3)
|
|
844
|
+
|
|
845
|
+
return (
|
|
846
|
+
<div
|
|
847
|
+
key={virtualRow.index}
|
|
848
|
+
style={{
|
|
849
|
+
position: 'absolute',
|
|
850
|
+
top: 0,
|
|
851
|
+
left: 0,
|
|
852
|
+
width: '100%',
|
|
853
|
+
height: `${virtualRow.size}px`,
|
|
854
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
855
|
+
}}
|
|
856
|
+
>
|
|
857
|
+
<div className="grid grid-cols-3 gap-6 p-6">
|
|
858
|
+
{rowThings.map(thing => (
|
|
859
|
+
<ThingCard key={thing._id} thing={thing} />
|
|
860
|
+
))}
|
|
861
|
+
</div>
|
|
862
|
+
</div>
|
|
863
|
+
)
|
|
864
|
+
})}
|
|
865
|
+
</div>
|
|
866
|
+
</div>
|
|
867
|
+
)
|
|
868
|
+
}
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
### Memoization
|
|
872
|
+
|
|
873
|
+
```tsx
|
|
874
|
+
import { memo } from 'react'
|
|
875
|
+
|
|
876
|
+
export const ThingCard = memo(function ThingCard({ thing }: ThingCardProps) {
|
|
877
|
+
// ... implementation
|
|
878
|
+
}, (prevProps, nextProps) => {
|
|
879
|
+
// Custom comparison
|
|
880
|
+
return prevProps.thing._id === nextProps.thing._id &&
|
|
881
|
+
prevProps.thing.updatedAt === nextProps.thing.updatedAt
|
|
882
|
+
})
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
---
|
|
886
|
+
|
|
887
|
+
## Testing
|
|
888
|
+
|
|
889
|
+
```tsx
|
|
890
|
+
// frontend/src/components/generic/__tests__/ThingCard.test.tsx
|
|
891
|
+
import { render, screen } from '@testing-library/react'
|
|
892
|
+
import { ThingCard } from '../ThingCard'
|
|
893
|
+
|
|
894
|
+
describe('ThingCard', () => {
|
|
895
|
+
it('renders course card correctly', () => {
|
|
896
|
+
const course = {
|
|
897
|
+
_id: '1',
|
|
898
|
+
type: 'course',
|
|
899
|
+
name: 'Test Course',
|
|
900
|
+
properties: {
|
|
901
|
+
title: 'Test Course',
|
|
902
|
+
description: 'A test course',
|
|
903
|
+
price: 99,
|
|
904
|
+
level: 'beginner'
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
render(<ThingCard thing={course} />)
|
|
909
|
+
|
|
910
|
+
expect(screen.getByText('Test Course')).toBeInTheDocument()
|
|
911
|
+
expect(screen.getByText('A test course')).toBeInTheDocument()
|
|
912
|
+
expect(screen.getByText('$99')).toBeInTheDocument()
|
|
913
|
+
})
|
|
914
|
+
|
|
915
|
+
it('handles click events', () => {
|
|
916
|
+
const onClick = vi.fn()
|
|
917
|
+
const thing = { /* ... */ }
|
|
918
|
+
|
|
919
|
+
render(<ThingCard thing={thing} onClick={onClick} />)
|
|
920
|
+
|
|
921
|
+
fireEvent.click(screen.getByRole('article'))
|
|
922
|
+
expect(onClick).toHaveBeenCalledWith(thing)
|
|
923
|
+
})
|
|
924
|
+
})
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
---
|
|
928
|
+
|
|
929
|
+
**With shadcn/ui, ThingCard provides beautiful, accessible UI for all 66 thing types automatically.**
|