You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By isolating customisations to their own module, this approach should remove the
33
28
chance of merge conflicts when updating your fork, and thus simplify ongoing
34
29
maintenance.
35
30
31
+
**Note**: The project deliberately does not exclude `customisations.json` from Git.
32
+
This is to ensure that in shared projects it's possible to have a common config. By
33
+
default, Element Web does *not* ship with this file to prevent conflicts.
34
+
35
+
### Custom components
36
+
37
+
Instead of implementing skinning from the react-sdk, maintainers can use the above system to override components
38
+
if they wish. Maintenance and API surface compatibility are left as a responsibility for the project - the layering
39
+
in Element Web (including the react-sdk) do not make guarantees that properties/state machines won't change.
40
+
36
41
### Component visibility customisation
42
+
37
43
UI for some actions can be hidden via the ComponentVisibility customisation:
38
44
- inviting users to rooms and spaces,
39
45
- creating rooms,
40
46
- creating spaces,
41
47
42
48
To customise visibility create a customisation module from [ComponentVisibility](https://github.com/matrix-org/matrix-react-sdk/blob/master/src/customisations/ComponentVisibility.ts) following the instructions above.
43
49
44
-
`shouldShowComponent` determines whether or not the active MatrixClient user should be able to use
50
+
`shouldShowComponent` determines whether the active MatrixClient user should be able to use
45
51
the given UI component. When `shouldShowComponent` returns falsy all UI components for that feature will be hidden.
46
52
If shown, the user might still not be able to use the
47
53
component depending on their contextual permissions. For example, invite options
48
-
might be shown to the user but they won't have permission to invite users to
54
+
might be shown to the user, but they won't have permission to invite users to
49
55
the current room: the button will appear disabled.
50
56
51
57
For example, to only allow users who meet a certain condition to create spaces:
52
-
```
58
+
```typescript
53
59
function shouldShowComponent(component:UIComponent):boolean {
54
-
if (component === UIComponent.CreateSpaces) {
55
-
const userMeetsCondition = <<check your custom condition here>>
56
-
return userMeetsCondition;
57
-
}
58
-
return true;
60
+
if (component===UIComponent.CreateSpaces) {
61
+
// customConditionCheck() is a function of your own creation
0 commit comments