Commit 6ac734c
authored
421 collaborator management component refresh required (#469)
* Sync collaborator state and replace alerts with toasts
Update local collaborator cache and improve UI feedback for role/member changes.
- api/Project.js: keep this.collaborators in sync by deleting entries on member removal and updating roles after makeLeader, demoteLeader, setToViewer and setRoles calls so the client-side state reflects server changes.
- components/project-collaborators/index.js: add refreshCollaborators() to re-render the collaborators list when roles change.
- components/roles-handler/index.js: replace alert() calls with TPEN.eventDispatcher 'tpen-toast' notifications, add try/catch error handling, and call refreshCollaborators() after successful operations to update the UI.
These changes ensure consistent local state and provide non-blocking toast notifications instead of modal alerts.
* buttons hiding correctly now
* Refactor role management toggles and handlers
Update RolesHandler to improve accessibility, robustness, and control flow for role management UI.
- Added aria-expanded and data-role-management-open attributes to manage button markup for accessibility.
- Removed unused userId/isOwnerOrLeader logic.
- Removed manageRoleButtons setup and consolidated toggle logic into toggleRoleManagementButtons with defensive checks (valid button, memberId, actions container, and collaborator existence).
- Use dataset flags and aria-expanded to track open/closed state and cleanly add/remove role management UI.
- Replaced dynamic actions map with an explicit switch-based handler to await async actions and directly handle the manage-roles button case.
These changes make the role management UI safer against missing DOM/Project state and clearer in behavior.
* rehandling buttons
* Apply better UX to collaboration management (#471)
* major reorganization for better UX
* evening out styling
* cleanup and accessibility review
* Update index.js
* Update collaborators.html
* addressing Claude's suggestions
Send the correct roles payload from ManageRole (use this.group). Update RolesHandler to improve styling, accessibility, and behavior: switch hardcoded colors/shadows to CSS variables; register a cleanup callback to remove injected styles; add aria-labelledby to the modal; prevent duplicate injected manage buttons; track the trigger element and restore focus when the modal closes; set aria-pressed on toggles; disable the Save button and show a loading state while saving; replace alerts with toasts and improve error handling for ownership transfer. These changes fix a payload bug and enhance reliability and accessibility of the roles UI.
* Add custom roles UI and selection logic
Render a Custom Roles section in the manage modal and wire up toggle buttons for any non-default roles defined on the project. Adds CSS for custom-role toggles, shows the section only when custom roles exist, and toggles aria-pressed/active state on click. Collects active custom-role-toggle values into selected/current roles when saving and viewing, updates the viewer fallback logic to require absence of LEADER/CONTRIBUTOR, and includes custom roles in the originalSelection comparison. Also makes openManageModal async and tweaks manage-button styling to use CSS vars for background and hover color.
* static review adjustments
Dispatch a member-invited event and refresh collaborators when a new member is invited. Update RolesHandler UI (padding, overflow, z-index) and make openManageModal synchronous. Replace many direct onclick handlers with renderCleanup.onElement bindings to ensure proper cleanup. Add modal state helpers (getCurrentRoles, hasChanges, updateSaveButtonState) to track unsaved changes and enable/disable the Save button accordingly. Tweak default VIEWER logic so VIEWER is added when no Leader/Contributor is present.
* Show detailed error messages in roles handler
Add getErrorMessage helper to extract user-friendly error text from Error/response objects (handles HTTP status, statusText, response data message/error, and fallbacks). Replace generic toast messages in catch blocks for updating roles, transferring ownership, and removing members to use the new helper so toasts display more informative errors (e.g., 403/404/409/5xx messages or underlying error.message).1 parent e58fb31 commit 6ac734c
6 files changed
Lines changed: 754 additions & 252 deletions
File tree
- api
- components
- manage-role
- member-invitation
- project-collaborators
- roles-handler
- interfaces/manage-project
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
163 | 167 | | |
164 | 168 | | |
165 | 169 | | |
| |||
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
| |||
201 | 208 | | |
202 | 209 | | |
203 | 210 | | |
204 | | - | |
205 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
| |||
223 | 231 | | |
224 | 232 | | |
225 | 233 | | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
226 | 237 | | |
227 | 238 | | |
228 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | | - | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
454 | 457 | | |
455 | 458 | | |
456 | 459 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
468 | 480 | | |
469 | 481 | | |
470 | 482 | | |
| |||
474 | 486 | | |
475 | 487 | | |
476 | 488 | | |
477 | | - | |
| 489 | + | |
478 | 490 | | |
479 | 491 | | |
480 | 492 | | |
| |||
509 | 521 | | |
510 | 522 | | |
511 | 523 | | |
512 | | - | |
| 524 | + | |
513 | 525 | | |
514 | | - | |
| 526 | + | |
515 | 527 | | |
516 | 528 | | |
517 | 529 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
526 | 540 | | |
527 | 541 | | |
528 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
529 | 546 | | |
530 | 547 | | |
531 | 548 | | |
532 | | - | |
| 549 | + | |
533 | 550 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
| 551 | + | |
539 | 552 | | |
540 | 553 | | |
541 | 554 | | |
| |||
644 | 657 | | |
645 | 658 | | |
646 | 659 | | |
| 660 | + | |
647 | 661 | | |
648 | 662 | | |
649 | 663 | | |
| |||
751 | 765 | | |
752 | 766 | | |
753 | 767 | | |
| 768 | + | |
754 | 769 | | |
755 | 770 | | |
756 | 771 | | |
| |||
770 | 785 | | |
771 | 786 | | |
772 | 787 | | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
783 | 800 | | |
784 | | - | |
785 | | - | |
| 801 | + | |
786 | 802 | | |
787 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
788 | 813 | | |
789 | | - | |
790 | | - | |
| 814 | + | |
791 | 815 | | |
792 | | - | |
793 | | - | |
794 | | - | |
795 | | - | |
| 816 | + | |
796 | 817 | | |
797 | 818 | | |
798 | 819 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
0 commit comments