Settings Components
The settings viewer (ViewerNames.settings) contains three panels accessible from a sidebar. Each panel is a self-contained component in @collabdt/core/components/settings/src/.
Source: @collabdt/core/components/settings/
Panels
| Component | Tab key | Description |
|---|---|---|
AccountSettingsPanel | account | View and edit the current user's profile |
OrganizationSettingsPanel | organization | View and edit organization branding and configuration |
UsersSettingsPanel | users | Manage organization users and roles |
AccountSettingsPanel
Displays the current user's profile fields (name, email, etc.) with an edit mode. Also shows the user's role and supports avatar upload.
Behaviour
- Reads
session.user.idvia NextAuthuseSession. - Fetches the full
Userrecord viauseUser(id)and the role viauseUserRole(id). - In edit mode, only changed fields are sent to
updateUser. - Filtered fields not shown in the UI:
id,imageFileId,image,password,emailVerified,createdAt,updatedAt,organizationId,accounts,organization. - Avatar upload uses
useUploadFileToUser. - Password change is handled by a nested
ChangePasswordsub-component.
Permissions
Reads ability from usePermissions(). Editing is only available when ability.can("update", "User").
OrganizationSettingsPanel
Displays and edits the current user's organization record. Supports branding, map defaults, language configuration, and logo/favicon upload.
Behaviour
- Fetches the organization via
useOrganization(userOrganizationId). - Tracks
editingValuesas a partialOrganizationdiff — only changed fields are sent toupdateOrganization. - Logo and favicon are uploaded to a public MinIO bucket via
uploadOrganizationLogoToPublicBucket. countrySubdivisionsDatafromMapContextis used to populate the subdivision dropdown.
Permissions
Requires ability.can("update", "Organization"). The panel renders in read-only mode for users without this permission.
UsersSettingsPanel
Renders the DataMenu component scoped to ViewerNames.users. This reuses the standard data table/management UI rather than implementing a separate list.
export default function UsersSettingsPanel() {
return (
<DataMenu currentViewer={ViewerNames.users} height="h-full" hideTitle hideFrame />
)
}
Permissions
Visibility and actions within DataMenu are gated by the user's CASL permissions for the User subject.
Layout structure
SettingsTabKey type: 'account' | 'users' | 'organization'
Key Files
| File | Role |
|---|---|
@collabdt/core/components/settings/src/AccountSettingsPanel.tsx | Account panel |
@collabdt/core/components/settings/src/OrganizationSettingsPanel.tsx | Organization panel |
@collabdt/core/components/settings/src/UsersSettingsPanel.tsx | Users panel (wraps DataMenu) |
@collabdt/core/components/settings/src/SettingsSidebar.tsx | Tab navigation |
@collabdt/core/components/settings/src/types.ts | SettingsTabKey type |
@collabdt/core/components/settings/src/ChangePassword.tsx | Password change sub-component |
Permissions
| Panel | Required permission |
|---|---|
| Account | read User (always visible); update User to edit |
| Organization | read Organization; update Organization to edit |
| Users | Controlled by DataMenu / read User |