@nextsparkjs/theme-productivity 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +76 -0
  2. package/about.md +123 -0
  3. package/components/CardDetailModal.tsx +318 -0
  4. package/components/KanbanBoard.tsx +612 -0
  5. package/components/KanbanCard.tsx +218 -0
  6. package/components/KanbanColumn.tsx +264 -0
  7. package/components/SortableList.tsx +46 -0
  8. package/components/index.ts +4 -0
  9. package/config/app.config.ts +172 -0
  10. package/config/billing.config.ts +187 -0
  11. package/config/dashboard.config.ts +357 -0
  12. package/config/dev.config.ts +55 -0
  13. package/config/features.config.ts +256 -0
  14. package/config/flows.config.ts +484 -0
  15. package/config/permissions.config.ts +167 -0
  16. package/config/theme.config.ts +106 -0
  17. package/entities/boards/boards.config.ts +61 -0
  18. package/entities/boards/boards.fields.ts +154 -0
  19. package/entities/boards/boards.service.ts +256 -0
  20. package/entities/boards/boards.types.ts +57 -0
  21. package/entities/boards/messages/en.json +80 -0
  22. package/entities/boards/messages/es.json +80 -0
  23. package/entities/boards/migrations/001_boards_table.sql +83 -0
  24. package/entities/cards/cards.config.ts +61 -0
  25. package/entities/cards/cards.fields.ts +242 -0
  26. package/entities/cards/cards.service.ts +336 -0
  27. package/entities/cards/cards.types.ts +79 -0
  28. package/entities/cards/messages/en.json +114 -0
  29. package/entities/cards/messages/es.json +114 -0
  30. package/entities/cards/migrations/020_cards_table.sql +92 -0
  31. package/entities/lists/lists.config.ts +61 -0
  32. package/entities/lists/lists.fields.ts +105 -0
  33. package/entities/lists/lists.service.ts +252 -0
  34. package/entities/lists/lists.types.ts +55 -0
  35. package/entities/lists/messages/en.json +60 -0
  36. package/entities/lists/messages/es.json +60 -0
  37. package/entities/lists/migrations/010_lists_table.sql +79 -0
  38. package/lib/selectors.ts +206 -0
  39. package/messages/en.json +79 -0
  40. package/messages/es.json +79 -0
  41. package/migrations/999_theme_sample_data.sql +922 -0
  42. package/migrations/999a_initial_sample_data.sql +377 -0
  43. package/migrations/999b_abundant_sample_data.sql +346 -0
  44. package/package.json +17 -0
  45. package/permissions-matrix.md +122 -0
  46. package/styles/components.css +460 -0
  47. package/styles/globals.css +560 -0
  48. package/templates/dashboard/(main)/boards/[id]/[cardId]/page.tsx +238 -0
  49. package/templates/dashboard/(main)/boards/[id]/edit/page.tsx +390 -0
  50. package/templates/dashboard/(main)/boards/[id]/page.tsx +236 -0
  51. package/templates/dashboard/(main)/boards/create/page.tsx +236 -0
  52. package/templates/dashboard/(main)/boards/page.tsx +335 -0
  53. package/templates/dashboard/(main)/layout.tsx +32 -0
  54. package/templates/dashboard/(main)/page.tsx +592 -0
  55. package/templates/shared/ProductivityMobileNav.tsx +410 -0
  56. package/templates/shared/ProductivitySidebar.tsx +538 -0
  57. package/templates/shared/ProductivityTopBar.tsx +317 -0
@@ -0,0 +1,484 @@
1
+ /**
2
+ * Productivity Theme - Flows Configuration
3
+ *
4
+ * Defines user journeys/flows that span multiple features.
5
+ * Each flow key becomes a tag: @flow-{key}
6
+ *
7
+ * Flows are enriched at build-time with:
8
+ * - Feature metadata (from features.config.ts)
9
+ * - Test coverage (from tags-registry + test files)
10
+ */
11
+
12
+ import { defineFlows } from '@nextsparkjs/core/lib/config/features-types'
13
+
14
+ export default defineFlows({
15
+ // ===========================================================================
16
+ // ACQUISITION FLOWS
17
+ // User acquisition and onboarding journeys
18
+ // ===========================================================================
19
+
20
+ onboarding: {
21
+ name: 'User Onboarding',
22
+ description: 'Complete journey from signup to first board creation',
23
+ category: 'acquisition',
24
+ icon: 'rocket',
25
+ criticalPath: true,
26
+
27
+ steps: [
28
+ {
29
+ feature: 'auth',
30
+ action: 'signup',
31
+ description: 'User creates account with email/password or OAuth',
32
+ },
33
+ {
34
+ feature: 'auth',
35
+ action: 'verify-email',
36
+ description: 'User verifies email address',
37
+ },
38
+ {
39
+ feature: 'teams',
40
+ action: 'create-team',
41
+ description: 'User creates their first team/workspace',
42
+ },
43
+ {
44
+ feature: 'boards',
45
+ action: 'create-first-board',
46
+ description: 'User creates their first board',
47
+ },
48
+ ],
49
+
50
+ features: ['auth', 'teams', 'boards'],
51
+ },
52
+
53
+ 'invite-member': {
54
+ name: 'Invite Team Member',
55
+ description: 'Invite a collaborator to the team/workspace',
56
+ category: 'acquisition',
57
+ icon: 'user-plus',
58
+ criticalPath: false,
59
+
60
+ steps: [
61
+ {
62
+ feature: 'teams',
63
+ action: 'open-team-settings',
64
+ description: 'Owner opens team settings',
65
+ },
66
+ {
67
+ feature: 'teams',
68
+ action: 'click-invite',
69
+ description: 'Owner clicks invite member',
70
+ },
71
+ {
72
+ feature: 'teams',
73
+ action: 'enter-email',
74
+ description: 'Owner enters member email',
75
+ },
76
+ {
77
+ feature: 'teams',
78
+ action: 'send-invite',
79
+ description: 'System sends invitation email',
80
+ },
81
+ ],
82
+
83
+ features: ['teams'],
84
+ },
85
+
86
+ // ===========================================================================
87
+ // NAVIGATION FLOWS
88
+ // Context switching and navigation journeys
89
+ // ===========================================================================
90
+
91
+ 'team-switch': {
92
+ name: 'Team Switching',
93
+ description: 'Switch between different teams/workspaces',
94
+ category: 'navigation',
95
+ icon: 'repeat',
96
+ criticalPath: true,
97
+
98
+ steps: [
99
+ {
100
+ feature: 'team-switch',
101
+ action: 'open-switcher',
102
+ description: 'User opens the team switcher dropdown',
103
+ },
104
+ {
105
+ feature: 'team-switch',
106
+ action: 'select-team',
107
+ description: 'User selects a different team',
108
+ },
109
+ {
110
+ feature: 'team-switch',
111
+ action: 'load-context',
112
+ description: 'System loads new team context and redirects',
113
+ },
114
+ ],
115
+
116
+ features: ['team-switch', 'teams'],
117
+ },
118
+
119
+ // ===========================================================================
120
+ // BOARD MANAGEMENT FLOWS
121
+ // Board creation and management
122
+ // ===========================================================================
123
+
124
+ 'create-board': {
125
+ name: 'Create Board',
126
+ description: 'Create a new project board',
127
+ category: 'boards',
128
+ icon: 'plus',
129
+ criticalPath: true,
130
+
131
+ steps: [
132
+ {
133
+ feature: 'boards',
134
+ action: 'click-create',
135
+ description: 'User clicks create board button',
136
+ },
137
+ {
138
+ feature: 'boards',
139
+ action: 'enter-name',
140
+ description: 'User enters board name and description',
141
+ },
142
+ {
143
+ feature: 'boards',
144
+ action: 'save',
145
+ description: 'User saves the new board',
146
+ },
147
+ {
148
+ feature: 'kanban',
149
+ action: 'view-board',
150
+ description: 'User is redirected to the new board',
151
+ },
152
+ ],
153
+
154
+ features: ['boards', 'kanban'],
155
+ },
156
+
157
+ 'manage-board': {
158
+ name: 'Manage Board',
159
+ description: 'Configure board settings',
160
+ category: 'boards',
161
+ icon: 'settings',
162
+ criticalPath: false,
163
+
164
+ steps: [
165
+ {
166
+ feature: 'kanban',
167
+ action: 'open-board',
168
+ description: 'User opens a board',
169
+ },
170
+ {
171
+ feature: 'board-settings',
172
+ action: 'open-settings',
173
+ description: 'User opens board settings',
174
+ },
175
+ {
176
+ feature: 'board-settings',
177
+ action: 'modify',
178
+ description: 'User modifies board name/description',
179
+ },
180
+ {
181
+ feature: 'board-settings',
182
+ action: 'save',
183
+ description: 'User saves changes',
184
+ },
185
+ ],
186
+
187
+ features: ['boards', 'board-settings', 'kanban'],
188
+ },
189
+
190
+ // ===========================================================================
191
+ // LIST MANAGEMENT FLOWS
192
+ // List/column operations
193
+ // ===========================================================================
194
+
195
+ 'create-list': {
196
+ name: 'Create List',
197
+ description: 'Add a new list/column to a board',
198
+ category: 'lists',
199
+ icon: 'plus',
200
+ criticalPath: true,
201
+
202
+ steps: [
203
+ {
204
+ feature: 'kanban',
205
+ action: 'open-board',
206
+ description: 'User opens a board',
207
+ },
208
+ {
209
+ feature: 'lists',
210
+ action: 'click-add-list',
211
+ description: 'User clicks add list button',
212
+ },
213
+ {
214
+ feature: 'lists',
215
+ action: 'enter-name',
216
+ description: 'User enters list name',
217
+ },
218
+ {
219
+ feature: 'lists',
220
+ action: 'save',
221
+ description: 'User saves the new list',
222
+ },
223
+ ],
224
+
225
+ features: ['kanban', 'lists'],
226
+ },
227
+
228
+ 'reorder-lists': {
229
+ name: 'Reorder Lists',
230
+ description: 'Drag and drop lists to reorder',
231
+ category: 'lists',
232
+ icon: 'move',
233
+ criticalPath: false,
234
+
235
+ steps: [
236
+ {
237
+ feature: 'kanban',
238
+ action: 'open-board',
239
+ description: 'User opens a board',
240
+ },
241
+ {
242
+ feature: 'drag-drop',
243
+ action: 'grab-list',
244
+ description: 'User grabs a list header',
245
+ },
246
+ {
247
+ feature: 'drag-drop',
248
+ action: 'drag-list',
249
+ description: 'User drags list to new position',
250
+ },
251
+ {
252
+ feature: 'list-reorder',
253
+ action: 'drop-list',
254
+ description: 'User drops list and order is saved',
255
+ },
256
+ ],
257
+
258
+ features: ['kanban', 'drag-drop', 'list-reorder'],
259
+ },
260
+
261
+ // ===========================================================================
262
+ // CARD MANAGEMENT FLOWS
263
+ // Card/task operations
264
+ // ===========================================================================
265
+
266
+ 'create-card': {
267
+ name: 'Create Card',
268
+ description: 'Add a new card/task to a list',
269
+ category: 'cards',
270
+ icon: 'plus',
271
+ criticalPath: true,
272
+
273
+ steps: [
274
+ {
275
+ feature: 'kanban',
276
+ action: 'open-board',
277
+ description: 'User opens a board',
278
+ },
279
+ {
280
+ feature: 'cards',
281
+ action: 'click-add-card',
282
+ description: 'User clicks add card in a list',
283
+ },
284
+ {
285
+ feature: 'cards',
286
+ action: 'enter-title',
287
+ description: 'User enters card title',
288
+ },
289
+ {
290
+ feature: 'cards',
291
+ action: 'save',
292
+ description: 'User saves the new card',
293
+ },
294
+ ],
295
+
296
+ features: ['kanban', 'cards'],
297
+ },
298
+
299
+ 'edit-card': {
300
+ name: 'Edit Card',
301
+ description: 'Open and edit card details',
302
+ category: 'cards',
303
+ icon: 'edit',
304
+ criticalPath: true,
305
+
306
+ steps: [
307
+ {
308
+ feature: 'kanban',
309
+ action: 'click-card',
310
+ description: 'User clicks on a card',
311
+ },
312
+ {
313
+ feature: 'card-detail',
314
+ action: 'open-modal',
315
+ description: 'Card detail modal opens',
316
+ },
317
+ {
318
+ feature: 'card-detail',
319
+ action: 'edit-fields',
320
+ description: 'User edits card title, description, due date',
321
+ },
322
+ {
323
+ feature: 'card-detail',
324
+ action: 'save',
325
+ description: 'User saves changes',
326
+ },
327
+ ],
328
+
329
+ features: ['kanban', 'card-detail', 'cards'],
330
+ },
331
+
332
+ 'move-card': {
333
+ name: 'Move Card',
334
+ description: 'Drag card to a different list',
335
+ category: 'cards',
336
+ icon: 'move',
337
+ criticalPath: true,
338
+
339
+ steps: [
340
+ {
341
+ feature: 'kanban',
342
+ action: 'open-board',
343
+ description: 'User views board with cards',
344
+ },
345
+ {
346
+ feature: 'drag-drop',
347
+ action: 'grab-card',
348
+ description: 'User grabs a card',
349
+ },
350
+ {
351
+ feature: 'drag-drop',
352
+ action: 'drag-card',
353
+ description: 'User drags card to target list',
354
+ },
355
+ {
356
+ feature: 'card-move',
357
+ action: 'drop-card',
358
+ description: 'User drops card and position is saved',
359
+ },
360
+ ],
361
+
362
+ features: ['kanban', 'drag-drop', 'card-move'],
363
+ },
364
+
365
+ 'assign-card': {
366
+ name: 'Assign Card',
367
+ description: 'Assign a card to a team member',
368
+ category: 'cards',
369
+ icon: 'user-plus',
370
+ criticalPath: false,
371
+
372
+ steps: [
373
+ {
374
+ feature: 'card-detail',
375
+ action: 'open-card',
376
+ description: 'User opens card detail',
377
+ },
378
+ {
379
+ feature: 'card-assign',
380
+ action: 'click-assign',
381
+ description: 'User clicks assign button',
382
+ },
383
+ {
384
+ feature: 'card-assign',
385
+ action: 'select-member',
386
+ description: 'User selects team member',
387
+ },
388
+ {
389
+ feature: 'card-assign',
390
+ action: 'confirm',
391
+ description: 'Assignment is saved',
392
+ },
393
+ ],
394
+
395
+ features: ['card-detail', 'card-assign'],
396
+ },
397
+
398
+ // ===========================================================================
399
+ // KANBAN WORKFLOW FLOWS
400
+ // Complete task workflows
401
+ // ===========================================================================
402
+
403
+ 'kanban-workflow': {
404
+ name: 'Kanban Workflow',
405
+ description: 'Complete task lifecycle from creation to completion',
406
+ category: 'content',
407
+ icon: 'workflow',
408
+ criticalPath: true,
409
+
410
+ steps: [
411
+ {
412
+ feature: 'cards',
413
+ action: 'create',
414
+ description: 'User creates a new card in first list',
415
+ },
416
+ {
417
+ feature: 'card-detail',
418
+ action: 'add-details',
419
+ description: 'User adds description and due date',
420
+ },
421
+ {
422
+ feature: 'card-assign',
423
+ action: 'assign',
424
+ description: 'User assigns card to team member',
425
+ optional: true,
426
+ },
427
+ {
428
+ feature: 'card-move',
429
+ action: 'progress',
430
+ description: 'Card is moved through lists as work progresses',
431
+ },
432
+ {
433
+ feature: 'card-move',
434
+ action: 'complete',
435
+ description: 'Card is moved to done list',
436
+ },
437
+ ],
438
+
439
+ features: ['cards', 'card-detail', 'card-assign', 'card-move', 'kanban'],
440
+ },
441
+
442
+ // ===========================================================================
443
+ // BILLING FLOWS
444
+ // Subscription and payment journeys
445
+ // ===========================================================================
446
+
447
+ 'upgrade-plan': {
448
+ name: 'Upgrade Plan',
449
+ description: 'Upgrade subscription to a higher tier plan',
450
+ category: 'settings',
451
+ icon: 'trending-up',
452
+ criticalPath: false,
453
+
454
+ steps: [
455
+ {
456
+ feature: 'plans',
457
+ action: 'view-plans',
458
+ description: 'User views available plans',
459
+ },
460
+ {
461
+ feature: 'plans',
462
+ action: 'compare-plans',
463
+ description: 'User compares features between plans',
464
+ },
465
+ {
466
+ feature: 'plans',
467
+ action: 'select-plan',
468
+ description: 'User selects a new plan',
469
+ },
470
+ {
471
+ feature: 'billing',
472
+ action: 'enter-payment',
473
+ description: 'User enters or confirms payment method',
474
+ },
475
+ {
476
+ feature: 'billing',
477
+ action: 'confirm-upgrade',
478
+ description: 'User confirms the upgrade',
479
+ },
480
+ ],
481
+
482
+ features: ['plans', 'billing'],
483
+ },
484
+ })
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Productivity Theme - Permissions Configuration
3
+ *
4
+ * SINGLE SOURCE OF TRUTH for all permissions and roles in this theme.
5
+ *
6
+ * This file defines:
7
+ * - teams: Team-level permissions (team.view, team.edit, etc.)
8
+ * - entities: Entity CRUD permissions (boards, lists, cards)
9
+ * - features: Theme-specific feature permissions (archive, reorder, move, assign)
10
+ *
11
+ * All sections use unified format: { action: '...', roles: [...] }
12
+ *
13
+ * Multi-tenant mode with differentiated permissions:
14
+ * - Owner: Full control
15
+ * - Admin: Can manage boards and invite members (future)
16
+ * - Member: Can create/edit cards and lists
17
+ *
18
+ * Use PermissionService.canDoAction(role, action) to check any permission.
19
+ */
20
+
21
+ import type { ThemePermissionsConfig } from '@nextsparkjs/core/lib/permissions/types'
22
+
23
+ export const PERMISSIONS_CONFIG_OVERRIDES: ThemePermissionsConfig = {
24
+ // ==========================================
25
+ // TEAM PERMISSIONS
26
+ // ==========================================
27
+ // Unified format: { action, label, description, roles, dangerous? }
28
+ teams: [
29
+ // View permissions
30
+ { action: 'team.view', label: 'View Team', description: 'Can view team details', roles: ['owner', 'admin', 'member'] },
31
+ { action: 'team.members.view', label: 'View Members', description: 'Can see team member list', roles: ['owner', 'admin', 'member'] },
32
+ { action: 'team.settings.view', label: 'View Settings', description: 'Can view team settings', roles: ['owner', 'admin'] },
33
+ { action: 'team.billing.view', label: 'View Billing', description: 'Can view billing information', roles: ['owner'] },
34
+
35
+ // Edit permissions
36
+ { action: 'team.edit', label: 'Edit Team', description: 'Can modify team name and details', roles: ['owner'] },
37
+ { action: 'team.settings.edit', label: 'Edit Settings', description: 'Can modify team settings', roles: ['owner'] },
38
+ { action: 'team.billing.manage', label: 'Manage Billing', description: 'Can manage subscriptions and payments', roles: ['owner'] },
39
+
40
+ // Member management - Only owner can manage members in this app
41
+ { action: 'team.members.invite', label: 'Invite Members', description: 'Invite team members to collaborate', roles: ['owner'] },
42
+ { action: 'team.members.remove', label: 'Remove Members', description: 'Can remove team members', roles: ['owner'] },
43
+ { action: 'team.members.update_role', label: 'Update Roles', description: 'Can change member roles', roles: ['owner'] },
44
+
45
+ // Dangerous
46
+ { action: 'team.delete', label: 'Delete Team', description: 'Can permanently delete the team', roles: ['owner'], dangerous: true },
47
+ ],
48
+
49
+ // ==========================================
50
+ // ENTITY PERMISSIONS
51
+ // ==========================================
52
+ entities: {
53
+ // ------------------------------------------
54
+ // BOARDS
55
+ // ------------------------------------------
56
+ boards: [
57
+ { action: 'create', label: 'Create boards', description: 'Can create new boards', roles: ['owner', 'admin'] },
58
+ { action: 'read', label: 'View boards', description: 'Can view board details', roles: ['owner', 'admin', 'member'] },
59
+ { action: 'list', label: 'List boards', description: 'Can see the boards list', roles: ['owner', 'admin', 'member'] },
60
+ { action: 'update', label: 'Edit boards', description: 'Can modify board information', roles: ['owner', 'admin'] },
61
+ { action: 'delete', label: 'Delete boards', description: 'Can delete boards', roles: ['owner'], dangerous: true },
62
+ ],
63
+
64
+ // ------------------------------------------
65
+ // LISTS
66
+ // ------------------------------------------
67
+ lists: [
68
+ { action: 'create', label: 'Create lists', description: 'Can create new lists in boards', roles: ['owner', 'admin', 'member'] },
69
+ { action: 'read', label: 'View lists', description: 'Can view list details', roles: ['owner', 'admin', 'member'] },
70
+ { action: 'list', label: 'List lists', description: 'Can see the lists in a board', roles: ['owner', 'admin', 'member'] },
71
+ { action: 'update', label: 'Edit lists', description: 'Can modify list information', roles: ['owner', 'admin', 'member'] },
72
+ { action: 'delete', label: 'Delete lists', description: 'Can delete lists', roles: ['owner', 'admin'], dangerous: true },
73
+ ],
74
+
75
+ // ------------------------------------------
76
+ // CARDS
77
+ // ------------------------------------------
78
+ cards: [
79
+ { action: 'create', label: 'Create cards', description: 'Can create new cards in lists', roles: ['owner', 'admin', 'member'] },
80
+ { action: 'read', label: 'View cards', description: 'Can view card details', roles: ['owner', 'admin', 'member'] },
81
+ { action: 'list', label: 'List cards', description: 'Can see the cards in a list', roles: ['owner', 'admin', 'member'] },
82
+ { action: 'update', label: 'Edit cards', description: 'Can modify card information', roles: ['owner', 'admin', 'member'] },
83
+ { action: 'delete', label: 'Delete cards', description: 'Can delete cards', roles: ['owner', 'admin'], dangerous: true },
84
+ ],
85
+ },
86
+
87
+ // ==========================================
88
+ // FEATURE PERMISSIONS
89
+ // ==========================================
90
+ // Unified format: uses 'action' instead of 'id'
91
+ features: [
92
+ // Board management
93
+ {
94
+ action: 'boards.archive',
95
+ label: 'Archive boards',
96
+ description: 'Can archive boards to hide them from the main view',
97
+ category: 'Boards',
98
+ roles: ['owner'],
99
+ },
100
+ {
101
+ action: 'boards.settings',
102
+ label: 'Board settings',
103
+ description: 'Can modify board settings like name, description, and color',
104
+ category: 'Boards',
105
+ roles: ['owner'],
106
+ },
107
+
108
+ // List management
109
+ {
110
+ action: 'lists.reorder',
111
+ label: 'Reorder lists',
112
+ description: 'Can change the order of lists within a board',
113
+ category: 'Lists',
114
+ roles: ['owner', 'member'],
115
+ },
116
+
117
+ // Card management
118
+ {
119
+ action: 'cards.move',
120
+ label: 'Move cards',
121
+ description: 'Can move cards between lists',
122
+ category: 'Cards',
123
+ roles: ['owner', 'member'],
124
+ },
125
+ {
126
+ action: 'cards.assign',
127
+ label: 'Assign cards',
128
+ description: 'Can assign cards to team members',
129
+ category: 'Cards',
130
+ roles: ['owner', 'member'],
131
+ },
132
+ ],
133
+
134
+ // ==========================================
135
+ // DISABLED FEATURES
136
+ // ==========================================
137
+ disabled: [
138
+ 'settings.api_keys',
139
+ 'settings.billing',
140
+ ],
141
+
142
+ // ==========================================
143
+ // UI SECTIONS
144
+ // ==========================================
145
+ uiSections: [
146
+ {
147
+ id: 'board-management',
148
+ label: 'Board Management',
149
+ description: 'Permissions for managing boards',
150
+ categories: ['Boards'],
151
+ },
152
+ {
153
+ id: 'list-management',
154
+ label: 'List Management',
155
+ description: 'Permissions for managing lists',
156
+ categories: ['Lists'],
157
+ },
158
+ {
159
+ id: 'card-management',
160
+ label: 'Card Management',
161
+ description: 'Permissions for managing cards',
162
+ categories: ['Cards'],
163
+ },
164
+ ],
165
+ }
166
+
167
+ export default PERMISSIONS_CONFIG_OVERRIDES