oneie 3.6.7 → 3.6.12
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/.claude/agents/agent-backend.md +83 -0
- package/.claude/agents/agent-designer.md +97 -0
- package/.claude/agents/agent-director.md +118 -7
- package/.claude/agents/agent-documenter.md +93 -0
- package/.claude/agents/agent-frontend.md +96 -0
- package/.claude/agents/agent-ops.md +264 -32
- package/.claude/agents/agent-problem-solver.md +166 -0
- package/.claude/agents/agent-quality.md +127 -0
- package/.claude/commands/build.md +293 -0
- package/.claude/commands/cascade.md +231 -127
- package/.claude/commands/deploy.md +56 -17
- package/.claude/commands/mcp-toggle.md +93 -0
- package/.claude/commands/one.md +78 -127
- package/.claude/commands/plan.md +394 -80
- package/.claude/commands/push.md +75 -14
- package/.claude/commands/release.md +89 -25
- package/.claude/commands/server.md +2 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/root-cleanup.py +75 -0
- package/.claude/skills/INDEX.md +523 -0
- package/.claude/skills/REGISTRY.md +529 -0
- package/.claude/skills/agent-backend-create-mutation.md +319 -0
- package/.claude/skills/agent-designer-create-wireframe.md +341 -0
- package/.claude/skills/agent-frontend-create-page.md +413 -0
- package/.claude/skills/agents/README.md +238 -0
- package/dist/clone-web.js +1 -1
- package/dist/clone-web.js.map +1 -1
- package/folders.yaml +1 -1
- package/one/.obsidian/workspace.json +38 -38
- package/one/connections/api/queries-reference.md +842 -0
- package/one/connections/api-reference.md +1011 -0
- package/one/connections/integration-examples.md +875 -0
- package/one/connections/integration-guide.md +869 -0
- package/one/connections/integration-phase2.md +736 -0
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
- package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
- package/one/events/CONNECTIONS_DEMO.md +501 -0
- package/one/events/DELIVERABLES.md +432 -0
- package/one/events/DEMO-GROUPS-PAGE.md +392 -0
- package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
- package/one/events/DEMO_COMPONENTS.md +487 -0
- package/one/events/DEMO_HOOKS_INDEX.md +334 -0
- package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
- package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
- package/one/events/DEMO_SETUP.md +476 -0
- package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
- package/one/events/HOOKS-DEMO.md +441 -0
- package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
- package/one/events/QA-CHECKLIST.md +674 -0
- package/one/events/QUICK-START-ONTOLOGY.md +408 -0
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
- package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
- package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
- package/one/events/TEST-PLAN-INDEX.md +346 -0
- package/one/events/TEST-PLAN.md +1417 -0
- package/one/events/TESTING-DELIVERY.txt +372 -0
- package/one/events/TRANSITIONS-QUICK-START.md +141 -0
- package/one/events/TYPESCRIPT_FIXES.md +152 -0
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
- package/one/events/VIEW-TRANSITIONS.md +428 -0
- package/one/events/backend-integration-tests.md +606 -0
- package/one/events/backend-structure-diagram.txt +393 -0
- package/one/events/backend-structure-summary.txt +269 -0
- package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
- package/one/events/convex-analysis-index.md +304 -0
- package/one/events/convex-structure-analysis.md +700 -0
- package/one/events/design-spec-complete.md +208 -0
- package/one/events/ontology-test-examples.md +562 -0
- package/one/events/phase1-backend-implementation-complete.md +518 -0
- package/one/events/test-dashboard.md +345 -0
- package/one/events/test-index.md +361 -0
- package/one/events/test-report-ontology.md +582 -0
- package/one/events/testing-summary.md +344 -0
- package/one/groups/features.md +2878 -0
- package/one/groups/strategy copy.md +869 -0
- package/one/knowledge/backend-api-reference.md +710 -0
- package/one/knowledge/documentation-summary.md +285 -0
- package/one/knowledge/lessons-learned.md +294 -4
- package/one/knowledge/ontology-visual-guide.md +360 -0
- package/one/knowledge/ontology.md +9 -17
- package/one/things/demo-accessibility-animations.md +999 -0
- package/one/things/demo-components.md +1304 -0
- package/one/things/demo-design-summary.md +629 -0
- package/one/things/demo-design-system.md +919 -0
- package/one/things/demo-page-layouts.md +989 -0
- package/one/things/designs/accessibility-audit.md +790 -0
- package/one/things/designs/component-specifications.md +757 -0
- package/one/things/designs/design-overview.md +318 -0
- package/one/things/designs/design-tokens.md +414 -0
- package/one/things/designs/wireframes-dashboard.md +653 -0
- package/one/things/docs/api-requests.md +923 -0
- package/one/things/features/0 All Features.md +2 -0
- package/one/things/implementation/backend-guide.md +412 -0
- package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
- package/one/things/plans/2-sites.md +895 -0
- package/one/things/plans/ai-elements.md +1259 -0
- package/one/things/plans/ai-integration.md +947 -0
- package/one/things/plans/ai-sdk.md +761 -0
- package/one/things/plans/app.md +1 -1
- package/one/things/plans/architecture-summary.md +283 -0
- package/one/things/plans/async-ai-agents.md +215 -0
- package/one/things/plans/backend-agnostic-frontend.md +11 -6
- package/one/things/plans/backend-cleanup-quickstart.md +346 -0
- package/one/things/plans/backend-ontology-conformance.md +416 -0
- package/one/things/plans/backend-status.md +541 -0
- package/one/things/plans/backend-structure.md +799 -0
- package/one/things/plans/backend-target-structure.md +438 -0
- package/one/things/plans/backend.md +1133 -0
- package/one/things/plans/better-auth-any-backend.md +11 -11
- package/one/things/plans/cli-updates-required.md +280 -0
- package/one/things/plans/complete-step-by-step.md +1302 -0
- package/one/things/plans/convex-agents.md +1005 -0
- package/one/things/plans/deployment-architecture.md +426 -0
- package/one/things/plans/development-plan.md +1220 -0
- package/one/things/plans/effect.md +808 -48
- package/one/things/plans/integrate-frontend-and-backend.md +579 -0
- package/one/things/plans/mcp-clear-context-prompt.md +60 -0
- package/one/things/plans/mcp-simple.md +228 -0
- package/one/things/plans/one.md +8 -7
- package/one/things/plans/ontology-6-dimensions.md +20 -14
- package/one/things/plans/quick-wins.md +1273 -0
- package/one/things/plans/readme-backend-cleanup.md +361 -0
- package/one/things/plans/separate-demo.md +830 -0
- package/one/things/plans/separate.md +3 -3
- package/one/things/plans/sequence.md +1897 -0
- package/one/things/plans/sync-checklist.md +321 -0
- package/one/things/plans/unified-implementation-plan.md +3 -3
- package/one/things/plans/update-demos.md +513 -0
- package/package.json +1 -1
- package/.claude/agents/backend-specialist.md +0 -169
- package/.claude/agents/designer.md +0 -216
- package/.claude/agents/frontend-specialist.md +0 -236
- package/.claude/commands/done.md +0 -35
- package/.claude/commands/infer.md +0 -138
- package/.claude/commands/next.md +0 -53
- package/.claude/commands/one copy.md +0 -565
- package/.claude/commands/one-template.md +0 -106
- package/.claude/commands/one-v1.md +0 -609
- package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
- package/one/groups/nine-padel-customers.md +0 -138
- package/one/groups/nine-padel-data-structure.md +0 -167
- package/one/groups/nine-padel-ontology-specification.md +0 -359
- package/one/groups/nine-padel-ontology.md +0 -143
- package/one/groups/nine-padel-strategy.md +0 -234
- package/one/groups/nine-padel.md +0 -211
- package/one/groups/nine-padle-contents.baked.md +0 -1252
- package/one/groups/nine-padle-contents.md +0 -6
- package/one/things/features/1-1-agent-prompts/design.md +0 -470
- package/one/things/features/1-1-agent-prompts/tests.md +0 -264
- package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
- package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
- package/one/things/features/1-3-event-coordination/design.md +0 -544
- package/one/things/features/1-3-event-coordination/tests.md +0 -223
- package/one/things/features/1-4-knowledge-management/design.md +0 -609
- package/one/things/features/1-4-knowledge-management/tests.md +0 -195
- package/one/things/features/1-5-quality-loops/design.md +0 -797
- package/one/things/features/1-5-quality-loops/tests.md +0 -212
- package/one/things/features/1-6-numbering-structure/design.md +0 -610
- package/one/things/features/1-6-numbering-structure/tests.md +0 -213
- package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
|
@@ -0,0 +1,757 @@
|
|
|
1
|
+
# Component Specifications - ONE Platform
|
|
2
|
+
|
|
3
|
+
**Version:** 1.0.0
|
|
4
|
+
**Created:** 2025-10-25
|
|
5
|
+
**Status:** Test-Driven Component Design
|
|
6
|
+
**Purpose:** Enable frontend implementation that passes backend tests
|
|
7
|
+
|
|
8
|
+
## Component Architecture
|
|
9
|
+
|
|
10
|
+
### Component Hierarchy
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Pages (Astro .astro files)
|
|
14
|
+
├── features/ (Feature-specific components)
|
|
15
|
+
│ ├── groups/
|
|
16
|
+
│ │ ├── GroupCard.tsx
|
|
17
|
+
│ │ ├── GroupList.tsx
|
|
18
|
+
│ │ ├── GroupHierarchy.tsx
|
|
19
|
+
│ │ ├── GroupDialog.tsx
|
|
20
|
+
│ │ └── GroupSelector.tsx
|
|
21
|
+
│ ├── things/
|
|
22
|
+
│ │ ├── ThingCard.tsx
|
|
23
|
+
│ │ ├── ThingList.tsx
|
|
24
|
+
│ │ ├── ThingFilter.tsx
|
|
25
|
+
│ │ ├── ThingDialog.tsx
|
|
26
|
+
│ │ └── ThingDetails.tsx
|
|
27
|
+
│ ├── connections/
|
|
28
|
+
│ │ ├── ConnectionGraph.tsx
|
|
29
|
+
│ │ ├── ConnectionList.tsx
|
|
30
|
+
│ │ └── ConnectionCard.tsx
|
|
31
|
+
│ ├── events/
|
|
32
|
+
│ │ ├── EventTimeline.tsx
|
|
33
|
+
│ │ └── EventCard.tsx
|
|
34
|
+
│ └── knowledge/
|
|
35
|
+
│ ├── KnowledgeSearch.tsx
|
|
36
|
+
│ └── KnowledgeCard.tsx
|
|
37
|
+
└── ui/ (shadcn/ui base components)
|
|
38
|
+
├── button.tsx
|
|
39
|
+
├── card.tsx
|
|
40
|
+
├── dialog.tsx
|
|
41
|
+
├── input.tsx
|
|
42
|
+
├── select.tsx
|
|
43
|
+
└── ... (50+ components)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 1. GroupCard
|
|
47
|
+
|
|
48
|
+
**Purpose:** Display a single group with metadata
|
|
49
|
+
|
|
50
|
+
**Props:**
|
|
51
|
+
```typescript
|
|
52
|
+
interface GroupCardProps {
|
|
53
|
+
group: {
|
|
54
|
+
_id: string;
|
|
55
|
+
slug: string;
|
|
56
|
+
name: string;
|
|
57
|
+
type: 'friend_circle' | 'business' | 'community' | 'dao' | 'government' | 'organization';
|
|
58
|
+
parentGroupId?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
status: 'active' | 'archived';
|
|
61
|
+
settings: {
|
|
62
|
+
visibility: 'public' | 'private';
|
|
63
|
+
plan?: 'starter' | 'pro' | 'enterprise';
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
onEdit?: (group: GroupCardProps['group']) => void;
|
|
67
|
+
onDelete?: (groupId: string) => void;
|
|
68
|
+
showHierarchy?: boolean;
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Component Structure:**
|
|
73
|
+
```tsx
|
|
74
|
+
export function GroupCard({ group, onEdit, onDelete, showHierarchy }: GroupCardProps) {
|
|
75
|
+
return (
|
|
76
|
+
<Card className="p-4">
|
|
77
|
+
<CardHeader>
|
|
78
|
+
{showHierarchy && <HierarchyIndicator parentGroupId={group.parentGroupId} />}
|
|
79
|
+
<CardTitle>{group.name}</CardTitle>
|
|
80
|
+
<Badge variant={group.status === 'active' ? 'default' : 'secondary'}>
|
|
81
|
+
{group.status}
|
|
82
|
+
</Badge>
|
|
83
|
+
</CardHeader>
|
|
84
|
+
<CardContent>
|
|
85
|
+
<p className="text-sm text-muted-foreground">{group.description}</p>
|
|
86
|
+
<div className="flex gap-2 mt-2">
|
|
87
|
+
<Badge variant="outline">{group.type}</Badge>
|
|
88
|
+
<Badge variant="outline">{group.settings.visibility}</Badge>
|
|
89
|
+
{group.settings.plan && (
|
|
90
|
+
<Badge variant="outline">{group.settings.plan}</Badge>
|
|
91
|
+
)}
|
|
92
|
+
</div>
|
|
93
|
+
</CardContent>
|
|
94
|
+
<CardFooter className="flex gap-2">
|
|
95
|
+
{onEdit && (
|
|
96
|
+
<Button variant="outline" size="sm" onClick={() => onEdit(group)}>
|
|
97
|
+
Edit
|
|
98
|
+
</Button>
|
|
99
|
+
)}
|
|
100
|
+
{onDelete && (
|
|
101
|
+
<Button variant="destructive" size="sm" onClick={() => onDelete(group._id)}>
|
|
102
|
+
Archive
|
|
103
|
+
</Button>
|
|
104
|
+
)}
|
|
105
|
+
</CardFooter>
|
|
106
|
+
</Card>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Accessibility:**
|
|
112
|
+
- Card has `role="article"`
|
|
113
|
+
- Buttons have clear labels
|
|
114
|
+
- Status badge has `aria-label`
|
|
115
|
+
|
|
116
|
+
**States:**
|
|
117
|
+
- Default: Normal display
|
|
118
|
+
- Hover: Slight elevation
|
|
119
|
+
- Focus: Ring outline
|
|
120
|
+
- Loading: Skeleton content
|
|
121
|
+
|
|
122
|
+
## 2. GroupHierarchy
|
|
123
|
+
|
|
124
|
+
**Purpose:** Display hierarchical group structure with tree view
|
|
125
|
+
|
|
126
|
+
**Props:**
|
|
127
|
+
```typescript
|
|
128
|
+
interface GroupHierarchyProps {
|
|
129
|
+
groups: Array<GroupCardProps['group']>;
|
|
130
|
+
onSelect?: (groupId: string) => void;
|
|
131
|
+
selectedGroupId?: string;
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Component Structure:**
|
|
136
|
+
```tsx
|
|
137
|
+
export function GroupHierarchy({ groups, onSelect, selectedGroupId }: GroupHierarchyProps) {
|
|
138
|
+
const groupTree = buildTree(groups); // Helper to create tree structure
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div className="space-y-2">
|
|
142
|
+
{groupTree.map((group) => (
|
|
143
|
+
<GroupTreeNode
|
|
144
|
+
key={group._id}
|
|
145
|
+
group={group}
|
|
146
|
+
level={0}
|
|
147
|
+
onSelect={onSelect}
|
|
148
|
+
isSelected={selectedGroupId === group._id}
|
|
149
|
+
/>
|
|
150
|
+
))}
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function GroupTreeNode({ group, level, onSelect, isSelected }) {
|
|
156
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<div style={{ paddingLeft: `${level * 24}px` }}>
|
|
160
|
+
<button
|
|
161
|
+
onClick={() => onSelect?.(group._id)}
|
|
162
|
+
className={cn(
|
|
163
|
+
"flex items-center gap-2 w-full p-2 rounded hover:bg-accent",
|
|
164
|
+
isSelected && "bg-accent"
|
|
165
|
+
)}
|
|
166
|
+
>
|
|
167
|
+
{group.children?.length > 0 && (
|
|
168
|
+
<ChevronRight
|
|
169
|
+
className={cn("transition-transform", isExpanded && "rotate-90")}
|
|
170
|
+
onClick={(e) => {
|
|
171
|
+
e.stopPropagation();
|
|
172
|
+
setIsExpanded(!isExpanded);
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
)}
|
|
176
|
+
<span>{group.name}</span>
|
|
177
|
+
</button>
|
|
178
|
+
{isExpanded && group.children?.map((child) => (
|
|
179
|
+
<GroupTreeNode
|
|
180
|
+
key={child._id}
|
|
181
|
+
group={child}
|
|
182
|
+
level={level + 1}
|
|
183
|
+
onSelect={onSelect}
|
|
184
|
+
isSelected={selectedGroupId === child._id}
|
|
185
|
+
/>
|
|
186
|
+
))}
|
|
187
|
+
</div>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Accessibility:**
|
|
193
|
+
- Tree structure with `role="tree"`
|
|
194
|
+
- Nodes have `role="treeitem"`
|
|
195
|
+
- Arrow keys for navigation
|
|
196
|
+
- Expand/collapse with Enter/Space
|
|
197
|
+
|
|
198
|
+
## 3. GroupDialog
|
|
199
|
+
|
|
200
|
+
**Purpose:** Create or edit group with full form
|
|
201
|
+
|
|
202
|
+
**Props:**
|
|
203
|
+
```typescript
|
|
204
|
+
interface GroupDialogProps {
|
|
205
|
+
mode: 'create' | 'edit';
|
|
206
|
+
group?: GroupCardProps['group'];
|
|
207
|
+
onSave: (data: GroupFormData) => Promise<void>;
|
|
208
|
+
onCancel: () => void;
|
|
209
|
+
isOpen: boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface GroupFormData {
|
|
213
|
+
name: string;
|
|
214
|
+
slug: string;
|
|
215
|
+
type: string;
|
|
216
|
+
parentGroupId?: string;
|
|
217
|
+
description?: string;
|
|
218
|
+
settings: {
|
|
219
|
+
visibility: 'public' | 'private';
|
|
220
|
+
joinPolicy: 'open' | 'invite_only' | 'approval_required';
|
|
221
|
+
plan?: 'starter' | 'pro' | 'enterprise';
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Component Structure:**
|
|
227
|
+
```tsx
|
|
228
|
+
export function GroupDialog({ mode, group, onSave, onCancel, isOpen }: GroupDialogProps) {
|
|
229
|
+
const [formData, setFormData] = useState<GroupFormData>(
|
|
230
|
+
group || getDefaultFormData()
|
|
231
|
+
);
|
|
232
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
233
|
+
const [errors, setErrors] = useState<Record<string, string>>({});
|
|
234
|
+
|
|
235
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
236
|
+
e.preventDefault();
|
|
237
|
+
const validationErrors = validateForm(formData);
|
|
238
|
+
if (Object.keys(validationErrors).length > 0) {
|
|
239
|
+
setErrors(validationErrors);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
setIsLoading(true);
|
|
244
|
+
try {
|
|
245
|
+
await onSave(formData);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
setErrors({ form: error.message });
|
|
248
|
+
} finally {
|
|
249
|
+
setIsLoading(false);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
<Dialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>
|
|
255
|
+
<DialogContent className="sm:max-w-[600px]">
|
|
256
|
+
<DialogHeader>
|
|
257
|
+
<DialogTitle>
|
|
258
|
+
{mode === 'create' ? 'Create Group' : 'Edit Group'}
|
|
259
|
+
</DialogTitle>
|
|
260
|
+
</DialogHeader>
|
|
261
|
+
<form onSubmit={handleSubmit} className="space-y-4">
|
|
262
|
+
{/* Name Field */}
|
|
263
|
+
<div className="space-y-2">
|
|
264
|
+
<Label htmlFor="name">Name *</Label>
|
|
265
|
+
<Input
|
|
266
|
+
id="name"
|
|
267
|
+
value={formData.name}
|
|
268
|
+
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
|
269
|
+
placeholder="Acme Corporation"
|
|
270
|
+
required
|
|
271
|
+
aria-invalid={!!errors.name}
|
|
272
|
+
aria-describedby={errors.name ? "name-error" : undefined}
|
|
273
|
+
/>
|
|
274
|
+
{errors.name && (
|
|
275
|
+
<p id="name-error" className="text-sm text-destructive">
|
|
276
|
+
{errors.name}
|
|
277
|
+
</p>
|
|
278
|
+
)}
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
{/* Slug Field */}
|
|
282
|
+
<div className="space-y-2">
|
|
283
|
+
<Label htmlFor="slug">Slug * (URL identifier)</Label>
|
|
284
|
+
<Input
|
|
285
|
+
id="slug"
|
|
286
|
+
value={formData.slug}
|
|
287
|
+
onChange={(e) => setFormData({ ...formData, slug: e.target.value })}
|
|
288
|
+
placeholder="acme-corp"
|
|
289
|
+
required
|
|
290
|
+
pattern="[a-z0-9-]+"
|
|
291
|
+
aria-invalid={!!errors.slug}
|
|
292
|
+
aria-describedby="slug-preview"
|
|
293
|
+
/>
|
|
294
|
+
<p id="slug-preview" className="text-xs text-muted-foreground">
|
|
295
|
+
one.ie/groups/{formData.slug || '...'}
|
|
296
|
+
</p>
|
|
297
|
+
{errors.slug && (
|
|
298
|
+
<p className="text-sm text-destructive">{errors.slug}</p>
|
|
299
|
+
)}
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
{/* Type Selector */}
|
|
303
|
+
<div className="space-y-2">
|
|
304
|
+
<Label htmlFor="type">Type *</Label>
|
|
305
|
+
<Select
|
|
306
|
+
value={formData.type}
|
|
307
|
+
onValueChange={(value) => setFormData({ ...formData, type: value })}
|
|
308
|
+
>
|
|
309
|
+
<SelectTrigger id="type">
|
|
310
|
+
<SelectValue />
|
|
311
|
+
</SelectTrigger>
|
|
312
|
+
<SelectContent>
|
|
313
|
+
<SelectItem value="friend_circle">Friend Circle</SelectItem>
|
|
314
|
+
<SelectItem value="business">Business</SelectItem>
|
|
315
|
+
<SelectItem value="community">Community</SelectItem>
|
|
316
|
+
<SelectItem value="dao">DAO</SelectItem>
|
|
317
|
+
<SelectItem value="government">Government</SelectItem>
|
|
318
|
+
<SelectItem value="organization">Organization</SelectItem>
|
|
319
|
+
</SelectContent>
|
|
320
|
+
</Select>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
{/* Parent Group (Optional) */}
|
|
324
|
+
<div className="space-y-2">
|
|
325
|
+
<Label htmlFor="parentGroupId">Parent Group (optional)</Label>
|
|
326
|
+
<GroupSelector
|
|
327
|
+
value={formData.parentGroupId}
|
|
328
|
+
onChange={(value) => setFormData({ ...formData, parentGroupId: value })}
|
|
329
|
+
excludeGroupId={group?._id} // Can't be parent of itself
|
|
330
|
+
/>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
{/* Description (Optional) */}
|
|
334
|
+
<div className="space-y-2">
|
|
335
|
+
<Label htmlFor="description">Description (optional)</Label>
|
|
336
|
+
<Textarea
|
|
337
|
+
id="description"
|
|
338
|
+
value={formData.description || ''}
|
|
339
|
+
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
|
|
340
|
+
rows={3}
|
|
341
|
+
/>
|
|
342
|
+
</div>
|
|
343
|
+
|
|
344
|
+
{/* Settings */}
|
|
345
|
+
<div className="space-y-2">
|
|
346
|
+
<Label>Settings</Label>
|
|
347
|
+
<div className="grid grid-cols-2 gap-4">
|
|
348
|
+
<div className="space-y-2">
|
|
349
|
+
<Label htmlFor="visibility">Visibility</Label>
|
|
350
|
+
<Select
|
|
351
|
+
value={formData.settings.visibility}
|
|
352
|
+
onValueChange={(value) =>
|
|
353
|
+
setFormData({
|
|
354
|
+
...formData,
|
|
355
|
+
settings: { ...formData.settings, visibility: value }
|
|
356
|
+
})
|
|
357
|
+
}
|
|
358
|
+
>
|
|
359
|
+
<SelectTrigger id="visibility">
|
|
360
|
+
<SelectValue />
|
|
361
|
+
</SelectTrigger>
|
|
362
|
+
<SelectContent>
|
|
363
|
+
<SelectItem value="public">Public</SelectItem>
|
|
364
|
+
<SelectItem value="private">Private</SelectItem>
|
|
365
|
+
</SelectContent>
|
|
366
|
+
</Select>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<div className="space-y-2">
|
|
370
|
+
<Label htmlFor="joinPolicy">Join Policy</Label>
|
|
371
|
+
<Select
|
|
372
|
+
value={formData.settings.joinPolicy}
|
|
373
|
+
onValueChange={(value) =>
|
|
374
|
+
setFormData({
|
|
375
|
+
...formData,
|
|
376
|
+
settings: { ...formData.settings, joinPolicy: value }
|
|
377
|
+
})
|
|
378
|
+
}
|
|
379
|
+
>
|
|
380
|
+
<SelectTrigger id="joinPolicy">
|
|
381
|
+
<SelectValue />
|
|
382
|
+
</SelectTrigger>
|
|
383
|
+
<SelectContent>
|
|
384
|
+
<SelectItem value="open">Open</SelectItem>
|
|
385
|
+
<SelectItem value="invite_only">Invite Only</SelectItem>
|
|
386
|
+
<SelectItem value="approval_required">Approval Required</SelectItem>
|
|
387
|
+
</SelectContent>
|
|
388
|
+
</Select>
|
|
389
|
+
</div>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
{/* Form Error */}
|
|
394
|
+
{errors.form && (
|
|
395
|
+
<Alert variant="destructive">
|
|
396
|
+
<AlertDescription>{errors.form}</AlertDescription>
|
|
397
|
+
</Alert>
|
|
398
|
+
)}
|
|
399
|
+
|
|
400
|
+
{/* Actions */}
|
|
401
|
+
<DialogFooter>
|
|
402
|
+
<Button type="button" variant="outline" onClick={onCancel} disabled={isLoading}>
|
|
403
|
+
Cancel
|
|
404
|
+
</Button>
|
|
405
|
+
<Button type="submit" disabled={isLoading}>
|
|
406
|
+
{isLoading ? (
|
|
407
|
+
<>
|
|
408
|
+
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
|
409
|
+
{mode === 'create' ? 'Creating...' : 'Saving...'}
|
|
410
|
+
</>
|
|
411
|
+
) : (
|
|
412
|
+
mode === 'create' ? 'Create Group' : 'Save Changes'
|
|
413
|
+
)}
|
|
414
|
+
</Button>
|
|
415
|
+
</DialogFooter>
|
|
416
|
+
</form>
|
|
417
|
+
</DialogContent>
|
|
418
|
+
</Dialog>
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**Validation Rules:**
|
|
424
|
+
```typescript
|
|
425
|
+
function validateForm(data: GroupFormData): Record<string, string> {
|
|
426
|
+
const errors: Record<string, string> = {};
|
|
427
|
+
|
|
428
|
+
if (!data.name || data.name.trim().length === 0) {
|
|
429
|
+
errors.name = 'Name is required';
|
|
430
|
+
}
|
|
431
|
+
if (data.name.length > 100) {
|
|
432
|
+
errors.name = 'Name must be 100 characters or less';
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (!data.slug || data.slug.trim().length === 0) {
|
|
436
|
+
errors.slug = 'Slug is required';
|
|
437
|
+
}
|
|
438
|
+
if (!/^[a-z0-9-]+$/.test(data.slug)) {
|
|
439
|
+
errors.slug = 'Slug must contain only lowercase letters, numbers, and hyphens';
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (!data.type) {
|
|
443
|
+
errors.type = 'Type is required';
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return errors;
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Accessibility:**
|
|
451
|
+
- Form has `aria-labelledby`
|
|
452
|
+
- Fields associated with labels
|
|
453
|
+
- Validation errors announced
|
|
454
|
+
- Focus management (trap in dialog)
|
|
455
|
+
|
|
456
|
+
## 4. ThingCard
|
|
457
|
+
|
|
458
|
+
**Purpose:** Display a single thing with type-specific icon and metadata
|
|
459
|
+
|
|
460
|
+
**Props:**
|
|
461
|
+
```typescript
|
|
462
|
+
interface ThingCardProps {
|
|
463
|
+
thing: {
|
|
464
|
+
_id: string;
|
|
465
|
+
groupId: string;
|
|
466
|
+
type: string; // One of 66 types
|
|
467
|
+
name: string;
|
|
468
|
+
status: 'active' | 'inactive' | 'draft' | 'published' | 'archived';
|
|
469
|
+
properties: Record<string, any>;
|
|
470
|
+
createdAt: number;
|
|
471
|
+
updatedAt: number;
|
|
472
|
+
};
|
|
473
|
+
onEdit?: (thing: ThingCardProps['thing']) => void;
|
|
474
|
+
onDelete?: (thingId: string) => void;
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
**Component Structure:**
|
|
479
|
+
```tsx
|
|
480
|
+
export function ThingCard({ thing, onEdit, onDelete }: ThingCardProps) {
|
|
481
|
+
const Icon = getIconForType(thing.type); // Helper function
|
|
482
|
+
|
|
483
|
+
return (
|
|
484
|
+
<Card className="p-4">
|
|
485
|
+
<CardHeader className="flex flex-row items-center gap-3">
|
|
486
|
+
<Icon className="h-8 w-8 text-primary" />
|
|
487
|
+
<div className="flex-1">
|
|
488
|
+
<CardTitle className="text-base">{thing.name}</CardTitle>
|
|
489
|
+
<p className="text-xs text-muted-foreground">{thing.type}</p>
|
|
490
|
+
</div>
|
|
491
|
+
<Badge variant={getStatusVariant(thing.status)}>
|
|
492
|
+
{thing.status}
|
|
493
|
+
</Badge>
|
|
494
|
+
</CardHeader>
|
|
495
|
+
<CardContent>
|
|
496
|
+
<dl className="text-sm space-y-1">
|
|
497
|
+
<div className="flex justify-between">
|
|
498
|
+
<dt className="text-muted-foreground">Created:</dt>
|
|
499
|
+
<dd>{formatDate(thing.createdAt)}</dd>
|
|
500
|
+
</div>
|
|
501
|
+
<div className="flex justify-between">
|
|
502
|
+
<dt className="text-muted-foreground">Updated:</dt>
|
|
503
|
+
<dd>{formatDate(thing.updatedAt)}</dd>
|
|
504
|
+
</div>
|
|
505
|
+
</dl>
|
|
506
|
+
</CardContent>
|
|
507
|
+
<CardFooter className="flex gap-2">
|
|
508
|
+
{onEdit && (
|
|
509
|
+
<Button variant="outline" size="sm" onClick={() => onEdit(thing)}>
|
|
510
|
+
Edit
|
|
511
|
+
</Button>
|
|
512
|
+
)}
|
|
513
|
+
{onDelete && (
|
|
514
|
+
<Button variant="destructive" size="sm" onClick={() => onDelete(thing._id)}>
|
|
515
|
+
Delete
|
|
516
|
+
</Button>
|
|
517
|
+
)}
|
|
518
|
+
</CardFooter>
|
|
519
|
+
</Card>
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// Helper: Get icon for thing type
|
|
524
|
+
function getIconForType(type: string): React.ComponentType<{ className?: string }> {
|
|
525
|
+
const iconMap: Record<string, React.ComponentType> = {
|
|
526
|
+
creator: User,
|
|
527
|
+
blog_post: FileText,
|
|
528
|
+
video: Video,
|
|
529
|
+
course: BookOpen,
|
|
530
|
+
token: Coins,
|
|
531
|
+
// ... map all 66 types
|
|
532
|
+
};
|
|
533
|
+
return iconMap[type] || HelpCircle;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// Helper: Get badge variant for status
|
|
537
|
+
function getStatusVariant(status: string): 'default' | 'secondary' | 'outline' {
|
|
538
|
+
const variantMap = {
|
|
539
|
+
active: 'default',
|
|
540
|
+
published: 'default',
|
|
541
|
+
draft: 'secondary',
|
|
542
|
+
archived: 'outline',
|
|
543
|
+
inactive: 'outline',
|
|
544
|
+
};
|
|
545
|
+
return variantMap[status] || 'outline';
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
## 5. ThingFilter
|
|
550
|
+
|
|
551
|
+
**Purpose:** Filter things by group, type, status with search
|
|
552
|
+
|
|
553
|
+
**Props:**
|
|
554
|
+
```typescript
|
|
555
|
+
interface ThingFilterProps {
|
|
556
|
+
onFilterChange: (filters: ThingFilters) => void;
|
|
557
|
+
availableGroups: Array<{ _id: string; name: string }>;
|
|
558
|
+
availableTypes: string[];
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
interface ThingFilters {
|
|
562
|
+
groupId?: string;
|
|
563
|
+
type?: string;
|
|
564
|
+
status?: string;
|
|
565
|
+
search?: string;
|
|
566
|
+
}
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
**Component Structure:**
|
|
570
|
+
```tsx
|
|
571
|
+
export function ThingFilter({ onFilterChange, availableGroups, availableTypes }: ThingFilterProps) {
|
|
572
|
+
const [filters, setFilters] = useState<ThingFilters>({});
|
|
573
|
+
const debouncedSearch = useDebounce(filters.search, 300);
|
|
574
|
+
|
|
575
|
+
useEffect(() => {
|
|
576
|
+
onFilterChange({ ...filters, search: debouncedSearch });
|
|
577
|
+
}, [debouncedSearch, filters.groupId, filters.type, filters.status]);
|
|
578
|
+
|
|
579
|
+
return (
|
|
580
|
+
<div className="space-y-4 p-4 border rounded-lg">
|
|
581
|
+
<h3 className="font-semibold">Filters</h3>
|
|
582
|
+
|
|
583
|
+
{/* Group Filter */}
|
|
584
|
+
<div className="space-y-2">
|
|
585
|
+
<Label htmlFor="filter-group">Group</Label>
|
|
586
|
+
<Select
|
|
587
|
+
value={filters.groupId}
|
|
588
|
+
onValueChange={(value) => setFilters({ ...filters, groupId: value })}
|
|
589
|
+
>
|
|
590
|
+
<SelectTrigger id="filter-group">
|
|
591
|
+
<SelectValue placeholder="All Groups" />
|
|
592
|
+
</SelectTrigger>
|
|
593
|
+
<SelectContent>
|
|
594
|
+
<SelectItem value="">All Groups</SelectItem>
|
|
595
|
+
{availableGroups.map((group) => (
|
|
596
|
+
<SelectItem key={group._id} value={group._id}>
|
|
597
|
+
{group.name}
|
|
598
|
+
</SelectItem>
|
|
599
|
+
))}
|
|
600
|
+
</SelectContent>
|
|
601
|
+
</Select>
|
|
602
|
+
</div>
|
|
603
|
+
|
|
604
|
+
{/* Type Filter */}
|
|
605
|
+
<div className="space-y-2">
|
|
606
|
+
<Label htmlFor="filter-type">Type</Label>
|
|
607
|
+
<Select
|
|
608
|
+
value={filters.type}
|
|
609
|
+
onValueChange={(value) => setFilters({ ...filters, type: value })}
|
|
610
|
+
>
|
|
611
|
+
<SelectTrigger id="filter-type">
|
|
612
|
+
<SelectValue placeholder="All Types" />
|
|
613
|
+
</SelectTrigger>
|
|
614
|
+
<SelectContent>
|
|
615
|
+
<SelectItem value="">All Types</SelectItem>
|
|
616
|
+
{availableTypes.map((type) => (
|
|
617
|
+
<SelectItem key={type} value={type}>
|
|
618
|
+
{formatTypeName(type)}
|
|
619
|
+
</SelectItem>
|
|
620
|
+
))}
|
|
621
|
+
</SelectContent>
|
|
622
|
+
</Select>
|
|
623
|
+
</div>
|
|
624
|
+
|
|
625
|
+
{/* Status Filter */}
|
|
626
|
+
<div className="space-y-2">
|
|
627
|
+
<Label htmlFor="filter-status">Status</Label>
|
|
628
|
+
<Select
|
|
629
|
+
value={filters.status}
|
|
630
|
+
onValueChange={(value) => setFilters({ ...filters, status: value })}
|
|
631
|
+
>
|
|
632
|
+
<SelectTrigger id="filter-status">
|
|
633
|
+
<SelectValue placeholder="All Statuses" />
|
|
634
|
+
</SelectTrigger>
|
|
635
|
+
<SelectContent>
|
|
636
|
+
<SelectItem value="">All Statuses</SelectItem>
|
|
637
|
+
<SelectItem value="active">Active</SelectItem>
|
|
638
|
+
<SelectItem value="inactive">Inactive</SelectItem>
|
|
639
|
+
<SelectItem value="draft">Draft</SelectItem>
|
|
640
|
+
<SelectItem value="published">Published</SelectItem>
|
|
641
|
+
<SelectItem value="archived">Archived</SelectItem>
|
|
642
|
+
</SelectContent>
|
|
643
|
+
</Select>
|
|
644
|
+
</div>
|
|
645
|
+
|
|
646
|
+
{/* Search */}
|
|
647
|
+
<div className="space-y-2">
|
|
648
|
+
<Label htmlFor="filter-search">Search</Label>
|
|
649
|
+
<Input
|
|
650
|
+
id="filter-search"
|
|
651
|
+
type="search"
|
|
652
|
+
placeholder="Search by name..."
|
|
653
|
+
value={filters.search || ''}
|
|
654
|
+
onChange={(e) => setFilters({ ...filters, search: e.target.value })}
|
|
655
|
+
/>
|
|
656
|
+
</div>
|
|
657
|
+
|
|
658
|
+
{/* Clear Filters */}
|
|
659
|
+
{Object.keys(filters).some(key => filters[key]) && (
|
|
660
|
+
<Button
|
|
661
|
+
variant="outline"
|
|
662
|
+
size="sm"
|
|
663
|
+
onClick={() => setFilters({})}
|
|
664
|
+
className="w-full"
|
|
665
|
+
>
|
|
666
|
+
Clear Filters
|
|
667
|
+
</Button>
|
|
668
|
+
)}
|
|
669
|
+
</div>
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
## 6. EventTimeline
|
|
675
|
+
|
|
676
|
+
**Purpose:** Display chronological event history
|
|
677
|
+
|
|
678
|
+
**Props:**
|
|
679
|
+
```typescript
|
|
680
|
+
interface EventTimelineProps {
|
|
681
|
+
events: Array<{
|
|
682
|
+
_id: string;
|
|
683
|
+
type: string;
|
|
684
|
+
timestamp: number;
|
|
685
|
+
actorId?: string;
|
|
686
|
+
targetId?: string;
|
|
687
|
+
metadata?: Record<string, any>;
|
|
688
|
+
}>;
|
|
689
|
+
onLoadMore?: () => void;
|
|
690
|
+
hasMore?: boolean;
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
**Component Structure:**
|
|
695
|
+
```tsx
|
|
696
|
+
export function EventTimeline({ events, onLoadMore, hasMore }: EventTimelineProps) {
|
|
697
|
+
const groupedEvents = groupByDate(events);
|
|
698
|
+
|
|
699
|
+
return (
|
|
700
|
+
<div className="space-y-6">
|
|
701
|
+
{Object.entries(groupedEvents).map(([date, dateEvents]) => (
|
|
702
|
+
<div key={date}>
|
|
703
|
+
<h3 className="text-sm font-semibold mb-3 text-muted-foreground">
|
|
704
|
+
{formatRelativeDate(date)}
|
|
705
|
+
</h3>
|
|
706
|
+
<div className="space-y-3 border-l-2 border-border pl-6">
|
|
707
|
+
{dateEvents.map((event) => (
|
|
708
|
+
<EventCard key={event._id} event={event} />
|
|
709
|
+
))}
|
|
710
|
+
</div>
|
|
711
|
+
</div>
|
|
712
|
+
))}
|
|
713
|
+
|
|
714
|
+
{hasMore && onLoadMore && (
|
|
715
|
+
<Button variant="outline" onClick={onLoadMore} className="w-full">
|
|
716
|
+
Load More Events
|
|
717
|
+
</Button>
|
|
718
|
+
)}
|
|
719
|
+
</div>
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
## Component Test Coverage
|
|
725
|
+
|
|
726
|
+
Each component must pass these test scenarios:
|
|
727
|
+
|
|
728
|
+
### GroupDialog Tests
|
|
729
|
+
- [ ] Renders in create mode with empty form
|
|
730
|
+
- [ ] Renders in edit mode with pre-filled data
|
|
731
|
+
- [ ] Validates required fields (name, slug, type)
|
|
732
|
+
- [ ] Shows error for duplicate slug
|
|
733
|
+
- [ ] Shows error for invalid slug format
|
|
734
|
+
- [ ] Shows slug preview below input
|
|
735
|
+
- [ ] Submits form with valid data
|
|
736
|
+
- [ ] Shows loading state during submission
|
|
737
|
+
- [ ] Handles API errors gracefully
|
|
738
|
+
- [ ] Keyboard navigation works (Tab, Enter, Escape)
|
|
739
|
+
|
|
740
|
+
### ThingCard Tests
|
|
741
|
+
- [ ] Renders with correct icon for type
|
|
742
|
+
- [ ] Shows status badge with correct color
|
|
743
|
+
- [ ] Formats dates correctly
|
|
744
|
+
- [ ] Calls onEdit when Edit button clicked
|
|
745
|
+
- [ ] Calls onDelete when Delete button clicked
|
|
746
|
+
- [ ] Accessible to screen readers
|
|
747
|
+
|
|
748
|
+
### ThingFilter Tests
|
|
749
|
+
- [ ] Applies all filters simultaneously
|
|
750
|
+
- [ ] Debounces search input (300ms)
|
|
751
|
+
- [ ] Calls onFilterChange with updated filters
|
|
752
|
+
- [ ] Clears all filters when Clear button clicked
|
|
753
|
+
- [ ] Dropdown menus keyboard accessible
|
|
754
|
+
|
|
755
|
+
---
|
|
756
|
+
|
|
757
|
+
**All components designed to enable test flows. Ready for implementation.**
|