Merge branch 'develop' into feed
Looking forward to merging again! :D Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
commit
27ec3af03a
181 changed files with 7349 additions and 2464 deletions
93
CHANGELOG.md
93
CHANGELOG.md
|
@ -1,3 +1,96 @@
|
||||||
|
Changes in [3.17.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.17.0) (2021-03-29)
|
||||||
|
=====================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.17.0-rc.1...v3.17.0)
|
||||||
|
|
||||||
|
* Upgrade to JS SDK 9.10.0
|
||||||
|
* [Release] Tweak cross-signing copy
|
||||||
|
[\#5808](https://github.com/matrix-org/matrix-react-sdk/pull/5808)
|
||||||
|
* [Release] Fix crash on login when using social login
|
||||||
|
[\#5809](https://github.com/matrix-org/matrix-react-sdk/pull/5809)
|
||||||
|
* [Release] Fix edge case with redaction grouper messing up continuations
|
||||||
|
[\#5799](https://github.com/matrix-org/matrix-react-sdk/pull/5799)
|
||||||
|
|
||||||
|
Changes in [3.17.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.17.0-rc.1) (2021-03-25)
|
||||||
|
===============================================================================================================
|
||||||
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0...v3.17.0-rc.1)
|
||||||
|
|
||||||
|
* Upgrade to JS SDK 9.10.0-rc.1
|
||||||
|
* Translations update from Weblate
|
||||||
|
[\#5788](https://github.com/matrix-org/matrix-react-sdk/pull/5788)
|
||||||
|
* Track next event [tile] over group boundaries
|
||||||
|
[\#5784](https://github.com/matrix-org/matrix-react-sdk/pull/5784)
|
||||||
|
* Fixing the minor UI issues in the email discovery
|
||||||
|
[\#5780](https://github.com/matrix-org/matrix-react-sdk/pull/5780)
|
||||||
|
* Don't overwrite callback with undefined if no customization provided
|
||||||
|
[\#5783](https://github.com/matrix-org/matrix-react-sdk/pull/5783)
|
||||||
|
* Fix redaction event list summaries breaking sender profiles
|
||||||
|
[\#5781](https://github.com/matrix-org/matrix-react-sdk/pull/5781)
|
||||||
|
* Fix CIDER formatting buttons on Safari
|
||||||
|
[\#5782](https://github.com/matrix-org/matrix-react-sdk/pull/5782)
|
||||||
|
* Improve discovery of rooms in a space
|
||||||
|
[\#5776](https://github.com/matrix-org/matrix-react-sdk/pull/5776)
|
||||||
|
* Spaces improve creation journeys
|
||||||
|
[\#5777](https://github.com/matrix-org/matrix-react-sdk/pull/5777)
|
||||||
|
* Make buttons in verify dialog respect the system font
|
||||||
|
[\#5778](https://github.com/matrix-org/matrix-react-sdk/pull/5778)
|
||||||
|
* Collapse redactions into an event list summary
|
||||||
|
[\#5728](https://github.com/matrix-org/matrix-react-sdk/pull/5728)
|
||||||
|
* Added invite option to room's context menu
|
||||||
|
[\#5648](https://github.com/matrix-org/matrix-react-sdk/pull/5648)
|
||||||
|
* Add an optional config option to make the welcome page the login page
|
||||||
|
[\#5658](https://github.com/matrix-org/matrix-react-sdk/pull/5658)
|
||||||
|
* Fix username showing instead of display name in Jitsi widgets
|
||||||
|
[\#5770](https://github.com/matrix-org/matrix-react-sdk/pull/5770)
|
||||||
|
* Convert a bunch more js-sdk imports to absolute paths
|
||||||
|
[\#5774](https://github.com/matrix-org/matrix-react-sdk/pull/5774)
|
||||||
|
* Remove forgotten rooms from the room list once forgotten
|
||||||
|
[\#5775](https://github.com/matrix-org/matrix-react-sdk/pull/5775)
|
||||||
|
* Log error when failing to list usermedia devices
|
||||||
|
[\#5771](https://github.com/matrix-org/matrix-react-sdk/pull/5771)
|
||||||
|
* Fix weird timeline jumps
|
||||||
|
[\#5772](https://github.com/matrix-org/matrix-react-sdk/pull/5772)
|
||||||
|
* Replace type declaration in Registration.tsx
|
||||||
|
[\#5773](https://github.com/matrix-org/matrix-react-sdk/pull/5773)
|
||||||
|
* Add possibility to delay rageshake persistence in app startup
|
||||||
|
[\#5767](https://github.com/matrix-org/matrix-react-sdk/pull/5767)
|
||||||
|
* Fix left panel resizing and lower min-width improving flexibility
|
||||||
|
[\#5764](https://github.com/matrix-org/matrix-react-sdk/pull/5764)
|
||||||
|
* Work around more cases where a rageshake server might not be present
|
||||||
|
[\#5766](https://github.com/matrix-org/matrix-react-sdk/pull/5766)
|
||||||
|
* Iterate space panel visually and functionally
|
||||||
|
[\#5761](https://github.com/matrix-org/matrix-react-sdk/pull/5761)
|
||||||
|
* Make some dispatches async
|
||||||
|
[\#5765](https://github.com/matrix-org/matrix-react-sdk/pull/5765)
|
||||||
|
* fix: make room directory correct when using a homeserver with explicit port
|
||||||
|
[\#5762](https://github.com/matrix-org/matrix-react-sdk/pull/5762)
|
||||||
|
* Hangup all calls on logout
|
||||||
|
[\#5756](https://github.com/matrix-org/matrix-react-sdk/pull/5756)
|
||||||
|
* Remove now-unused assets and CSS from CompleteSecurity step
|
||||||
|
[\#5757](https://github.com/matrix-org/matrix-react-sdk/pull/5757)
|
||||||
|
* Add details and summary to allowed HTML tags
|
||||||
|
[\#5760](https://github.com/matrix-org/matrix-react-sdk/pull/5760)
|
||||||
|
* Support a media handling customisation endpoint
|
||||||
|
[\#5714](https://github.com/matrix-org/matrix-react-sdk/pull/5714)
|
||||||
|
* Edit button on View Source dialog that takes you to devtools ->
|
||||||
|
SendCustomEvent
|
||||||
|
[\#5718](https://github.com/matrix-org/matrix-react-sdk/pull/5718)
|
||||||
|
* Show room alias in plain/formatted body
|
||||||
|
[\#5748](https://github.com/matrix-org/matrix-react-sdk/pull/5748)
|
||||||
|
* Allow pills on the beginning of a part string
|
||||||
|
[\#5754](https://github.com/matrix-org/matrix-react-sdk/pull/5754)
|
||||||
|
* [SK-3] Decorate easy components with replaceableComponent
|
||||||
|
[\#5734](https://github.com/matrix-org/matrix-react-sdk/pull/5734)
|
||||||
|
* Use fsync in reskindex to ensure file is written to disk
|
||||||
|
[\#5753](https://github.com/matrix-org/matrix-react-sdk/pull/5753)
|
||||||
|
* Remove unused common CSS classes
|
||||||
|
[\#5752](https://github.com/matrix-org/matrix-react-sdk/pull/5752)
|
||||||
|
* Rebuild space previews with new designs
|
||||||
|
[\#5751](https://github.com/matrix-org/matrix-react-sdk/pull/5751)
|
||||||
|
* Rework cross-signing login flow
|
||||||
|
[\#5727](https://github.com/matrix-org/matrix-react-sdk/pull/5727)
|
||||||
|
* Change read receipt drift to be non-fractional
|
||||||
|
[\#5745](https://github.com/matrix-org/matrix-react-sdk/pull/5745)
|
||||||
|
|
||||||
Changes in [3.16.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0) (2021-03-15)
|
Changes in [3.16.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.16.0) (2021-03-15)
|
||||||
=====================================================================================================
|
=====================================================================================================
|
||||||
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0-rc.2...v3.16.0)
|
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v3.16.0-rc.2...v3.16.0)
|
||||||
|
|
|
@ -21,14 +21,14 @@ caret nodes (more on that later).
|
||||||
For these reasons it doesn't use `innerText`, `textContent` or anything similar.
|
For these reasons it doesn't use `innerText`, `textContent` or anything similar.
|
||||||
The model addresses any content in the editor within as an offset within this string.
|
The model addresses any content in the editor within as an offset within this string.
|
||||||
The caret position is thus also converted from a position in the DOM tree
|
The caret position is thus also converted from a position in the DOM tree
|
||||||
to an offset in the content string. This happens in `getCaretOffsetAndText` in `dom.js`.
|
to an offset in the content string. This happens in `getCaretOffsetAndText` in `dom.ts`.
|
||||||
|
|
||||||
Once the content string and caret offset is calculated, it is passed to the `update()`
|
Once the content string and caret offset is calculated, it is passed to the `update()`
|
||||||
method of the model. The model first calculates the same content string of its current parts,
|
method of the model. The model first calculates the same content string of its current parts,
|
||||||
basically just concatenating their text. It then looks for differences between
|
basically just concatenating their text. It then looks for differences between
|
||||||
the current and the new content string. The diffing algorithm is very basic,
|
the current and the new content string. The diffing algorithm is very basic,
|
||||||
and assumes there is only one change around the caret offset,
|
and assumes there is only one change around the caret offset,
|
||||||
so this should be very inexpensive. See `diff.js` for details.
|
so this should be very inexpensive. See `diff.ts` for details.
|
||||||
|
|
||||||
The result of the diffing is the strings that were added and/or removed from
|
The result of the diffing is the strings that were added and/or removed from
|
||||||
the current content. These differences are then applied to the parts,
|
the current content. These differences are then applied to the parts,
|
||||||
|
@ -51,7 +51,7 @@ which relate poorly to text input or changes, and don't need the `beforeinput` e
|
||||||
which isn't broadly supported yet.
|
which isn't broadly supported yet.
|
||||||
|
|
||||||
Once the parts of the model are updated, the DOM of the editor is then reconciled
|
Once the parts of the model are updated, the DOM of the editor is then reconciled
|
||||||
with the new model state, see `renderModel` in `render.js` for this.
|
with the new model state, see `renderModel` in `render.ts` for this.
|
||||||
If the model didn't reject the input and didn't make any additional changes,
|
If the model didn't reject the input and didn't make any additional changes,
|
||||||
this won't make any changes to the DOM at all, and should thus be fairly efficient.
|
this won't make any changes to the DOM at all, and should thus be fairly efficient.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "matrix-react-sdk",
|
"name": "matrix-react-sdk",
|
||||||
"version": "3.16.0",
|
"version": "3.17.0",
|
||||||
"description": "SDK for matrix.org using React",
|
"description": "SDK for matrix.org using React",
|
||||||
"author": "matrix.org",
|
"author": "matrix.org",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -83,6 +83,7 @@
|
||||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||||
"matrix-widget-api": "^0.1.0-beta.13",
|
"matrix-widget-api": "^0.1.0-beta.13",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
|
"opus-recorder": "^8.0.3",
|
||||||
"pako": "^2.0.3",
|
"pako": "^2.0.3",
|
||||||
"parse5": "^6.0.1",
|
"parse5": "^6.0.1",
|
||||||
"png-chunks-extract": "^1.0.0",
|
"png-chunks-extract": "^1.0.0",
|
||||||
|
|
|
@ -395,6 +395,7 @@ input[type=text]:focus, input[type=password]:focus, textarea:focus {
|
||||||
border: 1px solid $accent-color;
|
border: 1px solid $accent-color;
|
||||||
color: $accent-color;
|
color: $accent-color;
|
||||||
background-color: $button-secondary-bg-color;
|
background-color: $button-secondary-bg-color;
|
||||||
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Dialog button:last-child {
|
.mx_Dialog button:last-child {
|
||||||
|
|
|
@ -111,12 +111,13 @@
|
||||||
@import "./views/elements/_AddressSelector.scss";
|
@import "./views/elements/_AddressSelector.scss";
|
||||||
@import "./views/elements/_AddressTile.scss";
|
@import "./views/elements/_AddressTile.scss";
|
||||||
@import "./views/elements/_DesktopBuildsNotice.scss";
|
@import "./views/elements/_DesktopBuildsNotice.scss";
|
||||||
@import "./views/elements/_DirectorySearchBox.scss";
|
|
||||||
@import "./views/elements/_DesktopCapturerSourcePicker.scss";
|
@import "./views/elements/_DesktopCapturerSourcePicker.scss";
|
||||||
|
@import "./views/elements/_DirectorySearchBox.scss";
|
||||||
@import "./views/elements/_Dropdown.scss";
|
@import "./views/elements/_Dropdown.scss";
|
||||||
@import "./views/elements/_EditableItemList.scss";
|
@import "./views/elements/_EditableItemList.scss";
|
||||||
@import "./views/elements/_ErrorBoundary.scss";
|
@import "./views/elements/_ErrorBoundary.scss";
|
||||||
@import "./views/elements/_EventListSummary.scss";
|
@import "./views/elements/_EventListSummary.scss";
|
||||||
|
@import "./views/elements/_FacePile.scss";
|
||||||
@import "./views/elements/_Field.scss";
|
@import "./views/elements/_Field.scss";
|
||||||
@import "./views/elements/_FormButton.scss";
|
@import "./views/elements/_FormButton.scss";
|
||||||
@import "./views/elements/_ImageView.scss";
|
@import "./views/elements/_ImageView.scss";
|
||||||
|
@ -211,13 +212,13 @@
|
||||||
@import "./views/rooms/_SendMessageComposer.scss";
|
@import "./views/rooms/_SendMessageComposer.scss";
|
||||||
@import "./views/rooms/_Stickers.scss";
|
@import "./views/rooms/_Stickers.scss";
|
||||||
@import "./views/rooms/_TopUnreadMessagesBar.scss";
|
@import "./views/rooms/_TopUnreadMessagesBar.scss";
|
||||||
|
@import "./views/rooms/_VoiceRecordComposerTile.scss";
|
||||||
@import "./views/rooms/_WhoIsTypingTile.scss";
|
@import "./views/rooms/_WhoIsTypingTile.scss";
|
||||||
@import "./views/settings/_AvatarSetting.scss";
|
@import "./views/settings/_AvatarSetting.scss";
|
||||||
@import "./views/settings/_CrossSigningPanel.scss";
|
@import "./views/settings/_CrossSigningPanel.scss";
|
||||||
@import "./views/settings/_DevicesPanel.scss";
|
@import "./views/settings/_DevicesPanel.scss";
|
||||||
@import "./views/settings/_E2eAdvancedPanel.scss";
|
@import "./views/settings/_E2eAdvancedPanel.scss";
|
||||||
@import "./views/settings/_EmailAddresses.scss";
|
@import "./views/settings/_EmailAddresses.scss";
|
||||||
@import "./views/settings/_SpellCheckLanguages.scss";
|
|
||||||
@import "./views/settings/_IntegrationManager.scss";
|
@import "./views/settings/_IntegrationManager.scss";
|
||||||
@import "./views/settings/_Notifications.scss";
|
@import "./views/settings/_Notifications.scss";
|
||||||
@import "./views/settings/_PhoneNumbers.scss";
|
@import "./views/settings/_PhoneNumbers.scss";
|
||||||
|
@ -225,6 +226,7 @@
|
||||||
@import "./views/settings/_SecureBackupPanel.scss";
|
@import "./views/settings/_SecureBackupPanel.scss";
|
||||||
@import "./views/settings/_SetIdServer.scss";
|
@import "./views/settings/_SetIdServer.scss";
|
||||||
@import "./views/settings/_SetIntegrationManager.scss";
|
@import "./views/settings/_SetIntegrationManager.scss";
|
||||||
|
@import "./views/settings/_SpellCheckLanguages.scss";
|
||||||
@import "./views/settings/_UpdateCheckButton.scss";
|
@import "./views/settings/_UpdateCheckButton.scss";
|
||||||
@import "./views/settings/tabs/_SettingsTab.scss";
|
@import "./views/settings/tabs/_SettingsTab.scss";
|
||||||
@import "./views/settings/tabs/room/_GeneralRoomSettingsTab.scss";
|
@import "./views/settings/tabs/room/_GeneralRoomSettingsTab.scss";
|
||||||
|
@ -245,6 +247,7 @@
|
||||||
@import "./views/toasts/_AnalyticsToast.scss";
|
@import "./views/toasts/_AnalyticsToast.scss";
|
||||||
@import "./views/toasts/_NonUrgentEchoFailureToast.scss";
|
@import "./views/toasts/_NonUrgentEchoFailureToast.scss";
|
||||||
@import "./views/verification/_VerificationShowSas.scss";
|
@import "./views/verification/_VerificationShowSas.scss";
|
||||||
|
@import "./views/voice_messages/_Waveform.scss";
|
||||||
@import "./views/voip/_CallContainer.scss";
|
@import "./views/voip/_CallContainer.scss";
|
||||||
@import "./views/voip/_CallView.scss";
|
@import "./views/voip/_CallView.scss";
|
||||||
@import "./views/voip/_CallViewForRoom.scss";
|
@import "./views/voip/_CallViewForRoom.scss";
|
||||||
|
|
|
@ -19,7 +19,8 @@ $roomListCollapsedWidth: 68px;
|
||||||
|
|
||||||
.mx_LeftPanel {
|
.mx_LeftPanel {
|
||||||
background-color: $roomlist-bg-color;
|
background-color: $roomlist-bg-color;
|
||||||
min-width: 260px;
|
// TODO decrease this once Spaces launches as it'll no longer need to include the 56px Community Panel
|
||||||
|
min-width: 206px;
|
||||||
max-width: 50%;
|
max-width: 50%;
|
||||||
|
|
||||||
// Create a row-based flexbox for the GroupFilterPanel and the room list
|
// Create a row-based flexbox for the GroupFilterPanel and the room list
|
||||||
|
@ -129,6 +130,10 @@ $roomListCollapsedWidth: 68px;
|
||||||
mask-repeat: no-repeat;
|
mask-repeat: no-repeat;
|
||||||
background: $secondary-fg-color;
|
background: $secondary-fg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.mx_LeftPanel_exploreButton_space::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/roomlist/browse.svg');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not the left panel, and not the resize handle, so the roomview/groupview/... */
|
/* not the left panel, and not the resize handle, so the roomview/groupview/... */
|
||||||
.mx_MatrixChat > :not(.mx_LeftPanel):not(.mx_ResizeHandle) {
|
.mx_MatrixChat > :not(.mx_LeftPanel):not(.mx_SpacePanel):not(.mx_ResizeHandle) {
|
||||||
background-color: $primary-bg-color;
|
background-color: $primary-bg-color;
|
||||||
|
|
||||||
flex: 1 1 0;
|
flex: 1 1 0;
|
||||||
|
|
|
@ -22,7 +22,7 @@ limitations under the License.
|
||||||
// keep border thickness consistent to prevent movement
|
// keep border thickness consistent to prevent movement
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
height: 28px;
|
height: 28px;
|
||||||
padding: 2px;
|
padding: 1px;
|
||||||
|
|
||||||
// Create a flexbox for the icons (easier to manage)
|
// Create a flexbox for the icons (easier to manage)
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -63,7 +63,7 @@ $activeBorderColor: $secondary-fg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_AutoHideScrollbar {
|
.mx_AutoHideScrollbar {
|
||||||
padding: 16px 0;
|
padding: 8px 0 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceButton_toggleCollapse {
|
.mx_SpaceButton_toggleCollapse {
|
||||||
|
@ -99,7 +99,6 @@ $activeBorderColor: $secondary-fg-color;
|
||||||
|
|
||||||
.mx_SpaceButton {
|
.mx_SpaceButton {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-bottom: 2px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 4px 4px 4px 0;
|
padding: 4px 4px 4px 0;
|
||||||
|
@ -147,9 +146,6 @@ $activeBorderColor: $secondary-fg-color;
|
||||||
|
|
||||||
.mx_SpaceButton_toggleCollapse {
|
.mx_SpaceButton_toggleCollapse {
|
||||||
width: $gutterSize;
|
width: $gutterSize;
|
||||||
// negative margin to place it correctly even with the complex
|
|
||||||
// 4px selection border each space button has when active
|
|
||||||
margin-right: -4px;
|
|
||||||
height: 20px;
|
height: 20px;
|
||||||
mask-position: center;
|
mask-position: center;
|
||||||
mask-size: 20px;
|
mask-size: 20px;
|
||||||
|
@ -334,20 +330,20 @@ $activeBorderColor: $secondary-fg-color;
|
||||||
mask-image: url('$(res)/img/element-icons/leave.svg');
|
mask-image: url('$(res)/img/element-icons/leave.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpacePanel_iconHome::before {
|
|
||||||
mask-image: url('$(res)/img/element-icons/roomlist/home.svg');
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_SpacePanel_iconMembers::before {
|
.mx_SpacePanel_iconMembers::before {
|
||||||
mask-image: url('$(res)/img/element-icons/room/members.svg');
|
mask-image: url('$(res)/img/element-icons/room/members.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpacePanel_iconPlus::before {
|
.mx_SpacePanel_iconPlus::before {
|
||||||
mask-image: url('$(res)/img/element-icons/plus.svg');
|
mask-image: url('$(res)/img/element-icons/roomlist/plus-circle.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpacePanel_iconHash::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/roomlist/hash-circle.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpacePanel_iconExplore::before {
|
.mx_SpacePanel_iconExplore::before {
|
||||||
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
|
mask-image: url('$(res)/img/element-icons/roomlist/browse.svg');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ limitations under the License.
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.mx_BaseAvatar {
|
.mx_BaseAvatar {
|
||||||
margin-right: 16px;
|
margin-right: 12px;
|
||||||
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_BaseAvatar_image {
|
.mx_BaseAvatar_image {
|
||||||
|
@ -47,6 +48,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
|
font-weight: 400;
|
||||||
color: $secondary-fg-color;
|
color: $secondary-fg-color;
|
||||||
font-size: $font-15px;
|
font-size: $font-15px;
|
||||||
line-height: $font-24px;
|
line-height: $font-24px;
|
||||||
|
@ -55,38 +57,71 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_Dialog_content {
|
.mx_Dialog_content {
|
||||||
// TODO fix scrollbar
|
|
||||||
//display: flex;
|
|
||||||
//flex-direction: column;
|
|
||||||
//height: calc(100% - 80px);
|
|
||||||
|
|
||||||
.mx_AccessibleButton_kind_link {
|
.mx_AccessibleButton_kind_link {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SearchBox {
|
.mx_SearchBox {
|
||||||
margin: 24px 0 28px;
|
margin: 24px 0 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomDirectory_noResults {
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
> div {
|
||||||
|
font-size: $font-15px;
|
||||||
|
line-height: $font-24px;
|
||||||
|
color: $secondary-fg-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_listHeader {
|
.mx_SpaceRoomDirectory_listHeader {
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: $font-12px;
|
min-height: 32px;
|
||||||
line-height: $font-15px;
|
align-items: center;
|
||||||
color: $secondary-fg-color;
|
font-size: $font-15px;
|
||||||
|
line-height: $font-24px;
|
||||||
|
color: $primary-fg-color;
|
||||||
|
|
||||||
.mx_FormButton {
|
.mx_AccessibleButton {
|
||||||
margin-bottom: 8px;
|
padding: 2px 8px;
|
||||||
|
font-weight: normal;
|
||||||
|
|
||||||
|
& + .mx_AccessibleButton {
|
||||||
|
margin-left: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
margin: auto 0 0 auto;
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomDirectory_error {
|
||||||
|
position: relative;
|
||||||
|
font-weight: $font-semi-bold;
|
||||||
|
color: $notice-primary-color;
|
||||||
|
font-size: $font-15px;
|
||||||
|
line-height: $font-18px;
|
||||||
|
margin: 20px auto 12px;
|
||||||
|
padding-left: 24px;
|
||||||
|
width: max-content;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
left: 0;
|
||||||
|
background-image: url("$(res)/img/element-icons/warning-badge.svg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_list {
|
.mx_SpaceRoomDirectory_list {
|
||||||
margin-top: 8px;
|
margin-top: 16px;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_roomCount {
|
.mx_SpaceRoomDirectory_roomCount {
|
||||||
> h3 {
|
> h3 {
|
||||||
|
@ -106,115 +141,141 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_subspace {
|
.mx_SpaceRoomDirectory_subspace {
|
||||||
margin-top: 8px;
|
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_subspace_info {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
color: $secondary-fg-color;
|
|
||||||
font-weight: $font-semi-bold;
|
|
||||||
font-size: $font-12px;
|
|
||||||
line-height: $font-15px;
|
|
||||||
|
|
||||||
.mx_BaseAvatar {
|
|
||||||
margin-right: 12px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_BaseAvatar_image {
|
.mx_BaseAvatar_image {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_actions {
|
.mx_SpaceRoomDirectory_subspace_toggle {
|
||||||
text-align: right;
|
position: absolute;
|
||||||
height: min-content;
|
left: -1px;
|
||||||
margin-left: auto;
|
top: 10px;
|
||||||
margin-right: 16px;
|
height: 16px;
|
||||||
display: inline-flex;
|
width: 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: $primary-bg-color;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-position: center;
|
||||||
|
background-color: $tertiary-fg-color;
|
||||||
|
mask-size: 16px;
|
||||||
|
transform: rotate(270deg);
|
||||||
|
mask-image: url('$(res)/img/feather-customised/chevron-down.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
&.mx_SpaceRoomDirectory_subspace_toggle_shown::before {
|
||||||
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_subspace_children {
|
.mx_SpaceRoomDirectory_subspace_children {
|
||||||
margin-left: 12px;
|
position: relative;
|
||||||
border-left: 2px solid $space-button-outline-color;
|
padding-left: 12px;
|
||||||
padding-left: 24px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_roomTile {
|
.mx_SpaceRoomDirectory_roomTile {
|
||||||
padding: 16px;
|
position: relative;
|
||||||
|
padding: 8px 16px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
border: 1px solid $space-button-outline-color;
|
min-height: 56px;
|
||||||
margin: 8px 0 16px;
|
|
||||||
display: flex;
|
|
||||||
min-height: 76px;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
&.mx_AccessibleButton:hover {
|
display: grid;
|
||||||
background-color: rgba(141, 151, 165, 0.1);
|
grid-template-columns: 20px auto max-content;
|
||||||
}
|
grid-column-gap: 8px;
|
||||||
|
grid-row-gap: 6px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
.mx_BaseAvatar {
|
.mx_BaseAvatar {
|
||||||
margin-right: 16px;
|
grid-row: 1;
|
||||||
margin-top: 6px;
|
grid-column: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_roomTile_info {
|
|
||||||
display: inline-block;
|
|
||||||
font-size: $font-15px;
|
|
||||||
flex-grow: 1;
|
|
||||||
height: min-content;
|
|
||||||
margin: auto 0;
|
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_roomTile_name {
|
.mx_SpaceRoomDirectory_roomTile_name {
|
||||||
font-weight: $font-semi-bold;
|
font-weight: $font-semi-bold;
|
||||||
|
font-size: $font-15px;
|
||||||
line-height: $font-18px;
|
line-height: $font-18px;
|
||||||
}
|
grid-row: 1;
|
||||||
.mx_SpaceRoomDirectory_roomTile_topic {
|
grid-column: 2;
|
||||||
line-height: $font-24px;
|
|
||||||
color: $secondary-fg-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_roomTile_memberCount {
|
.mx_InfoTooltip {
|
||||||
|
display: inline;
|
||||||
|
margin-left: 12px;
|
||||||
|
color: $tertiary-fg-color;
|
||||||
|
font-size: $font-12px;
|
||||||
|
line-height: $font-15px;
|
||||||
|
|
||||||
|
.mx_InfoTooltip_icon {
|
||||||
|
margin-right: 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: auto 0 auto 24px;
|
vertical-align: text-top;
|
||||||
padding: 0 0 0 28px;
|
|
||||||
line-height: $font-24px;
|
|
||||||
display: inline-block;
|
|
||||||
width: 32px;
|
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: '';
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
mask-position: center;
|
|
||||||
mask-repeat: no-repeat;
|
|
||||||
mask-size: contain;
|
|
||||||
background-color: $secondary-fg-color;
|
|
||||||
mask-image: url('$(res)/img/element-icons/community-members.svg');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomDirectory_roomTile_info {
|
||||||
|
font-size: $font-14px;
|
||||||
|
line-height: $font-18px;
|
||||||
|
color: $secondary-fg-color;
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 1/3;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_actions {
|
.mx_SpaceRoomDirectory_actions {
|
||||||
width: 180px;
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
margin-left: 28px;
|
margin-left: 20px;
|
||||||
display: inline-flex;
|
grid-column: 3;
|
||||||
align-items: center;
|
grid-row: 1/3;
|
||||||
|
|
||||||
.mx_AccessibleButton {
|
.mx_AccessibleButton {
|
||||||
vertical-align: middle;
|
padding: 8px 18px;
|
||||||
|
display: inline-block;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
& + .mx_AccessibleButton {
|
.mx_Checkbox {
|
||||||
margin-left: 24px;
|
display: inline-flex;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $groupFilterPanel-bg-color;
|
||||||
|
|
||||||
|
.mx_AccessibleButton {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomDirectory_roomTile,
|
||||||
|
.mx_SpaceRoomDirectory_subspace_children {
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
background-color: $groupFilterPanel-bg-color;
|
||||||
|
width: 1px;
|
||||||
|
height: 100%;
|
||||||
|
left: 6px;
|
||||||
|
top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,4 +287,17 @@ limitations under the License.
|
||||||
color: $secondary-fg-color;
|
color: $secondary-fg-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> hr {
|
||||||
|
border: none;
|
||||||
|
height: 1px;
|
||||||
|
background-color: rgba(141, 151, 165, 0.2);
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomDirectory_createRoom {
|
||||||
|
display: block;
|
||||||
|
margin: 16px auto 0;
|
||||||
|
width: max-content;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,51 @@ limitations under the License.
|
||||||
|
|
||||||
$SpaceRoomViewInnerWidth: 428px;
|
$SpaceRoomViewInnerWidth: 428px;
|
||||||
|
|
||||||
|
@define-mixin SpacePillButton {
|
||||||
|
position: relative;
|
||||||
|
padding: 16px 32px 16px 72px;
|
||||||
|
width: 432px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid $input-border-color;
|
||||||
|
font-size: $font-15px;
|
||||||
|
margin: 20px 0;
|
||||||
|
|
||||||
|
> h3 {
|
||||||
|
font-weight: $font-semi-bold;
|
||||||
|
margin: 0 0 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
> span {
|
||||||
|
color: $secondary-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
position: absolute;
|
||||||
|
content: '';
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
top: 24px;
|
||||||
|
left: 20px;
|
||||||
|
mask-position: center;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-size: 24px;
|
||||||
|
background-color: $tertiary-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: $accent-color;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
background-color: $accent-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
> span {
|
||||||
|
color: $primary-fg-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView {
|
.mx_SpaceRoomView {
|
||||||
.mx_MainSplit > div:first-child {
|
.mx_MainSplit > div:first-child {
|
||||||
padding: 80px 60px;
|
padding: 80px 60px;
|
||||||
|
@ -44,7 +89,7 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
width: $SpaceRoomViewInnerWidth;
|
width: $SpaceRoomViewInnerWidth;
|
||||||
text-align: right; // button alignment right
|
text-align: right; // button alignment right
|
||||||
|
|
||||||
.mx_FormButton {
|
.mx_AccessibleButton_hasKind {
|
||||||
padding: 8px 22px;
|
padding: 8px 22px;
|
||||||
margin-left: 16px;
|
margin-left: 16px;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +122,6 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
max-width: 480px;
|
max-width: 480px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
box-shadow: 2px 15px 30px $dialog-shadow-color;
|
box-shadow: 2px 15px 30px $dialog-shadow-color;
|
||||||
border: 1px solid $input-border-color;
|
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|
||||||
.mx_SpaceRoomView_preview_inviter {
|
.mx_SpaceRoomView_preview_inviter {
|
||||||
|
@ -109,53 +153,6 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
margin: 20px 0 !important; // override default margin from above
|
margin: 20px 0 !important; // override default margin from above
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView_preview_info {
|
|
||||||
color: $tertiary-fg-color;
|
|
||||||
font-size: $font-15px;
|
|
||||||
line-height: $font-24px;
|
|
||||||
margin: 20px 0;
|
|
||||||
|
|
||||||
.mx_SpaceRoomView_preview_info_public,
|
|
||||||
.mx_SpaceRoomView_preview_info_private {
|
|
||||||
padding-left: 20px;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
position: absolute;
|
|
||||||
content: "";
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
top: 0;
|
|
||||||
left: -2px;
|
|
||||||
mask-position: center;
|
|
||||||
mask-repeat: no-repeat;
|
|
||||||
background-color: $tertiary-fg-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_SpaceRoomView_preview_info_public::before {
|
|
||||||
mask-size: 12px;
|
|
||||||
mask-image: url("$(res)/img/globe.svg");
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_SpaceRoomView_preview_info_private::before {
|
|
||||||
mask-size: 14px;
|
|
||||||
mask-image: url("$(res)/img/element-icons/lock.svg");
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_AccessibleButton_kind_link {
|
|
||||||
color: inherit;
|
|
||||||
position: relative;
|
|
||||||
padding-left: 16px;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: "·"; // visual separator
|
|
||||||
position: absolute;
|
|
||||||
left: 6px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_SpaceRoomView_preview_topic {
|
.mx_SpaceRoomView_preview_topic {
|
||||||
font-size: $font-14px;
|
font-size: $font-14px;
|
||||||
line-height: $font-22px;
|
line-height: $font-22px;
|
||||||
|
@ -209,36 +206,90 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView_landing_memberCount {
|
.mx_SpaceRoomView_landing_info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.mx_SpaceRoomView_info {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_FacePile {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: 12px;
|
||||||
|
|
||||||
|
.mx_FacePile_faces {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
> span:hover {
|
||||||
|
.mx_BaseAvatar {
|
||||||
|
filter: brightness(0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> span:first-child {
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-left: 24px;
|
|
||||||
padding: 0 0 0 28px;
|
.mx_BaseAvatar {
|
||||||
line-height: $font-24px;
|
filter: brightness(0.8);
|
||||||
vertical-align: text-bottom;
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
z-index: 1;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 30px;
|
||||||
|
width: 30px;
|
||||||
|
background: #ffffff; // white icon fill
|
||||||
|
mask-position: center;
|
||||||
|
mask-size: 24px;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
mask-image: url('$(res)/img/element-icons/room/ellipsis.svg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomView_landing_inviteButton {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 40px;
|
||||||
|
height: min-content;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: '';
|
content: "";
|
||||||
width: 24px;
|
left: 8px;
|
||||||
height: 24px;
|
height: 16px;
|
||||||
top: 0;
|
width: 16px;
|
||||||
left: 0;
|
background: #ffffff; // white icon fill
|
||||||
mask-position: center;
|
mask-position: center;
|
||||||
|
mask-size: 16px;
|
||||||
mask-repeat: no-repeat;
|
mask-repeat: no-repeat;
|
||||||
mask-size: contain;
|
mask-image: url('$(res)/img/element-icons/room/invite.svg');
|
||||||
background-color: $accent-color;
|
|
||||||
mask-image: url('$(res)/img/element-icons/community-members.svg');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView_landing_topic {
|
.mx_SpaceRoomView_landing_topic {
|
||||||
font-size: $font-15px;
|
font-size: $font-15px;
|
||||||
|
margin-top: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
> hr {
|
||||||
|
border: none;
|
||||||
|
height: 1px;
|
||||||
|
background-color: $groupFilterPanel-bg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView_landing_adminButtons {
|
.mx_SpaceRoomView_landing_adminButtons {
|
||||||
margin-top: 32px;
|
margin-top: 24px;
|
||||||
|
|
||||||
.mx_AccessibleButton {
|
.mx_AccessibleButton {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -247,9 +298,9 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 72px 16px 0;
|
padding: 72px 16px 0;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
border: 1px solid $space-button-outline-color;
|
border: 1px solid $input-border-color;
|
||||||
margin-right: 28px;
|
margin-right: 28px;
|
||||||
margin-bottom: 28px;
|
margin-bottom: 20px;
|
||||||
font-size: $font-14px;
|
font-size: $font-14px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
|
@ -279,16 +330,6 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
background: #ffffff; // white icon fill
|
background: #ffffff; // white icon fill
|
||||||
}
|
}
|
||||||
|
|
||||||
&.mx_SpaceRoomView_landing_inviteButton {
|
|
||||||
&::before {
|
|
||||||
background-color: $accent-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
mask-image: url('$(res)/img/element-icons/room/invite.svg');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.mx_SpaceRoomView_landing_addButton {
|
&.mx_SpaceRoomView_landing_addButton {
|
||||||
&::before {
|
&::before {
|
||||||
background-color: #ac3ba8;
|
background-color: #ac3ba8;
|
||||||
|
@ -321,74 +362,14 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_list {
|
.mx_SearchBox {
|
||||||
max-width: 600px;
|
margin: 0 0 20px;
|
||||||
|
|
||||||
.mx_SpaceRoomDirectory_roomTile_actions {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView_privateScope {
|
.mx_SpaceRoomView_privateScope {
|
||||||
.mx_RadioButton {
|
.mx_AccessibleButton {
|
||||||
width: $SpaceRoomViewInnerWidth;
|
@mixin SpacePillButton;
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid $space-button-outline-color;
|
|
||||||
padding: 16px 16px 16px 72px;
|
|
||||||
margin-top: 36px;
|
|
||||||
cursor: pointer;
|
|
||||||
box-sizing: border-box;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
> div:first-of-type {
|
|
||||||
// hide radio dot
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_RadioButton_content {
|
|
||||||
margin: 0;
|
|
||||||
|
|
||||||
> h3 {
|
|
||||||
margin: 0 0 4px;
|
|
||||||
font-size: $font-15px;
|
|
||||||
font-weight: $font-semi-bold;
|
|
||||||
line-height: $font-18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> div {
|
|
||||||
color: $secondary-fg-color;
|
|
||||||
font-size: $font-15px;
|
|
||||||
line-height: $font-24px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
height: 32px;
|
|
||||||
width: 32px;
|
|
||||||
top: 24px;
|
|
||||||
left: 20px;
|
|
||||||
background-color: $secondary-fg-color;
|
|
||||||
mask-repeat: no-repeat;
|
|
||||||
mask-position: center;
|
|
||||||
mask-size: contain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_RadioButton_checked {
|
|
||||||
border-color: $accent-color;
|
|
||||||
|
|
||||||
.mx_RadioButton_content {
|
|
||||||
> div {
|
|
||||||
color: $primary-fg-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
background-color: $accent-color;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceRoomView_privateScope_justMeButton::before {
|
.mx_SpaceRoomView_privateScope_justMeButton::before {
|
||||||
|
@ -435,3 +416,50 @@ $SpaceRoomViewInnerWidth: 428px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomView_info {
|
||||||
|
color: $secondary-fg-color;
|
||||||
|
font-size: $font-15px;
|
||||||
|
line-height: $font-24px;
|
||||||
|
margin: 20px 0;
|
||||||
|
|
||||||
|
.mx_SpaceRoomView_info_public,
|
||||||
|
.mx_SpaceRoomView_info_private {
|
||||||
|
padding-left: 20px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
top: 0;
|
||||||
|
left: -2px;
|
||||||
|
mask-position: center;
|
||||||
|
mask-repeat: no-repeat;
|
||||||
|
background-color: $tertiary-fg-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomView_info_public::before {
|
||||||
|
mask-size: 12px;
|
||||||
|
mask-image: url("$(res)/img/globe.svg");
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_SpaceRoomView_info_private::before {
|
||||||
|
mask-size: 14px;
|
||||||
|
mask-image: url("$(res)/img/element-icons/lock.svg");
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_AccessibleButton_kind_link {
|
||||||
|
color: inherit;
|
||||||
|
position: relative;
|
||||||
|
padding-left: 16px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: "·"; // visual separator
|
||||||
|
position: absolute;
|
||||||
|
left: 6px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
Copyright 2019-2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -158,6 +158,10 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_Toast_detail {
|
||||||
|
color: $secondary-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
.mx_Toast_deviceID {
|
.mx_Toast_deviceID {
|
||||||
font-size: $font-10px;
|
font-size: $font-10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,6 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.mx_ViewSource_label_left {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_ViewSource_label_right {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_ViewSource_separator {
|
.mx_ViewSource_separator {
|
||||||
clear: both;
|
clear: both;
|
||||||
border-bottom: 1px solid #e5e5e5;
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
|
|
@ -28,22 +28,23 @@ limitations under the License.
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex-wrap: nowrap;
|
flex-wrap: nowrap;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
|
height: 80vh;
|
||||||
|
|
||||||
.mx_Dialog_title {
|
.mx_Dialog_title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
.mx_BaseAvatar {
|
|
||||||
display: inline-flex;
|
|
||||||
margin: 5px 16px 5px 5px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_BaseAvatar_image {
|
.mx_BaseAvatar_image {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
vertical-align: unset;
|
vertical-align: unset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_BaseAvatar {
|
||||||
|
display: inline-flex;
|
||||||
|
margin: 5px 16px 5px 5px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
> h1 {
|
> h1 {
|
||||||
font-weight: $font-semi-bold;
|
font-weight: $font-semi-bold;
|
||||||
|
@ -101,6 +102,7 @@ limitations under the License.
|
||||||
|
|
||||||
.mx_SearchBox {
|
.mx_SearchBox {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
flex-grow: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_AddExistingToSpaceDialog_errorText {
|
.mx_AddExistingToSpaceDialog_errorText {
|
||||||
|
@ -112,7 +114,10 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_AddExistingToSpaceDialog_content {
|
.mx_AddExistingToSpaceDialog_content {
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
.mx_AddExistingToSpaceDialog_noResults {
|
.mx_AddExistingToSpaceDialog_noResults {
|
||||||
|
display: block;
|
||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,8 +167,14 @@ limitations under the License.
|
||||||
|
|
||||||
> span {
|
> span {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
font-size: $font-12px;
|
font-size: $font-14px;
|
||||||
line-height: $font-15px;
|
line-height: $font-15px;
|
||||||
|
font-weight: $font-semi-bold;
|
||||||
|
|
||||||
|
.mx_AccessibleButton {
|
||||||
|
font-size: inherit;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
|
|
@ -49,7 +49,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_FormButton {
|
.mx_AccessibleButton_hasKind {
|
||||||
padding: 8px 22px;
|
padding: 8px 22px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
42
res/css/views/elements/_FacePile.scss
Normal file
42
res/css/views/elements/_FacePile.scss
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.mx_FacePile {
|
||||||
|
.mx_FacePile_faces {
|
||||||
|
display: inline-flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
vertical-align: middle;
|
||||||
|
|
||||||
|
> span + span {
|
||||||
|
margin-right: -8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_BaseAvatar_image {
|
||||||
|
border: 1px solid $primary-bg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_BaseAvatar_initial {
|
||||||
|
margin: 1px; // to offset the border on the image
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> span {
|
||||||
|
margin-left: 12px;
|
||||||
|
font-size: $font-14px;
|
||||||
|
line-height: $font-24px;
|
||||||
|
color: $tertiary-fg-color;
|
||||||
|
}
|
||||||
|
}
|
|
@ -66,6 +66,11 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.mx_BasicMessageComposer_input_disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_BasicMessageComposer_AutoCompleteWrapper {
|
.mx_BasicMessageComposer_AutoCompleteWrapper {
|
||||||
|
|
|
@ -227,6 +227,10 @@ limitations under the License.
|
||||||
mask-image: url('$(res)/img/element-icons/room/composer/attach.svg');
|
mask-image: url('$(res)/img/element-icons/room/composer/attach.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_MessageComposer_voiceMessage::before {
|
||||||
|
mask-image: url('$(res)/img/voip/mic-on-mask.svg');
|
||||||
|
}
|
||||||
|
|
||||||
.mx_MessageComposer_emoji::before {
|
.mx_MessageComposer_emoji::before {
|
||||||
mask-image: url('$(res)/img/element-icons/room/composer/emoji.svg');
|
mask-image: url('$(res)/img/element-icons/room/composer/emoji.svg');
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,8 @@ limitations under the License.
|
||||||
width: 27px;
|
width: 27px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
background: none;
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_MessageComposerFormatBar_button::after {
|
.mx_MessageComposerFormatBar_button::after {
|
||||||
|
|
|
@ -33,8 +33,13 @@ limitations under the License.
|
||||||
|
|
||||||
.mx_AccessibleButton {
|
.mx_AccessibleButton {
|
||||||
line-height: $font-24px;
|
line-height: $font-24px;
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
&::before {
|
& + .mx_AccessibleButton {
|
||||||
|
margin-left: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(.mx_AccessibleButton_kind_primary_outline)::before {
|
||||||
content: '';
|
content: '';
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background-color: $button-fg-color;
|
background-color: $button-fg-color;
|
||||||
|
|
|
@ -27,6 +27,9 @@ limitations under the License.
|
||||||
.mx_RoomList_iconExplore::before {
|
.mx_RoomList_iconExplore::before {
|
||||||
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
|
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
|
||||||
}
|
}
|
||||||
|
.mx_RoomList_iconBrowse::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/roomlist/browse.svg');
|
||||||
|
}
|
||||||
.mx_RoomList_iconDialpad::before {
|
.mx_RoomList_iconDialpad::before {
|
||||||
mask-image: url('$(res)/img/element-icons/roomlist/dialpad.svg');
|
mask-image: url('$(res)/img/element-icons/roomlist/dialpad.svg');
|
||||||
}
|
}
|
||||||
|
@ -34,29 +37,33 @@ limitations under the License.
|
||||||
.mx_RoomList_explorePrompt {
|
.mx_RoomList_explorePrompt {
|
||||||
margin: 4px 12px 4px;
|
margin: 4px 12px 4px;
|
||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
border-top: 1px solid $tertiary-fg-color;
|
border-top: 1px solid $input-border-color;
|
||||||
font-size: $font-13px;
|
font-size: $font-14px;
|
||||||
|
|
||||||
div:first-child {
|
div:first-child {
|
||||||
font-weight: $font-semi-bold;
|
font-weight: $font-semi-bold;
|
||||||
|
line-height: $font-18px;
|
||||||
|
color: $primary-fg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_AccessibleButton {
|
.mx_AccessibleButton {
|
||||||
color: $secondary-fg-color;
|
color: $primary-fg-color;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0 0 0 24px;
|
padding: 8px 8px 8px 32px;
|
||||||
font-size: inherit;
|
font-size: inherit;
|
||||||
margin-top: 8px;
|
margin-top: 12px;
|
||||||
display: block;
|
display: block;
|
||||||
text-align: start;
|
text-align: start;
|
||||||
|
background-color: $roomlist-button-bg-color;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 8px;
|
||||||
left: 0;
|
left: 8px;
|
||||||
background: $secondary-fg-color;
|
background: $secondary-fg-color;
|
||||||
mask-position: center;
|
mask-position: center;
|
||||||
mask-size: contain;
|
mask-size: contain;
|
||||||
|
@ -70,5 +77,13 @@ limitations under the License.
|
||||||
&.mx_RoomList_explorePrompt_explore::before {
|
&.mx_RoomList_explorePrompt_explore::before {
|
||||||
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
|
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.mx_RoomList_explorePrompt_spaceInvite::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/room/invite.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
&.mx_RoomList_explorePrompt_spaceExplore::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/roomlist/browse.svg');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,10 @@ limitations under the License.
|
||||||
mask-image: url('$(res)/img/element-icons/settings.svg');
|
mask-image: url('$(res)/img/element-icons/settings.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_RoomTile_iconInvite::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/room/invite.svg');
|
||||||
|
}
|
||||||
|
|
||||||
.mx_RoomTile_iconSignOut::before {
|
.mx_RoomTile_iconSignOut::before {
|
||||||
mask-image: url('$(res)/img/element-icons/leave.svg');
|
mask-image: url('$(res)/img/element-icons/leave.svg');
|
||||||
}
|
}
|
||||||
|
|
76
res/css/views/rooms/_VoiceRecordComposerTile.scss
Normal file
76
res/css/views/rooms/_VoiceRecordComposerTile.scss
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.mx_VoiceRecordComposerTile_stop {
|
||||||
|
// 28px plus a 2px border makes this a 32px square (as intended)
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
border: 2px solid $voice-record-stop-border-color;
|
||||||
|
border-radius: 32px;
|
||||||
|
margin-right: 16px; // between us and the send button
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
position: absolute;
|
||||||
|
top: 7px;
|
||||||
|
left: 7px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: $voice-record-stop-symbol-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_VoiceRecordComposerTile_waveformContainer {
|
||||||
|
padding: 5px;
|
||||||
|
padding-right: 4px; // there's 1px from the waveform itself, so account for that
|
||||||
|
padding-left: 15px; // +10px for the live circle, +5px for regular padding
|
||||||
|
background-color: $voice-record-waveform-bg-color;
|
||||||
|
border-radius: 12px;
|
||||||
|
margin-right: 12px; // isolate from stop button
|
||||||
|
|
||||||
|
// Cheat at alignment a bit
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
position: relative; // important for the live circle
|
||||||
|
|
||||||
|
color: $voice-record-waveform-fg-color;
|
||||||
|
font-size: $font-14px;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
// TODO: @@ TravisR: Animate
|
||||||
|
content: '';
|
||||||
|
background-color: $voice-record-live-circle-color;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
position: absolute;
|
||||||
|
left: 8px;
|
||||||
|
top: 16px; // vertically center
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_Waveform_bar {
|
||||||
|
background-color: $voice-record-waveform-fg-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_Clock {
|
||||||
|
padding-right: 8px; // isolate from waveform
|
||||||
|
padding-left: 10px; // isolate from live circle
|
||||||
|
width: 42px; // we're not using a monospace font, so fake it
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,10 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: the space panel currently does not have a fixed width,
|
$spacePanelWidth: 71px;
|
||||||
// just the headers at each level have a max-width of 150px
|
|
||||||
// so this will look slightly off for now. We should probably use css grid for the whole main layout...
|
|
||||||
$spacePanelWidth: 200px;
|
|
||||||
|
|
||||||
.mx_SpaceCreateMenu_wrapper {
|
.mx_SpaceCreateMenu_wrapper {
|
||||||
// background blur everything except SpacePanel
|
// background blur everything except SpacePanel
|
||||||
|
@ -48,53 +45,11 @@ $spacePanelWidth: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceCreateMenuType {
|
.mx_SpaceCreateMenuType {
|
||||||
position: relative;
|
@mixin SpacePillButton;
|
||||||
padding: 16px 32px 16px 72px;
|
|
||||||
width: 432px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid $input-darker-bg-color;
|
|
||||||
font-size: $font-15px;
|
|
||||||
margin: 20px 0;
|
|
||||||
|
|
||||||
> h3 {
|
|
||||||
font-weight: $font-semi-bold;
|
|
||||||
margin: 0 0 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> span {
|
|
||||||
color: $secondary-fg-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
position: absolute;
|
|
||||||
content: '';
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
top: 24px;
|
|
||||||
left: 20px;
|
|
||||||
mask-position: center;
|
|
||||||
mask-repeat: no-repeat;
|
|
||||||
mask-size: 32px;
|
|
||||||
background-color: $tertiary-fg-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
border-color: $accent-color;
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
background-color: $accent-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
> span {
|
|
||||||
color: $primary-fg-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_SpaceCreateMenuType_public::before {
|
.mx_SpaceCreateMenuType_public::before {
|
||||||
mask-image: url('$(res)/img/globe.svg');
|
mask-image: url('$(res)/img/globe.svg');
|
||||||
mask-size: 26px;
|
|
||||||
}
|
}
|
||||||
.mx_SpaceCreateMenuType_private::before {
|
.mx_SpaceCreateMenuType_private::before {
|
||||||
mask-image: url('$(res)/img/element-icons/lock.svg');
|
mask-image: url('$(res)/img/element-icons/lock.svg');
|
||||||
|
@ -124,7 +79,7 @@ $spacePanelWidth: 200px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_FormButton {
|
.mx_AccessibleButton_kind_primary {
|
||||||
padding: 8px 22px;
|
padding: 8px 22px;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
|
@ -16,38 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
.mx_SpacePublicShare {
|
.mx_SpacePublicShare {
|
||||||
.mx_AccessibleButton {
|
.mx_AccessibleButton {
|
||||||
border: 1px solid $space-button-outline-color;
|
@mixin SpacePillButton;
|
||||||
box-sizing: border-box;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 12px 24px 12px 52px;
|
|
||||||
margin-top: 16px;
|
|
||||||
width: $SpaceRoomViewInnerWidth;
|
|
||||||
font-size: $font-15px;
|
|
||||||
line-height: $font-24px;
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
> span {
|
|
||||||
color: #368bd6;
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background-color: rgba(141, 151, 165, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
mask-repeat: no-repeat;
|
|
||||||
mask-size: contain;
|
|
||||||
mask-position: center;
|
|
||||||
background: $muted-fg-color;
|
|
||||||
left: 12px;
|
|
||||||
top: 9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.mx_SpacePublicShare_shareButton::before {
|
&.mx_SpacePublicShare_shareButton::before {
|
||||||
mask-image: url('$(res)/img/element-icons/link.svg');
|
mask-image: url('$(res)/img/element-icons/link.svg');
|
||||||
|
|
40
res/css/views/voice_messages/_Waveform.scss
Normal file
40
res/css/views/voice_messages/_Waveform.scss
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.mx_Waveform {
|
||||||
|
position: relative;
|
||||||
|
height: 30px; // tallest bar can only be 30px
|
||||||
|
top: 1px; // because of our border trick (see below), we're off by 1px of aligntment
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center; // so the bars grow from the middle
|
||||||
|
|
||||||
|
overflow: hidden; // this is cheaper than a `max-height: calc(100% - 4px)` in the bar's CSS.
|
||||||
|
|
||||||
|
// A bar is meant to be a 2x2 circle when at zero height, and otherwise a 2px wide line
|
||||||
|
// with rounded caps.
|
||||||
|
.mx_Waveform_bar {
|
||||||
|
width: 0; // 0px width means we'll end up using the border as our width
|
||||||
|
border: 1px solid transparent; // transparent means we'll use the background colour
|
||||||
|
border-radius: 2px; // rounded end caps, based on the border
|
||||||
|
min-height: 0; // like the width, we'll rely on the border to give us height
|
||||||
|
max-height: 100%; // this makes the `height: 42%` work on the element
|
||||||
|
margin-left: 1px; // we want 2px between each bar, so 1px on either side for balance
|
||||||
|
margin-right: 1px;
|
||||||
|
|
||||||
|
// background color is handled by the parent components
|
||||||
|
}
|
||||||
|
}
|
|
@ -58,7 +58,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_CallView_voice_holdText {
|
.mx_CallView_holdTransferContent {
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
padding-bottom: 25px;
|
padding-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_CallView_voice_hold {
|
.mx_CallView_voice .mx_CallView_holdTransferContent {
|
||||||
// This masks the avatar image so when it's blurred, the edge is still crisp
|
// This masks the avatar image so when it's blurred, the edge is still crisp
|
||||||
.mx_CallView_voice_avatarContainer {
|
.mx_CallView_voice_avatarContainer {
|
||||||
border-radius: 2000px;
|
border-radius: 2000px;
|
||||||
|
@ -94,7 +94,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_CallView_voice_holdText {
|
.mx_CallView_holdTransferContent {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
|
@ -147,7 +147,7 @@ limitations under the License.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_CallView_video_holdContent {
|
.mx_CallView_video .mx_CallView_holdTransferContent {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|
4
res/img/element-icons/roomlist/browse.svg
Normal file
4
res/img/element-icons/roomlist/browse.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg width="18" height="17" viewBox="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.00262 5.60945C7.02444 6.31867 7.18204 6.99371 7.45029 7.60945H5.83106L5.49798 11.0235H8.60274L8.757 9.44233C9.29964 9.94168 9.94406 10.3321 10.6556 10.579L10.6122 11.0235H12.7966C13.3489 11.0235 13.7966 11.4712 13.7966 12.0235C13.7966 12.5758 13.3489 13.0235 12.7966 13.0235H10.4171L10.1823 15.4305C10.1287 15.9802 9.63959 16.3823 9.08991 16.3287C8.54024 16.2751 8.13811 15.786 8.19174 15.2363L8.40762 13.0235H5.30286L5.06803 15.4305C5.0144 15.9802 4.52533 16.3823 3.97565 16.3287C3.42598 16.2751 3.02385 15.786 3.07748 15.2363L3.29336 13.0235H1.6665C1.11422 13.0235 0.666504 12.5758 0.666504 12.0235C0.666504 11.4712 1.11422 11.0235 1.6665 11.0235H3.48848L3.82156 7.60945H2.26807C1.71578 7.60945 1.26807 7.16173 1.26807 6.60945C1.26807 6.05716 1.71578 5.60945 2.26807 5.60945H4.01668L4.28073 2.90297C4.33436 2.3533 4.82343 1.95117 5.37311 2.0048C5.92278 2.05842 6.32491 2.5475 6.27128 3.09717L6.02618 5.60945H7.00262Z" fill="#8D99A5"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4224 5.37843C14.4224 6.50754 13.5071 7.42287 12.3779 7.42287C11.2488 7.42287 10.3335 6.50754 10.3335 5.37843C10.3335 4.24931 11.2488 3.33398 12.3779 3.33398C13.5071 3.33398 14.4224 4.24931 14.4224 5.37843ZM15.8496 7.45454C16.2133 6.84764 16.4224 6.13745 16.4224 5.37843C16.4224 3.14474 14.6116 1.33398 12.3779 1.33398C10.1443 1.33398 8.3335 3.14474 8.3335 5.37843C8.3335 7.61211 10.1443 9.42287 12.3779 9.42287C13.1369 9.42287 13.8471 9.21381 14.454 8.85013C14.4853 8.89368 14.5205 8.93528 14.5597 8.97444L16.293 10.7078C16.6835 11.0983 17.3167 11.0983 17.7072 10.7078C18.0977 10.3172 18.0977 9.68408 17.7072 9.29356L15.9739 7.56023C15.9347 7.52107 15.8931 7.48584 15.8496 7.45454Z" fill="#8D99A5"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -1,5 +1,5 @@
|
||||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
<circle cx="8" cy="8" r="8" fill="#737D8C" style="mix-blend-mode:multiply"/>
|
<circle cx="8" cy="8" r="8" fill="#FF4B55"/>
|
||||||
<rect x="7" y="3" width="2" height="6" rx="1" fill="white"/>
|
<rect x="7" y="3" width="2" height="6" rx="1" fill="white"/>
|
||||||
<rect x="7" y="11" width="2" height="2" rx="1" fill="white"/>
|
<rect x="7" y="11" width="2" height="2" rx="1" fill="white"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 303 B After Width: | Height: | Size: 283 B |
3
res/img/voip/mic-on-mask.svg
Normal file
3
res/img/voip/mic-on-mask.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.09999 4.15C6.09999 1.99609 7.84608 0.25 9.99999 0.25C12.1539 0.25 13.9 1.99609 13.9 4.15V9.98254C13.9 12.1365 12.1539 13.8825 9.99999 13.8825C7.84608 13.8825 6.09999 12.1365 6.09999 9.98254V4.15ZM3.1748 8.73755C3.86516 8.73755 4.4248 9.29719 4.4248 9.98755C4.4248 13.0574 6.91483 15.5493 9.9915 15.5538C9.99433 15.5538 9.99717 15.5538 10 15.5538C10.0028 15.5538 10.0056 15.5538 10.0084 15.5538C13.085 15.5492 15.5748 13.0573 15.5748 9.98755C15.5748 9.29719 16.1344 8.73755 16.8248 8.73755C17.5152 8.73755 18.0748 9.29719 18.0748 9.98755C18.0748 14.0189 15.115 17.3576 11.25 17.9577V18.7513C11.25 19.4416 10.6904 20.0013 10 20.0013C9.30964 20.0013 8.75 19.4416 8.75 18.7513V17.9578C4.88483 17.3578 1.9248 14.0191 1.9248 9.98755C1.9248 9.29719 2.48445 8.73755 3.1748 8.73755Z" fill="#C1C6CD"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 951 B |
|
@ -123,7 +123,6 @@ $roomsublist-divider-color: $primary-fg-color;
|
||||||
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #3e444c 0%, #3e444c00 100%);
|
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #3e444c 0%, #3e444c00 100%);
|
||||||
|
|
||||||
$groupFilterPanel-divider-color: $roomlist-header-color;
|
$groupFilterPanel-divider-color: $roomlist-header-color;
|
||||||
$space-button-outline-color: rgba(141, 151, 165, 0.2);
|
|
||||||
|
|
||||||
$roomtile-preview-color: $secondary-fg-color;
|
$roomtile-preview-color: $secondary-fg-color;
|
||||||
$roomtile-default-badge-bg-color: #61708b;
|
$roomtile-default-badge-bg-color: #61708b;
|
||||||
|
|
|
@ -120,7 +120,6 @@ $roomsublist-divider-color: $primary-fg-color;
|
||||||
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #3e444c 0%, #3e444c00 100%);
|
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #3e444c 0%, #3e444c00 100%);
|
||||||
|
|
||||||
$groupFilterPanel-divider-color: $roomlist-header-color;
|
$groupFilterPanel-divider-color: $roomlist-header-color;
|
||||||
$space-button-outline-color: rgba(141, 151, 165, 0.2);
|
|
||||||
|
|
||||||
$roomtile-preview-color: #9e9e9e;
|
$roomtile-preview-color: #9e9e9e;
|
||||||
$roomtile-default-badge-bg-color: #61708b;
|
$roomtile-default-badge-bg-color: #61708b;
|
||||||
|
|
|
@ -187,7 +187,12 @@ $roomsublist-divider-color: $primary-fg-color;
|
||||||
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #ffffff 0%, #ffffff00 100%);
|
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #ffffff 0%, #ffffff00 100%);
|
||||||
|
|
||||||
$groupFilterPanel-divider-color: $roomlist-header-color;
|
$groupFilterPanel-divider-color: $roomlist-header-color;
|
||||||
$space-button-outline-color: #E3E8F0;
|
|
||||||
|
$voice-record-stop-border-color: #E3E8F0;
|
||||||
|
$voice-record-stop-symbol-color: $warning-color;
|
||||||
|
$voice-record-waveform-bg-color: #E3E8F0;
|
||||||
|
$voice-record-waveform-fg-color: $muted-fg-color;
|
||||||
|
$voice-record-live-circle-color: $warning-color;
|
||||||
|
|
||||||
$roomtile-preview-color: #9e9e9e;
|
$roomtile-preview-color: #9e9e9e;
|
||||||
$roomtile-default-badge-bg-color: #61708b;
|
$roomtile-default-badge-bg-color: #61708b;
|
||||||
|
|
|
@ -178,7 +178,12 @@ $roomsublist-divider-color: $primary-fg-color;
|
||||||
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #ffffff 0%, #ffffff00 100%);
|
$roomsublist-skeleton-ui-bg: linear-gradient(180deg, #ffffff 0%, #ffffff00 100%);
|
||||||
|
|
||||||
$groupFilterPanel-divider-color: $roomlist-header-color;
|
$groupFilterPanel-divider-color: $roomlist-header-color;
|
||||||
$space-button-outline-color: #E3E8F0;
|
|
||||||
|
$voice-record-stop-border-color: #E3E8F0;
|
||||||
|
$voice-record-stop-symbol-color: $warning-color;
|
||||||
|
$voice-record-waveform-bg-color: #E3E8F0;
|
||||||
|
$voice-record-waveform-fg-color: $muted-fg-color;
|
||||||
|
$voice-record-live-circle-color: $warning-color;
|
||||||
|
|
||||||
$roomtile-preview-color: $secondary-fg-color;
|
$roomtile-preview-color: $secondary-fg-color;
|
||||||
$roomtile-default-badge-bg-color: #61708b;
|
$roomtile-default-badge-bg-color: #61708b;
|
||||||
|
|
2
src/@types/global.d.ts
vendored
2
src/@types/global.d.ts
vendored
|
@ -39,6 +39,7 @@ import {ModalWidgetStore} from "../stores/ModalWidgetStore";
|
||||||
import { WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
|
import { WidgetLayoutStore } from "../stores/widgets/WidgetLayoutStore";
|
||||||
import VoipUserMapper from "../VoipUserMapper";
|
import VoipUserMapper from "../VoipUserMapper";
|
||||||
import {SpaceStoreClass} from "../stores/SpaceStore";
|
import {SpaceStoreClass} from "../stores/SpaceStore";
|
||||||
|
import {VoiceRecorder} from "../voice/VoiceRecorder";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
|
@ -70,6 +71,7 @@ declare global {
|
||||||
mxModalWidgetStore: ModalWidgetStore;
|
mxModalWidgetStore: ModalWidgetStore;
|
||||||
mxVoipUserMapper: VoipUserMapper;
|
mxVoipUserMapper: VoipUserMapper;
|
||||||
mxSpaceStore: SpaceStoreClass;
|
mxSpaceStore: SpaceStoreClass;
|
||||||
|
mxVoiceRecorder: typeof VoiceRecorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Document {
|
interface Document {
|
||||||
|
|
|
@ -212,6 +212,18 @@ export default abstract class BasePlatform {
|
||||||
throw new Error("Unimplemented");
|
throw new Error("Unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supportsWarnBeforeExit(): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async shouldWarnBeforeExit(): Promise<boolean> {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async setWarnBeforeExit(enabled: boolean): Promise<void> {
|
||||||
|
throw new Error("Unimplemented");
|
||||||
|
}
|
||||||
|
|
||||||
supportsAutoHideMenuBar(): boolean {
|
supportsAutoHideMenuBar(): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,9 @@ export enum PlaceCallType {
|
||||||
|
|
||||||
export default class CallHandler {
|
export default class CallHandler {
|
||||||
private calls = new Map<string, MatrixCall>(); // roomId -> call
|
private calls = new Map<string, MatrixCall>(); // roomId -> call
|
||||||
|
// Calls started as an attended transfer, ie. with the intention of transferring another
|
||||||
|
// call with a different party to this one.
|
||||||
|
private transferees = new Map<string, MatrixCall>(); // callId (target) -> call (transferee)
|
||||||
private audioPromises = new Map<AudioID, Promise<void>>();
|
private audioPromises = new Map<AudioID, Promise<void>>();
|
||||||
private dispatcherRef: string = null;
|
private dispatcherRef: string = null;
|
||||||
private supportsPstnProtocol = null;
|
private supportsPstnProtocol = null;
|
||||||
|
@ -310,6 +313,10 @@ export default class CallHandler {
|
||||||
return callsNotInThatRoom;
|
return callsNotInThatRoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTransfereeForCallId(callId: string): MatrixCall {
|
||||||
|
return this.transferees[callId];
|
||||||
|
}
|
||||||
|
|
||||||
play(audioId: AudioID) {
|
play(audioId: AudioID) {
|
||||||
// TODO: Attach an invisible element for this instead
|
// TODO: Attach an invisible element for this instead
|
||||||
// which listens?
|
// which listens?
|
||||||
|
@ -599,9 +606,7 @@ export default class CallHandler {
|
||||||
}, null, true);
|
}, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async placeCall(
|
private async placeCall(roomId: string, type: PlaceCallType, transferee: MatrixCall) {
|
||||||
roomId: string, type: PlaceCallType,
|
|
||||||
) {
|
|
||||||
Analytics.trackEvent('voip', 'placeCall', 'type', type);
|
Analytics.trackEvent('voip', 'placeCall', 'type', type);
|
||||||
CountlyAnalytics.instance.trackStartCall(roomId, type === PlaceCallType.Video, false);
|
CountlyAnalytics.instance.trackStartCall(roomId, type === PlaceCallType.Video, false);
|
||||||
|
|
||||||
|
@ -613,6 +618,9 @@ export default class CallHandler {
|
||||||
const call = createNewMatrixCall(MatrixClientPeg.get(), mappedRoomId);
|
const call = createNewMatrixCall(MatrixClientPeg.get(), mappedRoomId);
|
||||||
|
|
||||||
this.calls.set(roomId, call);
|
this.calls.set(roomId, call);
|
||||||
|
if (transferee) {
|
||||||
|
this.transferees[call.callId] = transferee;
|
||||||
|
}
|
||||||
|
|
||||||
this.setCallListeners(call);
|
this.setCallListeners(call);
|
||||||
|
|
||||||
|
@ -696,7 +704,7 @@ export default class CallHandler {
|
||||||
} else if (members.length === 2) {
|
} else if (members.length === 2) {
|
||||||
console.info(`Place ${payload.type} call in ${payload.room_id}`);
|
console.info(`Place ${payload.type} call in ${payload.room_id}`);
|
||||||
|
|
||||||
this.placeCall(payload.room_id, payload.type);
|
this.placeCall(payload.room_id, payload.type, payload.transferee);
|
||||||
} else { // > 2
|
} else { // > 2
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: "place_conference_call",
|
action: "place_conference_call",
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Matrix from 'matrix-js-sdk';
|
|
||||||
import SettingsStore from "./settings/SettingsStore";
|
import SettingsStore from "./settings/SettingsStore";
|
||||||
import {SettingLevel} from "./settings/SettingLevel";
|
import {SettingLevel} from "./settings/SettingLevel";
|
||||||
|
import {setMatrixCallAudioInput, setMatrixCallVideoInput} from "matrix-js-sdk/src/matrix";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hasAnyLabeledDevices: async function() {
|
hasAnyLabeledDevices: async function() {
|
||||||
|
@ -53,8 +53,8 @@ export default {
|
||||||
const audioDeviceId = SettingsStore.getValue("webrtc_audioinput");
|
const audioDeviceId = SettingsStore.getValue("webrtc_audioinput");
|
||||||
const videoDeviceId = SettingsStore.getValue("webrtc_videoinput");
|
const videoDeviceId = SettingsStore.getValue("webrtc_videoinput");
|
||||||
|
|
||||||
Matrix.setMatrixCallAudioInput(audioDeviceId);
|
setMatrixCallAudioInput(audioDeviceId);
|
||||||
Matrix.setMatrixCallVideoInput(videoDeviceId);
|
setMatrixCallVideoInput(videoDeviceId);
|
||||||
},
|
},
|
||||||
|
|
||||||
setAudioOutput: function(deviceId) {
|
setAudioOutput: function(deviceId) {
|
||||||
|
@ -63,12 +63,12 @@ export default {
|
||||||
|
|
||||||
setAudioInput: function(deviceId) {
|
setAudioInput: function(deviceId) {
|
||||||
SettingsStore.setValue("webrtc_audioinput", null, SettingLevel.DEVICE, deviceId);
|
SettingsStore.setValue("webrtc_audioinput", null, SettingLevel.DEVICE, deviceId);
|
||||||
Matrix.setMatrixCallAudioInput(deviceId);
|
setMatrixCallAudioInput(deviceId);
|
||||||
},
|
},
|
||||||
|
|
||||||
setVideoInput: function(deviceId) {
|
setVideoInput: function(deviceId) {
|
||||||
SettingsStore.setValue("webrtc_videoinput", null, SettingLevel.DEVICE, deviceId);
|
SettingsStore.setValue("webrtc_videoinput", null, SettingLevel.DEVICE, deviceId);
|
||||||
Matrix.setMatrixCallVideoInput(deviceId);
|
setMatrixCallVideoInput(deviceId);
|
||||||
},
|
},
|
||||||
|
|
||||||
getAudioOutput: function() {
|
getAudioOutput: function() {
|
||||||
|
|
|
@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { createClient, SERVICE_TYPES } from 'matrix-js-sdk';
|
import { SERVICE_TYPES } from 'matrix-js-sdk/src/service-types';
|
||||||
|
import { createClient } from 'matrix-js-sdk/src/matrix';
|
||||||
|
|
||||||
import {MatrixClientPeg} from './MatrixClientPeg';
|
import {MatrixClientPeg} from './MatrixClientPeg';
|
||||||
import Modal from './Modal';
|
import Modal from './Modal';
|
||||||
|
|
407
src/KeyBindingsDefaults.ts
Normal file
407
src/KeyBindingsDefaults.ts
Normal file
|
@ -0,0 +1,407 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 Clemens Zeidler
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AutocompleteAction, IKeyBindingsProvider, KeyBinding, MessageComposerAction, NavigationAction, RoomAction,
|
||||||
|
RoomListAction } from "./KeyBindingsManager";
|
||||||
|
import { isMac, Key } from "./Keyboard";
|
||||||
|
import SettingsStore from "./settings/SettingsStore";
|
||||||
|
|
||||||
|
const messageComposerBindings = (): KeyBinding<MessageComposerAction>[] => {
|
||||||
|
const bindings: KeyBinding<MessageComposerAction>[] = [
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.SelectPrevSendHistory,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_UP,
|
||||||
|
altKey: true,
|
||||||
|
ctrlKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.SelectNextSendHistory,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_DOWN,
|
||||||
|
altKey: true,
|
||||||
|
ctrlKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.EditPrevMessage,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_UP,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.EditNextMessage,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_DOWN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.CancelEditing,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ESCAPE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.FormatBold,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.B,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.FormatItalics,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.I,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.FormatQuote,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.GREATER_THAN,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.EditUndo,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.Z,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.MoveCursorToStart,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.HOME,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: MessageComposerAction.MoveCursorToEnd,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.END,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
if (isMac) {
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.EditRedo,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.Z,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.EditRedo,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.Y,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (SettingsStore.getValue('MessageComposerInput.ctrlEnterToSend')) {
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.Send,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ENTER,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.NewLine,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ENTER,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.Send,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ENTER,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.NewLine,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ENTER,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (isMac) {
|
||||||
|
bindings.push({
|
||||||
|
action: MessageComposerAction.NewLine,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ENTER,
|
||||||
|
altKey: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
const autocompleteBindings = (): KeyBinding<AutocompleteAction>[] => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.CompleteOrNextSelection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.TAB,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.CompleteOrNextSelection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.TAB,
|
||||||
|
ctrlKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.CompleteOrPrevSelection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.TAB,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.CompleteOrPrevSelection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.TAB,
|
||||||
|
ctrlKey: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.Cancel,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ESCAPE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.PrevSelection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_UP,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: AutocompleteAction.NextSelection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_DOWN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
const roomListBindings = (): KeyBinding<RoomListAction>[] => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
action: RoomListAction.ClearSearch,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ESCAPE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomListAction.PrevRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_UP,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomListAction.NextRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_DOWN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomListAction.SelectRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ENTER,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomListAction.CollapseSection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_LEFT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomListAction.ExpandSection,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_RIGHT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
const roomBindings = (): KeyBinding<RoomAction>[] => {
|
||||||
|
const bindings: KeyBinding<RoomAction>[] = [
|
||||||
|
{
|
||||||
|
action: RoomAction.ScrollUp,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.PAGE_UP,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomAction.RoomScrollDown,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.PAGE_DOWN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomAction.DismissReadMarker,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ESCAPE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomAction.JumpToOldestUnread,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.PAGE_UP,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomAction.UploadFile,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.U,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomAction.JumpToFirstMessage,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.HOME,
|
||||||
|
ctrlKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: RoomAction.JumpToLatestMessage,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.END,
|
||||||
|
ctrlKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
if (SettingsStore.getValue('ctrlFForSearch')) {
|
||||||
|
bindings.push({
|
||||||
|
action: RoomAction.FocusSearch,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.F,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
const navigationBindings = (): KeyBinding<NavigationAction>[] => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
action: NavigationAction.FocusRoomSearch,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.K,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.ToggleRoomSidePanel,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.PERIOD,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.ToggleUserMenu,
|
||||||
|
// Ideally this would be CTRL+P for "Profile", but that's
|
||||||
|
// taken by the print dialog. CTRL+I for "Information"
|
||||||
|
// was previously chosen but conflicted with italics in
|
||||||
|
// composer, so CTRL+` it is
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.BACKTICK,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.ToggleShortCutDialog,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.SLASH,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.ToggleShortCutDialog,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.SLASH,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.GoToHome,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.H,
|
||||||
|
ctrlOrCmd: true,
|
||||||
|
altKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
action: NavigationAction.SelectPrevRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_UP,
|
||||||
|
altKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.SelectNextRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_DOWN,
|
||||||
|
altKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.SelectPrevUnreadRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_UP,
|
||||||
|
altKey: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
action: NavigationAction.SelectNextUnreadRoom,
|
||||||
|
keyCombo: {
|
||||||
|
key: Key.ARROW_DOWN,
|
||||||
|
altKey: true,
|
||||||
|
shiftKey: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultBindingsProvider: IKeyBindingsProvider = {
|
||||||
|
getMessageComposerBindings: messageComposerBindings,
|
||||||
|
getAutocompleteBindings: autocompleteBindings,
|
||||||
|
getRoomListBindings: roomListBindings,
|
||||||
|
getRoomBindings: roomBindings,
|
||||||
|
getNavigationBindings: navigationBindings,
|
||||||
|
}
|
271
src/KeyBindingsManager.ts
Normal file
271
src/KeyBindingsManager.ts
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 Clemens Zeidler
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { defaultBindingsProvider } from './KeyBindingsDefaults';
|
||||||
|
import { isMac } from './Keyboard';
|
||||||
|
|
||||||
|
/** Actions for the chat message composer component */
|
||||||
|
export enum MessageComposerAction {
|
||||||
|
/** Send a message */
|
||||||
|
Send = 'Send',
|
||||||
|
/** Go backwards through the send history and use the message in composer view */
|
||||||
|
SelectPrevSendHistory = 'SelectPrevSendHistory',
|
||||||
|
/** Go forwards through the send history */
|
||||||
|
SelectNextSendHistory = 'SelectNextSendHistory',
|
||||||
|
/** Start editing the user's last sent message */
|
||||||
|
EditPrevMessage = 'EditPrevMessage',
|
||||||
|
/** Start editing the user's next sent message */
|
||||||
|
EditNextMessage = 'EditNextMessage',
|
||||||
|
/** Cancel editing a message or cancel replying to a message */
|
||||||
|
CancelEditing = 'CancelEditing',
|
||||||
|
|
||||||
|
/** Set bold format the current selection */
|
||||||
|
FormatBold = 'FormatBold',
|
||||||
|
/** Set italics format the current selection */
|
||||||
|
FormatItalics = 'FormatItalics',
|
||||||
|
/** Format the current selection as quote */
|
||||||
|
FormatQuote = 'FormatQuote',
|
||||||
|
/** Undo the last editing */
|
||||||
|
EditUndo = 'EditUndo',
|
||||||
|
/** Redo editing */
|
||||||
|
EditRedo = 'EditRedo',
|
||||||
|
/** Insert new line */
|
||||||
|
NewLine = 'NewLine',
|
||||||
|
/** Move the cursor to the start of the message */
|
||||||
|
MoveCursorToStart = 'MoveCursorToStart',
|
||||||
|
/** Move the cursor to the end of the message */
|
||||||
|
MoveCursorToEnd = 'MoveCursorToEnd',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Actions for text editing autocompletion */
|
||||||
|
export enum AutocompleteAction {
|
||||||
|
/**
|
||||||
|
* Select previous selection or, if the autocompletion window is not shown, open the window and select the first
|
||||||
|
* selection.
|
||||||
|
*/
|
||||||
|
CompleteOrPrevSelection = 'ApplySelection',
|
||||||
|
/** Select next selection or, if the autocompletion window is not shown, open it and select the first selection */
|
||||||
|
CompleteOrNextSelection = 'CompleteOrNextSelection',
|
||||||
|
/** Move to the previous autocomplete selection */
|
||||||
|
PrevSelection = 'PrevSelection',
|
||||||
|
/** Move to the next autocomplete selection */
|
||||||
|
NextSelection = 'NextSelection',
|
||||||
|
/** Close the autocompletion window */
|
||||||
|
Cancel = 'Cancel',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Actions for the room list sidebar */
|
||||||
|
export enum RoomListAction {
|
||||||
|
/** Clear room list filter field */
|
||||||
|
ClearSearch = 'ClearSearch',
|
||||||
|
/** Navigate up/down in the room list */
|
||||||
|
PrevRoom = 'PrevRoom',
|
||||||
|
/** Navigate down in the room list */
|
||||||
|
NextRoom = 'NextRoom',
|
||||||
|
/** Select room from the room list */
|
||||||
|
SelectRoom = 'SelectRoom',
|
||||||
|
/** Collapse room list section */
|
||||||
|
CollapseSection = 'CollapseSection',
|
||||||
|
/** Expand room list section, if already expanded, jump to first room in the selection */
|
||||||
|
ExpandSection = 'ExpandSection',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Actions for the current room view */
|
||||||
|
export enum RoomAction {
|
||||||
|
/** Scroll up in the timeline */
|
||||||
|
ScrollUp = 'ScrollUp',
|
||||||
|
/** Scroll down in the timeline */
|
||||||
|
RoomScrollDown = 'RoomScrollDown',
|
||||||
|
/** Dismiss read marker and jump to bottom */
|
||||||
|
DismissReadMarker = 'DismissReadMarker',
|
||||||
|
/** Jump to oldest unread message */
|
||||||
|
JumpToOldestUnread = 'JumpToOldestUnread',
|
||||||
|
/** Upload a file */
|
||||||
|
UploadFile = 'UploadFile',
|
||||||
|
/** Focus search message in a room (must be enabled) */
|
||||||
|
FocusSearch = 'FocusSearch',
|
||||||
|
/** Jump to the first (downloaded) message in the room */
|
||||||
|
JumpToFirstMessage = 'JumpToFirstMessage',
|
||||||
|
/** Jump to the latest message in the room */
|
||||||
|
JumpToLatestMessage = 'JumpToLatestMessage',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Actions for navigating do various menus, dialogs or screens */
|
||||||
|
export enum NavigationAction {
|
||||||
|
/** Jump to room search (search for a room) */
|
||||||
|
FocusRoomSearch = 'FocusRoomSearch',
|
||||||
|
/** Toggle the room side panel */
|
||||||
|
ToggleRoomSidePanel = 'ToggleRoomSidePanel',
|
||||||
|
/** Toggle the user menu */
|
||||||
|
ToggleUserMenu = 'ToggleUserMenu',
|
||||||
|
/** Toggle the short cut help dialog */
|
||||||
|
ToggleShortCutDialog = 'ToggleShortCutDialog',
|
||||||
|
/** Got to the Element home screen */
|
||||||
|
GoToHome = 'GoToHome',
|
||||||
|
/** Select prev room */
|
||||||
|
SelectPrevRoom = 'SelectPrevRoom',
|
||||||
|
/** Select next room */
|
||||||
|
SelectNextRoom = 'SelectNextRoom',
|
||||||
|
/** Select prev room with unread messages */
|
||||||
|
SelectPrevUnreadRoom = 'SelectPrevUnreadRoom',
|
||||||
|
/** Select next room with unread messages */
|
||||||
|
SelectNextUnreadRoom = 'SelectNextUnreadRoom',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represent a key combination.
|
||||||
|
*
|
||||||
|
* The combo is evaluated strictly, i.e. the KeyboardEvent must match exactly what is specified in the KeyCombo.
|
||||||
|
*/
|
||||||
|
export type KeyCombo = {
|
||||||
|
key?: string;
|
||||||
|
|
||||||
|
/** On PC: ctrl is pressed; on Mac: meta is pressed */
|
||||||
|
ctrlOrCmd?: boolean;
|
||||||
|
|
||||||
|
altKey?: boolean;
|
||||||
|
ctrlKey?: boolean;
|
||||||
|
metaKey?: boolean;
|
||||||
|
shiftKey?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type KeyBinding<T extends string> = {
|
||||||
|
action: T;
|
||||||
|
keyCombo: KeyCombo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to check if a KeyboardEvent matches a KeyCombo
|
||||||
|
*
|
||||||
|
* Note, this method is only exported for testing.
|
||||||
|
*/
|
||||||
|
export function isKeyComboMatch(ev: KeyboardEvent | React.KeyboardEvent, combo: KeyCombo, onMac: boolean): boolean {
|
||||||
|
if (combo.key !== undefined) {
|
||||||
|
// When shift is pressed, letters are returned as upper case chars. In this case do a lower case comparison.
|
||||||
|
// This works for letter combos such as shift + U as well for none letter combos such as shift + Escape.
|
||||||
|
// If shift is not pressed, the toLowerCase conversion can be avoided.
|
||||||
|
if (ev.shiftKey) {
|
||||||
|
if (ev.key.toLowerCase() !== combo.key.toLowerCase()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (ev.key !== combo.key) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const comboCtrl = combo.ctrlKey ?? false;
|
||||||
|
const comboAlt = combo.altKey ?? false;
|
||||||
|
const comboShift = combo.shiftKey ?? false;
|
||||||
|
const comboMeta = combo.metaKey ?? false;
|
||||||
|
// Tests mock events may keep the modifiers undefined; convert them to booleans
|
||||||
|
const evCtrl = ev.ctrlKey ?? false;
|
||||||
|
const evAlt = ev.altKey ?? false;
|
||||||
|
const evShift = ev.shiftKey ?? false;
|
||||||
|
const evMeta = ev.metaKey ?? false;
|
||||||
|
// When ctrlOrCmd is set, the keys need do evaluated differently on PC and Mac
|
||||||
|
if (combo.ctrlOrCmd) {
|
||||||
|
if (onMac) {
|
||||||
|
if (!evMeta
|
||||||
|
|| evCtrl !== comboCtrl
|
||||||
|
|| evAlt !== comboAlt
|
||||||
|
|| evShift !== comboShift) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!evCtrl
|
||||||
|
|| evMeta !== comboMeta
|
||||||
|
|| evAlt !== comboAlt
|
||||||
|
|| evShift !== comboShift) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (evMeta !== comboMeta
|
||||||
|
|| evCtrl !== comboCtrl
|
||||||
|
|| evAlt !== comboAlt
|
||||||
|
|| evShift !== comboShift) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type KeyBindingGetter<T extends string> = () => KeyBinding<T>[];
|
||||||
|
|
||||||
|
export interface IKeyBindingsProvider {
|
||||||
|
getMessageComposerBindings: KeyBindingGetter<MessageComposerAction>;
|
||||||
|
getAutocompleteBindings: KeyBindingGetter<AutocompleteAction>;
|
||||||
|
getRoomListBindings: KeyBindingGetter<RoomListAction>;
|
||||||
|
getRoomBindings: KeyBindingGetter<RoomAction>;
|
||||||
|
getNavigationBindings: KeyBindingGetter<NavigationAction>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class KeyBindingsManager {
|
||||||
|
/**
|
||||||
|
* List of key bindings providers.
|
||||||
|
*
|
||||||
|
* Key bindings from the first provider(s) in the list will have precedence over key bindings from later providers.
|
||||||
|
*
|
||||||
|
* To overwrite the default key bindings add a new providers before the default provider, e.g. a provider for
|
||||||
|
* customized key bindings.
|
||||||
|
*/
|
||||||
|
bindingsProviders: IKeyBindingsProvider[] = [
|
||||||
|
defaultBindingsProvider,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a matching KeyAction for a given KeyboardEvent
|
||||||
|
*/
|
||||||
|
private getAction<T extends string>(getters: KeyBindingGetter<T>[], ev: KeyboardEvent | React.KeyboardEvent)
|
||||||
|
: T | undefined {
|
||||||
|
for (const getter of getters) {
|
||||||
|
const bindings = getter();
|
||||||
|
const binding = bindings.find(it => isKeyComboMatch(ev, it.keyCombo, isMac));
|
||||||
|
if (binding) {
|
||||||
|
return binding.action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMessageComposerAction(ev: KeyboardEvent | React.KeyboardEvent): MessageComposerAction | undefined {
|
||||||
|
return this.getAction(this.bindingsProviders.map(it => it.getMessageComposerBindings), ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
getAutocompleteAction(ev: KeyboardEvent | React.KeyboardEvent): AutocompleteAction | undefined {
|
||||||
|
return this.getAction(this.bindingsProviders.map(it => it.getAutocompleteBindings), ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRoomListAction(ev: KeyboardEvent | React.KeyboardEvent): RoomListAction | undefined {
|
||||||
|
return this.getAction(this.bindingsProviders.map(it => it.getRoomListBindings), ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRoomAction(ev: KeyboardEvent | React.KeyboardEvent): RoomAction | undefined {
|
||||||
|
return this.getAction(this.bindingsProviders.map(it => it.getRoomBindings), ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
getNavigationAction(ev: KeyboardEvent | React.KeyboardEvent): NavigationAction | undefined {
|
||||||
|
return this.getAction(this.bindingsProviders.map(it => it.getNavigationBindings), ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const manager = new KeyBindingsManager();
|
||||||
|
|
||||||
|
export function getKeyBindingsManager(): KeyBindingsManager {
|
||||||
|
return manager;
|
||||||
|
}
|
|
@ -17,8 +17,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @ts-ignore - XXX: tsc doesn't like this: our js-sdk imports are complex so this isn't surprising
|
import { createClient } from 'matrix-js-sdk/src/matrix';
|
||||||
import Matrix from 'matrix-js-sdk';
|
|
||||||
import { InvalidStoreError } from "matrix-js-sdk/src/errors";
|
import { InvalidStoreError } from "matrix-js-sdk/src/errors";
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import {decryptAES, encryptAES} from "matrix-js-sdk/src/crypto/aes";
|
import {decryptAES, encryptAES} from "matrix-js-sdk/src/crypto/aes";
|
||||||
|
@ -219,7 +218,7 @@ export function attemptTokenLogin(
|
||||||
button: _t("Try again"),
|
button: _t("Try again"),
|
||||||
onFinished: tryAgain => {
|
onFinished: tryAgain => {
|
||||||
if (tryAgain) {
|
if (tryAgain) {
|
||||||
const cli = Matrix.createClient({
|
const cli = createClient({
|
||||||
baseUrl: homeserver,
|
baseUrl: homeserver,
|
||||||
idBaseUrl: identityServer,
|
idBaseUrl: identityServer,
|
||||||
});
|
});
|
||||||
|
@ -276,7 +275,7 @@ function registerAsGuest(
|
||||||
console.log(`Doing guest login on ${hsUrl}`);
|
console.log(`Doing guest login on ${hsUrl}`);
|
||||||
|
|
||||||
// create a temporary MatrixClient to do the login
|
// create a temporary MatrixClient to do the login
|
||||||
const client = Matrix.createClient({
|
const client = createClient({
|
||||||
baseUrl: hsUrl,
|
baseUrl: hsUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// @ts-ignore - XXX: tsc doesn't like this: our js-sdk imports are complex so this isn't surprising
|
// @ts-ignore - XXX: tsc doesn't like this: our js-sdk imports are complex so this isn't surprising
|
||||||
import Matrix from "matrix-js-sdk";
|
import {createClient} from "matrix-js-sdk/src/matrix";
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import { IMatrixClientCreds } from "./MatrixClientPeg";
|
import { IMatrixClientCreds } from "./MatrixClientPeg";
|
||||||
import SecurityCustomisations from "./customisations/Security";
|
import SecurityCustomisations from "./customisations/Security";
|
||||||
|
@ -115,7 +115,7 @@ export default class Login {
|
||||||
*/
|
*/
|
||||||
public createTemporaryClient(): MatrixClient {
|
public createTemporaryClient(): MatrixClient {
|
||||||
if (this.tempClient) return this.tempClient; // use memoization
|
if (this.tempClient) return this.tempClient; // use memoization
|
||||||
return this.tempClient = Matrix.createClient({
|
return this.tempClient = createClient({
|
||||||
baseUrl: this.hsUrl,
|
baseUrl: this.hsUrl,
|
||||||
idBaseUrl: this.isUrl,
|
idBaseUrl: this.isUrl,
|
||||||
});
|
});
|
||||||
|
@ -210,7 +210,7 @@ export async function sendLoginRequest(
|
||||||
loginType: string,
|
loginType: string,
|
||||||
loginParams: ILoginParams,
|
loginParams: ILoginParams,
|
||||||
): Promise<IMatrixClientCreds> {
|
): Promise<IMatrixClientCreds> {
|
||||||
const client = Matrix.createClient({
|
const client = createClient({
|
||||||
baseUrl: hsUrl,
|
baseUrl: hsUrl,
|
||||||
idBaseUrl: isUrl,
|
idBaseUrl: isUrl,
|
||||||
});
|
});
|
||||||
|
|
|
@ -296,10 +296,11 @@ class _MatrixClientPeg implements IMatrixClientPeg {
|
||||||
// These are always installed regardless of the labs flag so that
|
// These are always installed regardless of the labs flag so that
|
||||||
// cross-signing features can toggle on without reloading and also be
|
// cross-signing features can toggle on without reloading and also be
|
||||||
// accessed immediately after login.
|
// accessed immediately after login.
|
||||||
const customisedCallbacks = {
|
Object.assign(opts.cryptoCallbacks, crossSigningCallbacks);
|
||||||
getDehydrationKey: SecurityCustomisations.getDehydrationKey,
|
if (SecurityCustomisations.getDehydrationKey) {
|
||||||
};
|
opts.cryptoCallbacks.getDehydrationKey =
|
||||||
Object.assign(opts.cryptoCallbacks, crossSigningCallbacks, customisedCallbacks);
|
SecurityCustomisations.getDehydrationKey;
|
||||||
|
}
|
||||||
|
|
||||||
this.matrixClient = createMatrixClient(opts);
|
this.matrixClient = createMatrixClient(opts);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Matrix from 'matrix-js-sdk';
|
import { createClient } from 'matrix-js-sdk/src/matrix';
|
||||||
import { _t } from './languageHandler';
|
import { _t } from './languageHandler';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ export default class PasswordReset {
|
||||||
* @param {string} identityUrl The URL to the IS which has linked the email -> mxid mapping.
|
* @param {string} identityUrl The URL to the IS which has linked the email -> mxid mapping.
|
||||||
*/
|
*/
|
||||||
constructor(homeserverUrl, identityUrl) {
|
constructor(homeserverUrl, identityUrl) {
|
||||||
this.client = Matrix.createClient({
|
this.client = createClient({
|
||||||
baseUrl: homeserverUrl,
|
baseUrl: homeserverUrl,
|
||||||
idBaseUrl: identityUrl,
|
idBaseUrl: identityUrl,
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
|
|
||||||
import {MatrixClientPeg} from './MatrixClientPeg';
|
import {MatrixClientPeg} from './MatrixClientPeg';
|
||||||
import dis from './dispatcher/dispatcher';
|
import dis from './dispatcher/dispatcher';
|
||||||
import { EventStatus } from 'matrix-js-sdk';
|
import { EventStatus } from 'matrix-js-sdk/src/models/event';
|
||||||
|
|
||||||
export default class Resend {
|
export default class Resend {
|
||||||
static resendUnsentEvents(room) {
|
static resendUnsentEvents(room) {
|
||||||
|
|
|
@ -49,11 +49,12 @@ export function showStartChatInviteDialog(initialText) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showRoomInviteDialog(roomId) {
|
export function showRoomInviteDialog(roomId, initialText = "") {
|
||||||
// This dialog handles the room creation internally - we don't need to worry about it.
|
// This dialog handles the room creation internally - we don't need to worry about it.
|
||||||
Modal.createTrackedDialog(
|
Modal.createTrackedDialog(
|
||||||
"Invite Users", "", InviteDialog, {
|
"Invite Users", "", InviteDialog, {
|
||||||
kind: KIND_INVITE,
|
kind: KIND_INVITE,
|
||||||
|
initialText,
|
||||||
roomId,
|
roomId,
|
||||||
},
|
},
|
||||||
/*className=*/null, /*isPriority=*/false, /*isStatic=*/true,
|
/*className=*/null, /*isPriority=*/false, /*isStatic=*/true,
|
||||||
|
|
|
@ -21,9 +21,9 @@ import { Service, startTermsFlow, TermsNotSignedError } from './Terms';
|
||||||
import {MatrixClientPeg} from "./MatrixClientPeg";
|
import {MatrixClientPeg} from "./MatrixClientPeg";
|
||||||
import request from "browser-request";
|
import request from "browser-request";
|
||||||
|
|
||||||
import * as Matrix from 'matrix-js-sdk';
|
|
||||||
import SdkConfig from "./SdkConfig";
|
import SdkConfig from "./SdkConfig";
|
||||||
import {WidgetType} from "./widgets/WidgetType";
|
import {WidgetType} from "./widgets/WidgetType";
|
||||||
|
import {SERVICE_TYPES} from "matrix-js-sdk/src/service-types";
|
||||||
|
|
||||||
// The version of the integration manager API we're intending to work with
|
// The version of the integration manager API we're intending to work with
|
||||||
const imApiVersion = "1.1";
|
const imApiVersion = "1.1";
|
||||||
|
@ -153,7 +153,7 @@ export default class ScalarAuthClient {
|
||||||
parsedImRestUrl.path = '';
|
parsedImRestUrl.path = '';
|
||||||
parsedImRestUrl.pathname = '';
|
parsedImRestUrl.pathname = '';
|
||||||
return startTermsFlow([new Service(
|
return startTermsFlow([new Service(
|
||||||
Matrix.SERVICE_TYPES.IM,
|
SERVICE_TYPES.IM,
|
||||||
parsedImRestUrl.format(),
|
parsedImRestUrl.format(),
|
||||||
token,
|
token,
|
||||||
)], this.termsInteractionCallback).then(() => {
|
)], this.termsInteractionCallback).then(() => {
|
||||||
|
|
|
@ -237,7 +237,7 @@ Example:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {MatrixClientPeg} from './MatrixClientPeg';
|
import {MatrixClientPeg} from './MatrixClientPeg';
|
||||||
import { MatrixEvent } from 'matrix-js-sdk';
|
import { MatrixEvent } from 'matrix-js-sdk/src/models/event';
|
||||||
import dis from './dispatcher/dispatcher';
|
import dis from './dispatcher/dispatcher';
|
||||||
import WidgetUtils from './utils/WidgetUtils';
|
import WidgetUtils from './utils/WidgetUtils';
|
||||||
import RoomViewStore from './stores/RoomViewStore';
|
import RoomViewStore from './stores/RoomViewStore';
|
||||||
|
|
|
@ -395,6 +395,8 @@ export async function accessSecretStorage(func = async () => { }, forceReset = f
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
SecurityCustomisations.catchAccessSecretStorageError?.(e);
|
SecurityCustomisations.catchAccessSecretStorageError?.(e);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
// Re-throw so that higher level logic can abort as needed
|
||||||
|
throw e;
|
||||||
} finally {
|
} finally {
|
||||||
// Clear secret storage key cache now that work is complete
|
// Clear secret storage key cache now that work is complete
|
||||||
secretStorageBeingAccessed = false;
|
secretStorageBeingAccessed = false;
|
||||||
|
|
|
@ -20,6 +20,7 @@ limitations under the License.
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { ContentHelpers } from 'matrix-js-sdk';
|
||||||
import {MatrixClientPeg} from './MatrixClientPeg';
|
import {MatrixClientPeg} from './MatrixClientPeg';
|
||||||
import dis from './dispatcher/dispatcher';
|
import dis from './dispatcher/dispatcher';
|
||||||
import * as sdk from './index';
|
import * as sdk from './index';
|
||||||
|
@ -126,10 +127,10 @@ export class Command {
|
||||||
return this.getCommand() + " " + this.args;
|
return this.getCommand() + " " + this.args;
|
||||||
}
|
}
|
||||||
|
|
||||||
run(roomId: string, args: string, cmd: string) {
|
run(roomId: string, args: string) {
|
||||||
// if it has no runFn then its an ignored/nop command (autocomplete only) e.g `/me`
|
// if it has no runFn then its an ignored/nop command (autocomplete only) e.g `/me`
|
||||||
if (!this.runFn) return reject(_t("Command error"));
|
if (!this.runFn) return reject(_t("Command error"));
|
||||||
return this.runFn.bind(this)(roomId, args, cmd);
|
return this.runFn.bind(this)(roomId, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
getUsage() {
|
getUsage() {
|
||||||
|
@ -154,6 +155,18 @@ function success(promise?: Promise<any>) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const Commands = [
|
export const Commands = [
|
||||||
|
new Command({
|
||||||
|
command: 'spoiler',
|
||||||
|
args: '<message>',
|
||||||
|
description: _td('Sends the given message as a spoiler'),
|
||||||
|
runFn: function(roomId, message) {
|
||||||
|
return success(ContentHelpers.makeHtmlMessage(
|
||||||
|
message,
|
||||||
|
`<span data-mx-spoiler>${message}</span>`,
|
||||||
|
));
|
||||||
|
},
|
||||||
|
category: CommandCategories.messages,
|
||||||
|
}),
|
||||||
new Command({
|
new Command({
|
||||||
command: 'shrug',
|
command: 'shrug',
|
||||||
args: '<message>',
|
args: '<message>',
|
||||||
|
@ -163,7 +176,7 @@ export const Commands = [
|
||||||
if (args) {
|
if (args) {
|
||||||
message = message + ' ' + args;
|
message = message + ' ' + args;
|
||||||
}
|
}
|
||||||
return success(MatrixClientPeg.get().sendTextMessage(roomId, message));
|
return success(ContentHelpers.makeTextMessage(message));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -176,7 +189,7 @@ export const Commands = [
|
||||||
if (args) {
|
if (args) {
|
||||||
message = message + ' ' + args;
|
message = message + ' ' + args;
|
||||||
}
|
}
|
||||||
return success(MatrixClientPeg.get().sendTextMessage(roomId, message));
|
return success(ContentHelpers.makeTextMessage(message));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -189,7 +202,7 @@ export const Commands = [
|
||||||
if (args) {
|
if (args) {
|
||||||
message = message + ' ' + args;
|
message = message + ' ' + args;
|
||||||
}
|
}
|
||||||
return success(MatrixClientPeg.get().sendTextMessage(roomId, message));
|
return success(ContentHelpers.makeTextMessage(message));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -202,7 +215,7 @@ export const Commands = [
|
||||||
if (args) {
|
if (args) {
|
||||||
message = message + ' ' + args;
|
message = message + ' ' + args;
|
||||||
}
|
}
|
||||||
return success(MatrixClientPeg.get().sendTextMessage(roomId, message));
|
return success(ContentHelpers.makeTextMessage(message));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -211,7 +224,7 @@ export const Commands = [
|
||||||
args: '<message>',
|
args: '<message>',
|
||||||
description: _td('Sends a message as plain text, without interpreting it as markdown'),
|
description: _td('Sends a message as plain text, without interpreting it as markdown'),
|
||||||
runFn: function(roomId, messages) {
|
runFn: function(roomId, messages) {
|
||||||
return success(MatrixClientPeg.get().sendTextMessage(roomId, messages));
|
return success(ContentHelpers.makeTextMessage(messages));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -220,7 +233,7 @@ export const Commands = [
|
||||||
args: '<message>',
|
args: '<message>',
|
||||||
description: _td('Sends a message as html, without interpreting it as markdown'),
|
description: _td('Sends a message as html, without interpreting it as markdown'),
|
||||||
runFn: function(roomId, messages) {
|
runFn: function(roomId, messages) {
|
||||||
return success(MatrixClientPeg.get().sendHtmlMessage(roomId, messages, messages));
|
return success(ContentHelpers.makeHtmlMessage(messages, messages));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -965,7 +978,7 @@ export const Commands = [
|
||||||
args: '<message>',
|
args: '<message>',
|
||||||
runFn: function(roomId, args) {
|
runFn: function(roomId, args) {
|
||||||
if (!args) return reject(this.getUserId());
|
if (!args) return reject(this.getUserId());
|
||||||
return success(MatrixClientPeg.get().sendHtmlMessage(roomId, args, textToHtmlRainbow(args)));
|
return success(ContentHelpers.makeHtmlMessage(args, textToHtmlRainbow(args)));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -975,7 +988,7 @@ export const Commands = [
|
||||||
args: '<message>',
|
args: '<message>',
|
||||||
runFn: function(roomId, args) {
|
runFn: function(roomId, args) {
|
||||||
if (!args) return reject(this.getUserId());
|
if (!args) return reject(this.getUserId());
|
||||||
return success(MatrixClientPeg.get().sendHtmlEmote(roomId, args, textToHtmlRainbow(args)));
|
return success(ContentHelpers.makeHtmlEmote(args, textToHtmlRainbow(args)));
|
||||||
},
|
},
|
||||||
category: CommandCategories.messages,
|
category: CommandCategories.messages,
|
||||||
}),
|
}),
|
||||||
|
@ -1200,10 +1213,13 @@ export function parseCommandString(input: string) {
|
||||||
* processing the command, or 'promise' if a request was sent out.
|
* processing the command, or 'promise' if a request was sent out.
|
||||||
* Returns null if the input didn't match a command.
|
* Returns null if the input didn't match a command.
|
||||||
*/
|
*/
|
||||||
export function getCommand(roomId: string, input: string) {
|
export function getCommand(input: string) {
|
||||||
const {cmd, args} = parseCommandString(input);
|
const {cmd, args} = parseCommandString(input);
|
||||||
|
|
||||||
if (CommandMap.has(cmd) && CommandMap.get(cmd).isEnabled()) {
|
if (CommandMap.has(cmd) && CommandMap.get(cmd).isEnabled()) {
|
||||||
return () => CommandMap.get(cmd).run(roomId, args, cmd);
|
return {
|
||||||
|
cmd: CommandMap.get(cmd),
|
||||||
|
args,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import React, {createRef} from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { _t } from '../../../../languageHandler';
|
import { _t } from '../../../../languageHandler';
|
||||||
|
|
||||||
import { MatrixClient } from 'matrix-js-sdk';
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||||
import * as MegolmExportEncryption from '../../../../utils/MegolmExportEncryption';
|
import * as MegolmExportEncryption from '../../../../utils/MegolmExportEncryption';
|
||||||
import * as sdk from '../../../../index';
|
import * as sdk from '../../../../index';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
import React, {createRef} from 'react';
|
import React, {createRef} from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import { MatrixClient } from 'matrix-js-sdk';
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||||
import * as MegolmExportEncryption from '../../../../utils/MegolmExportEncryption';
|
import * as MegolmExportEncryption from '../../../../utils/MegolmExportEncryption';
|
||||||
import * as sdk from '../../../../index';
|
import * as sdk from '../../../../index';
|
||||||
import { _t } from '../../../../languageHandler';
|
import { _t } from '../../../../languageHandler';
|
||||||
|
|
|
@ -23,7 +23,6 @@ interface IOptions<T extends {}> {
|
||||||
keys: Array<string | keyof T>;
|
keys: Array<string | keyof T>;
|
||||||
funcs?: Array<(T) => string>;
|
funcs?: Array<(T) => string>;
|
||||||
shouldMatchWordsOnly?: boolean;
|
shouldMatchWordsOnly?: boolean;
|
||||||
shouldMatchPrefix?: boolean;
|
|
||||||
// whether to apply unhomoglyph and strip diacritics to fuzz up the search. Defaults to true
|
// whether to apply unhomoglyph and strip diacritics to fuzz up the search. Defaults to true
|
||||||
fuzzy?: boolean;
|
fuzzy?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -56,12 +55,6 @@ export default class QueryMatcher<T extends Object> {
|
||||||
if (this._options.shouldMatchWordsOnly === undefined) {
|
if (this._options.shouldMatchWordsOnly === undefined) {
|
||||||
this._options.shouldMatchWordsOnly = true;
|
this._options.shouldMatchWordsOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// By default, match anywhere in the string being searched. If enabled, only return
|
|
||||||
// matches that are prefixed with the query.
|
|
||||||
if (this._options.shouldMatchPrefix === undefined) {
|
|
||||||
this._options.shouldMatchPrefix = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setObjects(objects: T[]) {
|
setObjects(objects: T[]) {
|
||||||
|
@ -112,7 +105,7 @@ export default class QueryMatcher<T extends Object> {
|
||||||
resultKey = resultKey.replace(/[^\w]/g, '');
|
resultKey = resultKey.replace(/[^\w]/g, '');
|
||||||
}
|
}
|
||||||
const index = resultKey.indexOf(query);
|
const index = resultKey.indexOf(query);
|
||||||
if (index !== -1 && (!this._options.shouldMatchPrefix || index === 0)) {
|
if (index !== -1) {
|
||||||
matches.push(
|
matches.push(
|
||||||
...candidates.map((candidate) => ({index, ...candidate})),
|
...candidates.map((candidate) => ({index, ...candidate})),
|
||||||
);
|
);
|
||||||
|
|
|
@ -56,7 +56,6 @@ export default class UserProvider extends AutocompleteProvider {
|
||||||
this.matcher = new QueryMatcher([], {
|
this.matcher = new QueryMatcher([], {
|
||||||
keys: ['name'],
|
keys: ['name'],
|
||||||
funcs: [obj => obj.userId.slice(1)], // index by user id minus the leading '@'
|
funcs: [obj => obj.userId.slice(1)], // index by user id minus the leading '@'
|
||||||
shouldMatchPrefix: true,
|
|
||||||
shouldMatchWordsOnly: false,
|
shouldMatchWordsOnly: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import {Filter} from 'matrix-js-sdk';
|
import {Filter} from 'matrix-js-sdk/src/filter';
|
||||||
import * as sdk from '../../index';
|
import * as sdk from '../../index';
|
||||||
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
||||||
import EventIndexPeg from "../../indexing/EventIndexPeg";
|
import EventIndexPeg from "../../indexing/EventIndexPeg";
|
||||||
|
|
|
@ -35,7 +35,7 @@ import GroupStore from '../../stores/GroupStore';
|
||||||
import FlairStore from '../../stores/FlairStore';
|
import FlairStore from '../../stores/FlairStore';
|
||||||
import { showGroupAddRoomDialog } from '../../GroupAddressPicker';
|
import { showGroupAddRoomDialog } from '../../GroupAddressPicker';
|
||||||
import {makeGroupPermalink, makeUserPermalink} from "../../utils/permalinks/Permalinks";
|
import {makeGroupPermalink, makeUserPermalink} from "../../utils/permalinks/Permalinks";
|
||||||
import {Group} from "matrix-js-sdk";
|
import {Group} from "matrix-js-sdk/src/models/group";
|
||||||
import {allSettled, sleep} from "../../utils/promise";
|
import {allSettled, sleep} from "../../utils/promise";
|
||||||
import RightPanelStore from "../../stores/RightPanelStore";
|
import RightPanelStore from "../../stores/RightPanelStore";
|
||||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||||
|
|
|
@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {InteractiveAuth} from "matrix-js-sdk";
|
import {InteractiveAuth} from "matrix-js-sdk/src/interactive-auth";
|
||||||
import React, {createRef} from 'react';
|
import React, {createRef} from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,11 @@ limitations under the License.
|
||||||
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { createRef } from "react";
|
import { createRef } from "react";
|
||||||
|
import classNames from "classnames";
|
||||||
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
|
|
||||||
import GroupFilterPanel from "./GroupFilterPanel";
|
import GroupFilterPanel from "./GroupFilterPanel";
|
||||||
import CustomRoomTagPanel from "./CustomRoomTagPanel";
|
import CustomRoomTagPanel from "./CustomRoomTagPanel";
|
||||||
import classNames from "classnames";
|
|
||||||
import dis from "../../dispatcher/dispatcher";
|
import dis from "../../dispatcher/dispatcher";
|
||||||
import { _t } from "../../languageHandler";
|
import { _t } from "../../languageHandler";
|
||||||
import RoomList from "../views/rooms/RoomList";
|
import RoomList from "../views/rooms/RoomList";
|
||||||
|
@ -32,15 +34,15 @@ import { UPDATE_EVENT } from "../../stores/AsyncStore";
|
||||||
import ResizeNotifier from "../../utils/ResizeNotifier";
|
import ResizeNotifier from "../../utils/ResizeNotifier";
|
||||||
import SettingsStore from "../../settings/SettingsStore";
|
import SettingsStore from "../../settings/SettingsStore";
|
||||||
import RoomListStore, { LISTS_UPDATE_EVENT } from "../../stores/room-list/RoomListStore";
|
import RoomListStore, { LISTS_UPDATE_EVENT } from "../../stores/room-list/RoomListStore";
|
||||||
import {Key} from "../../Keyboard";
|
|
||||||
import IndicatorScrollbar from "../structures/IndicatorScrollbar";
|
import IndicatorScrollbar from "../structures/IndicatorScrollbar";
|
||||||
import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton";
|
import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton";
|
||||||
import { OwnProfileStore } from "../../stores/OwnProfileStore";
|
import { OwnProfileStore } from "../../stores/OwnProfileStore";
|
||||||
import RoomListNumResults from "../views/rooms/RoomListNumResults";
|
import RoomListNumResults from "../views/rooms/RoomListNumResults";
|
||||||
import LeftPanelWidget from "./LeftPanelWidget";
|
import LeftPanelWidget from "./LeftPanelWidget";
|
||||||
import SpacePanel from "../views/spaces/SpacePanel";
|
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
import {mediaFromMxc} from "../../customisations/Media";
|
import {mediaFromMxc} from "../../customisations/Media";
|
||||||
|
import SpaceStore, {UPDATE_SELECTED_SPACE} from "../../stores/SpaceStore";
|
||||||
|
import { getKeyBindingsManager, RoomListAction } from "../../KeyBindingsManager";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isMinimized: boolean;
|
isMinimized: boolean;
|
||||||
|
@ -50,6 +52,7 @@ interface IProps {
|
||||||
interface IState {
|
interface IState {
|
||||||
showBreadcrumbs: boolean;
|
showBreadcrumbs: boolean;
|
||||||
showGroupFilterPanel: boolean;
|
showGroupFilterPanel: boolean;
|
||||||
|
activeSpace?: Room;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of CSS classes which should be included in keyboard navigation within the room list
|
// List of CSS classes which should be included in keyboard navigation within the room list
|
||||||
|
@ -75,11 +78,13 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
this.state = {
|
this.state = {
|
||||||
showBreadcrumbs: BreadcrumbsStore.instance.visible,
|
showBreadcrumbs: BreadcrumbsStore.instance.visible,
|
||||||
showGroupFilterPanel: SettingsStore.getValue('TagPanel.enableTagPanel'),
|
showGroupFilterPanel: SettingsStore.getValue('TagPanel.enableTagPanel'),
|
||||||
|
activeSpace: SpaceStore.instance.activeSpace,
|
||||||
};
|
};
|
||||||
|
|
||||||
BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
||||||
RoomListStore.instance.on(LISTS_UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
RoomListStore.instance.on(LISTS_UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
||||||
OwnProfileStore.instance.on(UPDATE_EVENT, this.onBackgroundImageUpdate);
|
OwnProfileStore.instance.on(UPDATE_EVENT, this.onBackgroundImageUpdate);
|
||||||
|
SpaceStore.instance.on(UPDATE_SELECTED_SPACE, this.updateActiveSpace);
|
||||||
this.bgImageWatcherRef = SettingsStore.watchSetting(
|
this.bgImageWatcherRef = SettingsStore.watchSetting(
|
||||||
"RoomList.backgroundImage", null, this.onBackgroundImageUpdate);
|
"RoomList.backgroundImage", null, this.onBackgroundImageUpdate);
|
||||||
this.groupFilterPanelWatcherRef = SettingsStore.watchSetting("TagPanel.enableTagPanel", null, () => {
|
this.groupFilterPanelWatcherRef = SettingsStore.watchSetting("TagPanel.enableTagPanel", null, () => {
|
||||||
|
@ -97,9 +102,14 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
BreadcrumbsStore.instance.off(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
BreadcrumbsStore.instance.off(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
||||||
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
||||||
OwnProfileStore.instance.off(UPDATE_EVENT, this.onBackgroundImageUpdate);
|
OwnProfileStore.instance.off(UPDATE_EVENT, this.onBackgroundImageUpdate);
|
||||||
|
SpaceStore.instance.off(UPDATE_SELECTED_SPACE, this.updateActiveSpace);
|
||||||
this.props.resizeNotifier.off("middlePanelResizedNoisy", this.onResize);
|
this.props.resizeNotifier.off("middlePanelResizedNoisy", this.onResize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private updateActiveSpace = (activeSpace: Room) => {
|
||||||
|
this.setState({ activeSpace });
|
||||||
|
};
|
||||||
|
|
||||||
private onExplore = () => {
|
private onExplore = () => {
|
||||||
dis.fire(Action.ViewRoomDirectory);
|
dis.fire(Action.ViewRoomDirectory);
|
||||||
};
|
};
|
||||||
|
@ -287,17 +297,18 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
private onKeyDown = (ev: React.KeyboardEvent) => {
|
private onKeyDown = (ev: React.KeyboardEvent) => {
|
||||||
if (!this.focusedElement) return;
|
if (!this.focusedElement) return;
|
||||||
|
|
||||||
switch (ev.key) {
|
const action = getKeyBindingsManager().getRoomListAction(ev);
|
||||||
case Key.ARROW_UP:
|
switch (action) {
|
||||||
case Key.ARROW_DOWN:
|
case RoomListAction.NextRoom:
|
||||||
|
case RoomListAction.PrevRoom:
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
this.onMoveFocus(ev.key === Key.ARROW_UP);
|
this.onMoveFocus(action === RoomListAction.PrevRoom);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private onEnter = () => {
|
private selectRoom = () => {
|
||||||
const firstRoom = this.listContainerRef.current.querySelector<HTMLDivElement>(".mx_RoomTile");
|
const firstRoom = this.listContainerRef.current.querySelector<HTMLDivElement>(".mx_RoomTile");
|
||||||
if (firstRoom) {
|
if (firstRoom) {
|
||||||
firstRoom.click();
|
firstRoom.click();
|
||||||
|
@ -378,11 +389,13 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
>
|
>
|
||||||
<RoomSearch
|
<RoomSearch
|
||||||
isMinimized={this.props.isMinimized}
|
isMinimized={this.props.isMinimized}
|
||||||
onVerticalArrow={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
onEnter={this.onEnter}
|
onSelectRoom={this.selectRoom}
|
||||||
/>
|
/>
|
||||||
<AccessibleTooltipButton
|
<AccessibleTooltipButton
|
||||||
className="mx_LeftPanel_exploreButton"
|
className={classNames("mx_LeftPanel_exploreButton", {
|
||||||
|
mx_LeftPanel_exploreButton_space: !!this.state.activeSpace,
|
||||||
|
})}
|
||||||
onClick={this.onExplore}
|
onClick={this.onExplore}
|
||||||
title={_t("Explore rooms")}
|
title={_t("Explore rooms")}
|
||||||
/>
|
/>
|
||||||
|
@ -392,11 +405,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
let leftLeftPanel;
|
let leftLeftPanel;
|
||||||
// Currently TagPanel.enableTagPanel is disabled when Legacy Communities are disabled so for now
|
if (this.state.showGroupFilterPanel) {
|
||||||
// ignore it and force the rendering of SpacePanel if that Labs flag is enabled.
|
|
||||||
if (SettingsStore.getValue("feature_spaces")) {
|
|
||||||
leftLeftPanel = <SpacePanel />;
|
|
||||||
} else if (this.state.showGroupFilterPanel) {
|
|
||||||
leftLeftPanel = (
|
leftLeftPanel = (
|
||||||
<div className="mx_LeftPanel_GroupFilterPanelContainer">
|
<div className="mx_LeftPanel_GroupFilterPanelContainer">
|
||||||
<GroupFilterPanel />
|
<GroupFilterPanel />
|
||||||
|
@ -412,6 +421,7 @@ export default class LeftPanel extends React.Component<IProps, IState> {
|
||||||
onBlur={this.onBlur}
|
onBlur={this.onBlur}
|
||||||
isMinimized={this.props.isMinimized}
|
isMinimized={this.props.isMinimized}
|
||||||
onResize={this.onResize}
|
onResize={this.onResize}
|
||||||
|
activeSpace={this.state.activeSpace}
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
const containerClasses = classNames({
|
const containerClasses = classNames({
|
||||||
|
|
|
@ -21,7 +21,7 @@ import * as PropTypes from 'prop-types';
|
||||||
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||||
import { DragDropContext } from 'react-beautiful-dnd';
|
import { DragDropContext } from 'react-beautiful-dnd';
|
||||||
|
|
||||||
import {Key, isOnlyCtrlOrCmdKeyEvent, isOnlyCtrlOrCmdIgnoreShiftKeyEvent, isMac} from '../../Keyboard';
|
import {Key} from '../../Keyboard';
|
||||||
import PageTypes from '../../PageTypes';
|
import PageTypes from '../../PageTypes';
|
||||||
import CallMediaHandler from '../../CallMediaHandler';
|
import CallMediaHandler from '../../CallMediaHandler';
|
||||||
import { fixupColorFonts } from '../../utils/FontManager';
|
import { fixupColorFonts } from '../../utils/FontManager';
|
||||||
|
@ -55,7 +55,9 @@ import { IThreepidInvite } from "../../stores/ThreepidInviteStore";
|
||||||
import Modal from "../../Modal";
|
import Modal from "../../Modal";
|
||||||
import { ICollapseConfig } from "../../resizer/distributors/collapse";
|
import { ICollapseConfig } from "../../resizer/distributors/collapse";
|
||||||
import HostSignupContainer from '../views/host_signup/HostSignupContainer';
|
import HostSignupContainer from '../views/host_signup/HostSignupContainer';
|
||||||
|
import { getKeyBindingsManager, NavigationAction, RoomAction } from '../../KeyBindingsManager';
|
||||||
import { IOpts } from "../../createRoom";
|
import { IOpts } from "../../createRoom";
|
||||||
|
import SpacePanel from "../views/spaces/SpacePanel";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
|
||||||
// We need to fetch each pinned message individually (if we don't already have it)
|
// We need to fetch each pinned message individually (if we don't already have it)
|
||||||
|
@ -73,7 +75,6 @@ function canElementReceiveInput(el) {
|
||||||
interface IProps {
|
interface IProps {
|
||||||
matrixClient: MatrixClient;
|
matrixClient: MatrixClient;
|
||||||
onRegistered: (credentials: IMatrixClientCreds) => Promise<MatrixClient>;
|
onRegistered: (credentials: IMatrixClientCreds) => Promise<MatrixClient>;
|
||||||
viaServers?: string[];
|
|
||||||
hideToSRUsers: boolean;
|
hideToSRUsers: boolean;
|
||||||
resizeNotifier: ResizeNotifier;
|
resizeNotifier: ResizeNotifier;
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
|
@ -142,9 +143,6 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
// transitioned to PWLU)
|
// transitioned to PWLU)
|
||||||
onRegistered: PropTypes.func,
|
onRegistered: PropTypes.func,
|
||||||
|
|
||||||
// Used by the RoomView to handle joining rooms
|
|
||||||
viaServers: PropTypes.arrayOf(PropTypes.string),
|
|
||||||
|
|
||||||
// and lots and lots of other stuff.
|
// and lots and lots of other stuff.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -229,14 +227,8 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
let size;
|
let size;
|
||||||
let collapsed;
|
let collapsed;
|
||||||
const collapseConfig: ICollapseConfig = {
|
const collapseConfig: ICollapseConfig = {
|
||||||
// TODO: the space panel currently does not have a fixed width,
|
// TODO decrease this once Spaces launches as it'll no longer need to include the 56px Community Panel
|
||||||
// just the headers at each level have a max-width of 150px
|
toggleSize: 206 - 50,
|
||||||
// Taking 222px for the space panel for now,
|
|
||||||
// so this will look slightly off for now,
|
|
||||||
// depending on the depth of your space tree.
|
|
||||||
// To fix this, we'll need to turn toggleSize
|
|
||||||
// into a callback so it can be measured when starting the resize operation
|
|
||||||
toggleSize: 222 + 68,
|
|
||||||
onCollapsed: (_collapsed) => {
|
onCollapsed: (_collapsed) => {
|
||||||
collapsed = _collapsed;
|
collapsed = _collapsed;
|
||||||
if (_collapsed) {
|
if (_collapsed) {
|
||||||
|
@ -445,86 +437,55 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
_onKeyDown = (ev) => {
|
_onKeyDown = (ev) => {
|
||||||
let handled = false;
|
let handled = false;
|
||||||
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
|
|
||||||
const hasModifier = ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey;
|
|
||||||
const isModifier = ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
|
||||||
const modKey = isMac ? ev.metaKey : ev.ctrlKey;
|
|
||||||
|
|
||||||
switch (ev.key) {
|
const roomAction = getKeyBindingsManager().getRoomAction(ev);
|
||||||
case Key.PAGE_UP:
|
switch (roomAction) {
|
||||||
case Key.PAGE_DOWN:
|
case RoomAction.ScrollUp:
|
||||||
if (!hasModifier && !isModifier) {
|
case RoomAction.RoomScrollDown:
|
||||||
|
case RoomAction.JumpToFirstMessage:
|
||||||
|
case RoomAction.JumpToLatestMessage:
|
||||||
|
// pass the event down to the scroll panel
|
||||||
this._onScrollKeyPressed(ev);
|
this._onScrollKeyPressed(ev);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case RoomAction.FocusSearch:
|
||||||
case Key.HOME:
|
|
||||||
case Key.END:
|
|
||||||
if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
|
|
||||||
this._onScrollKeyPressed(ev);
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Key.K:
|
|
||||||
if (ctrlCmdOnly) {
|
|
||||||
dis.dispatch({
|
|
||||||
action: 'focus_room_filter',
|
|
||||||
});
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Key.F:
|
|
||||||
if (ctrlCmdOnly && SettingsStore.getValue("ctrlFForSearch")) {
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'focus_search',
|
action: 'focus_search',
|
||||||
});
|
});
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Key.BACKTICK:
|
}
|
||||||
// Ideally this would be CTRL+P for "Profile", but that's
|
if (handled) {
|
||||||
// taken by the print dialog. CTRL+I for "Information"
|
ev.stopPropagation();
|
||||||
// was previously chosen but conflicted with italics in
|
ev.preventDefault();
|
||||||
// composer, so CTRL+` it is
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ctrlCmdOnly) {
|
const navAction = getKeyBindingsManager().getNavigationAction(ev);
|
||||||
|
switch (navAction) {
|
||||||
|
case NavigationAction.FocusRoomSearch:
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'focus_room_filter',
|
||||||
|
});
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
|
case NavigationAction.ToggleUserMenu:
|
||||||
dis.fire(Action.ToggleUserMenu);
|
dis.fire(Action.ToggleUserMenu);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case NavigationAction.ToggleShortCutDialog:
|
||||||
case Key.SLASH:
|
|
||||||
if (isOnlyCtrlOrCmdIgnoreShiftKeyEvent(ev)) {
|
|
||||||
KeyboardShortcuts.toggleDialog();
|
KeyboardShortcuts.toggleDialog();
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case NavigationAction.GoToHome:
|
||||||
case Key.H:
|
|
||||||
if (ev.altKey && modKey) {
|
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_home_page',
|
action: 'view_home_page',
|
||||||
});
|
});
|
||||||
Modal.closeCurrentModal("homeKeyboardShortcut");
|
Modal.closeCurrentModal("homeKeyboardShortcut");
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case NavigationAction.ToggleRoomSidePanel:
|
||||||
case Key.ARROW_UP:
|
if (this.props.page_type === "room_view" || this.props.page_type === "group_view") {
|
||||||
case Key.ARROW_DOWN:
|
|
||||||
if (ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
|
||||||
dis.dispatch<ViewRoomDeltaPayload>({
|
|
||||||
action: Action.ViewRoomDelta,
|
|
||||||
delta: ev.key === Key.ARROW_UP ? -1 : 1,
|
|
||||||
unread: ev.shiftKey,
|
|
||||||
});
|
|
||||||
handled = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Key.PERIOD:
|
|
||||||
if (ctrlCmdOnly && (this.props.page_type === "room_view" || this.props.page_type === "group_view")) {
|
|
||||||
dis.dispatch<ToggleRightPanelPayload>({
|
dis.dispatch<ToggleRightPanelPayload>({
|
||||||
action: Action.ToggleRightPanel,
|
action: Action.ToggleRightPanel,
|
||||||
type: this.props.page_type === "room_view" ? "room" : "group",
|
type: this.props.page_type === "room_view" ? "room" : "group",
|
||||||
|
@ -532,16 +493,48 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NavigationAction.SelectPrevRoom:
|
||||||
|
dis.dispatch<ViewRoomDeltaPayload>({
|
||||||
|
action: Action.ViewRoomDelta,
|
||||||
|
delta: -1,
|
||||||
|
unread: false,
|
||||||
|
});
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
|
case NavigationAction.SelectNextRoom:
|
||||||
|
dis.dispatch<ViewRoomDeltaPayload>({
|
||||||
|
action: Action.ViewRoomDelta,
|
||||||
|
delta: 1,
|
||||||
|
unread: false,
|
||||||
|
});
|
||||||
|
handled = true;
|
||||||
|
break;
|
||||||
|
case NavigationAction.SelectPrevUnreadRoom:
|
||||||
|
dis.dispatch<ViewRoomDeltaPayload>({
|
||||||
|
action: Action.ViewRoomDelta,
|
||||||
|
delta: -1,
|
||||||
|
unread: true,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case NavigationAction.SelectNextUnreadRoom:
|
||||||
|
dis.dispatch<ViewRoomDeltaPayload>({
|
||||||
|
action: Action.ViewRoomDelta,
|
||||||
|
delta: 1,
|
||||||
|
unread: true,
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// if we do not have a handler for it, pass it to the platform which might
|
// if we do not have a handler for it, pass it to the platform which might
|
||||||
handled = PlatformPeg.get().onKeyDown(ev);
|
handled = PlatformPeg.get().onKeyDown(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled) {
|
if (handled) {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
} else if (!isModifier && !ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isModifier = ev.key === Key.ALT || ev.key === Key.CONTROL || ev.key === Key.META || ev.key === Key.SHIFT;
|
||||||
|
if (!isModifier && !ev.altKey && !ev.ctrlKey && !ev.metaKey) {
|
||||||
// The above condition is crafted to _allow_ characters with Shift
|
// The above condition is crafted to _allow_ characters with Shift
|
||||||
// already pressed (but not the Shift key down itself).
|
// already pressed (but not the Shift key down itself).
|
||||||
|
|
||||||
|
@ -630,11 +623,9 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
case PageTypes.RoomView:
|
case PageTypes.RoomView:
|
||||||
pageElement = <RoomView
|
pageElement = <RoomView
|
||||||
ref={this._roomView}
|
ref={this._roomView}
|
||||||
autoJoin={this.props.autoJoin}
|
|
||||||
onRegistered={this.props.onRegistered}
|
onRegistered={this.props.onRegistered}
|
||||||
threepidInvite={this.props.threepidInvite}
|
threepidInvite={this.props.threepidInvite}
|
||||||
oobData={this.props.roomOobData}
|
oobData={this.props.roomOobData}
|
||||||
viaServers={this.props.viaServers}
|
|
||||||
key={this.props.currentRoomId || 'roomview'}
|
key={this.props.currentRoomId || 'roomview'}
|
||||||
resizeNotifier={this.props.resizeNotifier}
|
resizeNotifier={this.props.resizeNotifier}
|
||||||
justCreatedOpts={this.props.roomJustCreatedOpts}
|
justCreatedOpts={this.props.roomJustCreatedOpts}
|
||||||
|
@ -670,13 +661,6 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
bodyClasses += ' mx_MatrixChat_useCompactLayout';
|
bodyClasses += ' mx_MatrixChat_useCompactLayout';
|
||||||
}
|
}
|
||||||
|
|
||||||
const leftPanel = (
|
|
||||||
<LeftPanel
|
|
||||||
isMinimized={this.props.collapseLhs || false}
|
|
||||||
resizeNotifier={this.props.resizeNotifier}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MatrixClientContext.Provider value={this._matrixClient}>
|
<MatrixClientContext.Provider value={this._matrixClient}>
|
||||||
<div
|
<div
|
||||||
|
@ -688,7 +672,11 @@ class LoggedInView extends React.Component<IProps, IState> {
|
||||||
<ToastContainer />
|
<ToastContainer />
|
||||||
<DragDropContext onDragEnd={this._onDragEnd}>
|
<DragDropContext onDragEnd={this._onDragEnd}>
|
||||||
<div ref={this._resizeContainer} className={bodyClasses}>
|
<div ref={this._resizeContainer} className={bodyClasses}>
|
||||||
{ leftPanel }
|
{ SettingsStore.getValue("feature_spaces") ? <SpacePanel /> : null }
|
||||||
|
<LeftPanel
|
||||||
|
isMinimized={this.props.collapseLhs || false}
|
||||||
|
resizeNotifier={this.props.resizeNotifier}
|
||||||
|
/>
|
||||||
<ResizeHandle />
|
<ResizeHandle />
|
||||||
{ pageElement }
|
{ pageElement }
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2015-2021 The Matrix.org Foundation C.I.C.
|
||||||
Copyright 2017 Vector Creations Ltd
|
|
||||||
Copyright 2017-2019 New Vector Ltd
|
|
||||||
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -18,8 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { createRef } from 'react';
|
import React, { createRef } from 'react';
|
||||||
// @ts-ignore - XXX: no idea why this import fails
|
import { createClient } from "matrix-js-sdk/src/matrix";
|
||||||
import * as Matrix from "matrix-js-sdk";
|
|
||||||
import { InvalidStoreError } from "matrix-js-sdk/src/errors";
|
import { InvalidStoreError } from "matrix-js-sdk/src/errors";
|
||||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
@ -82,9 +78,12 @@ import {UIFeature} from "../../settings/UIFeature";
|
||||||
import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore";
|
import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore";
|
||||||
import DialPadModal from "../views/voip/DialPadModal";
|
import DialPadModal from "../views/voip/DialPadModal";
|
||||||
import { showToast as showMobileGuideToast } from '../../toasts/MobileGuideToast';
|
import { showToast as showMobileGuideToast } from '../../toasts/MobileGuideToast';
|
||||||
|
import { shouldUseLoginForWelcome } from "../../utils/pages";
|
||||||
import SpaceStore from "../../stores/SpaceStore";
|
import SpaceStore from "../../stores/SpaceStore";
|
||||||
import SpaceRoomDirectory from "./SpaceRoomDirectory";
|
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
import RoomListStore from "../../stores/room-list/RoomListStore";
|
||||||
|
import {RoomUpdateCause} from "../../stores/room-list/models";
|
||||||
|
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||||
|
|
||||||
/** constants for MatrixChat.state.view */
|
/** constants for MatrixChat.state.view */
|
||||||
export enum Views {
|
export enum Views {
|
||||||
|
@ -203,7 +202,6 @@ interface IState {
|
||||||
ready: boolean;
|
ready: boolean;
|
||||||
threepidInvite?: IThreepidInvite,
|
threepidInvite?: IThreepidInvite,
|
||||||
roomOobData?: object;
|
roomOobData?: object;
|
||||||
viaServers?: string[];
|
|
||||||
pendingInitialSync?: boolean;
|
pendingInitialSync?: boolean;
|
||||||
justRegistered?: boolean;
|
justRegistered?: boolean;
|
||||||
roomJustCreatedOpts?: IOpts;
|
roomJustCreatedOpts?: IOpts;
|
||||||
|
@ -607,12 +605,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
if (payload.screenAfterLogin) {
|
if (payload.screenAfterLogin) {
|
||||||
this.screenAfterLogin = payload.screenAfterLogin;
|
this.screenAfterLogin = payload.screenAfterLogin;
|
||||||
}
|
}
|
||||||
this.setStateForNewView({
|
this.viewLogin();
|
||||||
view: Views.LOGIN,
|
|
||||||
});
|
|
||||||
this.notifyNewScreen('login');
|
|
||||||
ThemeController.isLogin = true;
|
|
||||||
this.themeWatcher.recheck();
|
|
||||||
break;
|
break;
|
||||||
case 'start_password_recovery':
|
case 'start_password_recovery':
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
|
@ -697,10 +690,10 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
case Action.ViewRoomDirectory: {
|
case Action.ViewRoomDirectory: {
|
||||||
if (SpaceStore.instance.activeSpace) {
|
if (SpaceStore.instance.activeSpace) {
|
||||||
Modal.createTrackedDialog("Space room directory", "", SpaceRoomDirectory, {
|
defaultDispatcher.dispatch({
|
||||||
space: SpaceStore.instance.activeSpace,
|
action: "view_room",
|
||||||
initialText: payload.initialText,
|
room_id: SpaceStore.instance.activeSpace.roomId,
|
||||||
}, "mx_SpaceRoomDirectory_dialogWrapper", false, true);
|
});
|
||||||
} else {
|
} else {
|
||||||
const RoomDirectory = sdk.getComponent("structures.RoomDirectory");
|
const RoomDirectory = sdk.getComponent("structures.RoomDirectory");
|
||||||
Modal.createTrackedDialog('Room directory', '', RoomDirectory, {
|
Modal.createTrackedDialog('Room directory', '', RoomDirectory, {
|
||||||
|
@ -935,7 +928,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
page_type: PageTypes.RoomView,
|
page_type: PageTypes.RoomView,
|
||||||
threepidInvite: roomInfo.threepid_invite,
|
threepidInvite: roomInfo.threepid_invite,
|
||||||
roomOobData: roomInfo.oob_data,
|
roomOobData: roomInfo.oob_data,
|
||||||
viaServers: roomInfo.via_servers,
|
|
||||||
ready: true,
|
ready: true,
|
||||||
roomJustCreatedOpts: roomInfo.justCreatedOpts,
|
roomJustCreatedOpts: roomInfo.justCreatedOpts,
|
||||||
}, () => {
|
}, () => {
|
||||||
|
@ -976,6 +968,9 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private viewWelcome() {
|
private viewWelcome() {
|
||||||
|
if (shouldUseLoginForWelcome(SdkConfig.get())) {
|
||||||
|
return this.viewLogin();
|
||||||
|
}
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
view: Views.WELCOME,
|
view: Views.WELCOME,
|
||||||
});
|
});
|
||||||
|
@ -984,6 +979,16 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
this.themeWatcher.recheck();
|
this.themeWatcher.recheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private viewLogin(otherState?: any) {
|
||||||
|
this.setStateForNewView({
|
||||||
|
view: Views.LOGIN,
|
||||||
|
...otherState,
|
||||||
|
});
|
||||||
|
this.notifyNewScreen('login');
|
||||||
|
ThemeController.isLogin = true;
|
||||||
|
this.themeWatcher.recheck();
|
||||||
|
}
|
||||||
|
|
||||||
private viewHome(justRegistered = false) {
|
private viewHome(justRegistered = false) {
|
||||||
// The home page requires the "logged in" view, so we'll set that.
|
// The home page requires the "logged in" view, so we'll set that.
|
||||||
this.setStateForNewView({
|
this.setStateForNewView({
|
||||||
|
@ -1140,11 +1145,17 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private forgetRoom(roomId: string) {
|
private forgetRoom(roomId: string) {
|
||||||
|
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||||
MatrixClientPeg.get().forget(roomId).then(() => {
|
MatrixClientPeg.get().forget(roomId).then(() => {
|
||||||
// Switch to home page if we're currently viewing the forgotten room
|
// Switch to home page if we're currently viewing the forgotten room
|
||||||
if (this.state.currentRoomId === roomId) {
|
if (this.state.currentRoomId === roomId) {
|
||||||
dis.dispatch({ action: "view_home_page" });
|
dis.dispatch({ action: "view_home_page" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We have to manually update the room list because the forgotten room will not
|
||||||
|
// be notified to us, therefore the room list will have no other way of knowing
|
||||||
|
// the room is forgotten.
|
||||||
|
RoomListStore.instance.manualRoomUpdate(room, RoomUpdateCause.RoomRemoved);
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
const errCode = err.errcode || _td("unknown error code");
|
const errCode = err.errcode || _td("unknown error code");
|
||||||
Modal.createTrackedDialog("Failed to forget room", '', ErrorDialog, {
|
Modal.createTrackedDialog("Failed to forget room", '', ErrorDialog, {
|
||||||
|
@ -1299,17 +1310,13 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
* Called when the session is logged out
|
* Called when the session is logged out
|
||||||
*/
|
*/
|
||||||
private onLoggedOut() {
|
private onLoggedOut() {
|
||||||
this.notifyNewScreen('login');
|
this.viewLogin({
|
||||||
this.setStateForNewView({
|
|
||||||
view: Views.LOGIN,
|
|
||||||
ready: false,
|
ready: false,
|
||||||
collapseLhs: false,
|
collapseLhs: false,
|
||||||
currentRoomId: null,
|
currentRoomId: null,
|
||||||
});
|
});
|
||||||
this.subTitleStatus = '';
|
this.subTitleStatus = '';
|
||||||
this.setPageSubtitle();
|
this.setPageSubtitle();
|
||||||
ThemeController.isLogin = true;
|
|
||||||
this.themeWatcher.recheck();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1547,7 +1554,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
} else if (request.pending) {
|
} else if (request.pending) {
|
||||||
ToastStore.sharedInstance().addOrReplaceToast({
|
ToastStore.sharedInstance().addOrReplaceToast({
|
||||||
key: 'verifreq_' + request.channel.transactionId,
|
key: 'verifreq_' + request.channel.transactionId,
|
||||||
title: request.isSelfVerification ? _t("Self-verification request") : _t("Verification Request"),
|
title: _t("Verification requested"),
|
||||||
icon: "verification",
|
icon: "verification",
|
||||||
props: {request},
|
props: {request},
|
||||||
component: sdk.getComponent("toasts.VerificationRequestToast"),
|
component: sdk.getComponent("toasts.VerificationRequestToast"),
|
||||||
|
@ -1649,7 +1656,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
|
||||||
let cli = MatrixClientPeg.get();
|
let cli = MatrixClientPeg.get();
|
||||||
if (!cli) {
|
if (!cli) {
|
||||||
const {hsUrl, isUrl} = this.props.serverConfig;
|
const {hsUrl, isUrl} = this.props.serverConfig;
|
||||||
cli = Matrix.createClient({
|
cli = createClient({
|
||||||
baseUrl: hsUrl,
|
baseUrl: hsUrl,
|
||||||
idBaseUrl: isUrl,
|
idBaseUrl: isUrl,
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,6 @@ import classNames from 'classnames';
|
||||||
import shouldHideEvent from '../../shouldHideEvent';
|
import shouldHideEvent from '../../shouldHideEvent';
|
||||||
import {wantsDateSeparator} from '../../DateUtils';
|
import {wantsDateSeparator} from '../../DateUtils';
|
||||||
import * as sdk from '../../index';
|
import * as sdk from '../../index';
|
||||||
import dis from "../../dispatcher/dispatcher";
|
|
||||||
|
|
||||||
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
||||||
import SettingsStore from '../../settings/SettingsStore';
|
import SettingsStore from '../../settings/SettingsStore';
|
||||||
|
@ -47,6 +46,9 @@ function shouldFormContinuation(prevEvent, mxEvent) {
|
||||||
// check if within the max continuation period
|
// check if within the max continuation period
|
||||||
if (mxEvent.getTs() - prevEvent.getTs() > CONTINUATION_MAX_INTERVAL) return false;
|
if (mxEvent.getTs() - prevEvent.getTs() > CONTINUATION_MAX_INTERVAL) return false;
|
||||||
|
|
||||||
|
// As we summarise redactions, do not continue a redacted event onto a non-redacted one and vice-versa
|
||||||
|
if (mxEvent.isRedacted() !== prevEvent.isRedacted()) return false;
|
||||||
|
|
||||||
// Some events should appear as continuations from previous events of different types.
|
// Some events should appear as continuations from previous events of different types.
|
||||||
if (mxEvent.getType() !== prevEvent.getType() &&
|
if (mxEvent.getType() !== prevEvent.getType() &&
|
||||||
(!continuedTypes.includes(mxEvent.getType()) ||
|
(!continuedTypes.includes(mxEvent.getType()) ||
|
||||||
|
@ -210,13 +212,11 @@ export default class MessagePanel extends React.Component {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._isMounted = true;
|
this._isMounted = true;
|
||||||
this.dispatcherRef = dis.register(this.onAction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this._isMounted = false;
|
this._isMounted = false;
|
||||||
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
|
SettingsStore.unwatchSetting(this._showTypingNotificationsWatcherRef);
|
||||||
dis.unregister(this.dispatcherRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
|
@ -229,14 +229,6 @@ export default class MessagePanel extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onAction = (payload) => {
|
|
||||||
switch (payload.action) {
|
|
||||||
case "scroll_to_bottom":
|
|
||||||
this.scrollToBottom();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onShowTypingNotificationsChange = () => {
|
onShowTypingNotificationsChange = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
|
showTypingNotifications: SettingsStore.getValue("showTypingNotifications"),
|
||||||
|
@ -463,6 +455,20 @@ export default class MessagePanel extends React.Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_getNextEventInfo(arr, i) {
|
||||||
|
const nextEvent = i < arr.length - 1
|
||||||
|
? arr[i + 1]
|
||||||
|
: null;
|
||||||
|
|
||||||
|
// The next event with tile is used to to determine the 'last successful' flag
|
||||||
|
// when rendering the tile. The shouldShowEvent function is pretty quick at what
|
||||||
|
// it does, so this should have no significant cost even when a room is used for
|
||||||
|
// not-chat purposes.
|
||||||
|
const nextTile = arr.slice(i + 1).find(e => this._shouldShowEvent(e));
|
||||||
|
|
||||||
|
return {nextEvent, nextTile};
|
||||||
|
}
|
||||||
|
|
||||||
_getEventTiles() {
|
_getEventTiles() {
|
||||||
this.eventNodes = {};
|
this.eventNodes = {};
|
||||||
|
|
||||||
|
@ -514,6 +520,7 @@ export default class MessagePanel extends React.Component {
|
||||||
const mxEv = this.props.events[i];
|
const mxEv = this.props.events[i];
|
||||||
const eventId = mxEv.getId();
|
const eventId = mxEv.getId();
|
||||||
const last = (mxEv === lastShownEvent);
|
const last = (mxEv === lastShownEvent);
|
||||||
|
const {nextEvent, nextTile} = this._getNextEventInfo(this.props.events, i);
|
||||||
|
|
||||||
if (grouper) {
|
if (grouper) {
|
||||||
if (grouper.shouldGroup(mxEv)) {
|
if (grouper.shouldGroup(mxEv)) {
|
||||||
|
@ -530,22 +537,12 @@ export default class MessagePanel extends React.Component {
|
||||||
|
|
||||||
for (const Grouper of groupers) {
|
for (const Grouper of groupers) {
|
||||||
if (Grouper.canStartGroup(this, mxEv)) {
|
if (Grouper.canStartGroup(this, mxEv)) {
|
||||||
grouper = new Grouper(this, mxEv, prevEvent, lastShownEvent);
|
grouper = new Grouper(this, mxEv, prevEvent, lastShownEvent, nextEvent, nextTile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!grouper) {
|
if (!grouper) {
|
||||||
const wantTile = this._shouldShowEvent(mxEv);
|
const wantTile = this._shouldShowEvent(mxEv);
|
||||||
if (wantTile) {
|
if (wantTile) {
|
||||||
const nextEvent = i < this.props.events.length - 1
|
|
||||||
? this.props.events[i + 1]
|
|
||||||
: null;
|
|
||||||
|
|
||||||
// The next event with tile is used to to determine the 'last successful' flag
|
|
||||||
// when rendering the tile. The shouldShowEvent function is pretty quick at what
|
|
||||||
// it does, so this should have no significant cost even when a room is used for
|
|
||||||
// not-chat purposes.
|
|
||||||
const nextTile = this.props.events.slice(i + 1).find(e => this._shouldShowEvent(e));
|
|
||||||
|
|
||||||
// make sure we unpack the array returned by _getTilesForEvent,
|
// make sure we unpack the array returned by _getTilesForEvent,
|
||||||
// otherwise react will auto-generate keys and we will end up
|
// otherwise react will auto-generate keys and we will end up
|
||||||
// replacing all of the DOM elements every time we paginate.
|
// replacing all of the DOM elements every time we paginate.
|
||||||
|
@ -1038,6 +1035,103 @@ class CreationGrouper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RedactionGrouper {
|
||||||
|
static canStartGroup = function(panel, ev) {
|
||||||
|
return panel._shouldShowEvent(ev) && ev.isRedacted();
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(panel, ev, prevEvent, lastShownEvent, nextEvent, nextEventTile) {
|
||||||
|
this.panel = panel;
|
||||||
|
this.readMarker = panel._readMarkerForEvent(
|
||||||
|
ev.getId(),
|
||||||
|
ev === lastShownEvent,
|
||||||
|
);
|
||||||
|
this.events = [ev];
|
||||||
|
this.prevEvent = prevEvent;
|
||||||
|
this.lastShownEvent = lastShownEvent;
|
||||||
|
this.nextEvent = nextEvent;
|
||||||
|
this.nextEventTile = nextEventTile;
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldGroup(ev) {
|
||||||
|
// absorb hidden events so that they do not break up streams of messages & redaction events being grouped
|
||||||
|
if (!this.panel._shouldShowEvent(ev)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this.panel._wantsDateSeparator(this.events[0], ev.getDate())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return ev.isRedacted();
|
||||||
|
}
|
||||||
|
|
||||||
|
add(ev) {
|
||||||
|
this.readMarker = this.readMarker || this.panel._readMarkerForEvent(
|
||||||
|
ev.getId(),
|
||||||
|
ev === this.lastShownEvent,
|
||||||
|
);
|
||||||
|
if (!this.panel._shouldShowEvent(ev)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.events.push(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
getTiles() {
|
||||||
|
if (!this.events || !this.events.length) return [];
|
||||||
|
|
||||||
|
const DateSeparator = sdk.getComponent('messages.DateSeparator');
|
||||||
|
const EventListSummary = sdk.getComponent('views.elements.EventListSummary');
|
||||||
|
|
||||||
|
const panel = this.panel;
|
||||||
|
const ret = [];
|
||||||
|
const lastShownEvent = this.lastShownEvent;
|
||||||
|
|
||||||
|
if (panel._wantsDateSeparator(this.prevEvent, this.events[0].getDate())) {
|
||||||
|
const ts = this.events[0].getTs();
|
||||||
|
ret.push(
|
||||||
|
<li key={ts+'~'}><DateSeparator key={ts+'~'} ts={ts} /></li>,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = "redactioneventlistsummary-" + (
|
||||||
|
this.prevEvent ? this.events[0].getId() : "initial"
|
||||||
|
);
|
||||||
|
|
||||||
|
const senders = new Set();
|
||||||
|
let eventTiles = this.events.map((e, i) => {
|
||||||
|
senders.add(e.sender);
|
||||||
|
const prevEvent = i === 0 ? this.prevEvent : this.events[i - 1];
|
||||||
|
return panel._getTilesForEvent(prevEvent, e, e === lastShownEvent, this.nextEvent, this.nextEventTile);
|
||||||
|
}).reduce((a, b) => a.concat(b), []);
|
||||||
|
|
||||||
|
if (eventTiles.length === 0) {
|
||||||
|
eventTiles = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret.push(
|
||||||
|
<EventListSummary
|
||||||
|
key={key}
|
||||||
|
threshold={2}
|
||||||
|
events={this.events}
|
||||||
|
onToggle={panel._onHeightChanged} // Update scroll state
|
||||||
|
summaryMembers={Array.from(senders)}
|
||||||
|
summaryText={_t("%(count)s messages deleted.", { count: eventTiles.length })}
|
||||||
|
>
|
||||||
|
{ eventTiles }
|
||||||
|
</EventListSummary>,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (this.readMarker) {
|
||||||
|
ret.push(this.readMarker);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
getNewPrevEvent() {
|
||||||
|
return this.events[this.events.length - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Wrap consecutive member events in a ListSummary, ignore if redacted
|
// Wrap consecutive member events in a ListSummary, ignore if redacted
|
||||||
class MemberGrouper {
|
class MemberGrouper {
|
||||||
static canStartGroup = function(panel, ev) {
|
static canStartGroup = function(panel, ev) {
|
||||||
|
@ -1148,4 +1242,4 @@ class MemberGrouper {
|
||||||
}
|
}
|
||||||
|
|
||||||
// all the grouper classes that we use
|
// all the grouper classes that we use
|
||||||
const groupers = [CreationGrouper, MemberGrouper];
|
const groupers = [CreationGrouper, MemberGrouper, RedactionGrouper];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2020 The Matrix.org Foundation C.I.C.
|
Copyright 2020, 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -20,17 +20,21 @@ import classNames from "classnames";
|
||||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||||
import { _t } from "../../languageHandler";
|
import { _t } from "../../languageHandler";
|
||||||
import { ActionPayload } from "../../dispatcher/payloads";
|
import { ActionPayload } from "../../dispatcher/payloads";
|
||||||
import { Key } from "../../Keyboard";
|
|
||||||
import AccessibleButton from "../views/elements/AccessibleButton";
|
import AccessibleButton from "../views/elements/AccessibleButton";
|
||||||
import { Action } from "../../dispatcher/actions";
|
import { Action } from "../../dispatcher/actions";
|
||||||
import RoomListStore from "../../stores/room-list/RoomListStore";
|
import RoomListStore from "../../stores/room-list/RoomListStore";
|
||||||
import { NameFilterCondition } from "../../stores/room-list/filters/NameFilterCondition";
|
import { NameFilterCondition } from "../../stores/room-list/filters/NameFilterCondition";
|
||||||
|
import { getKeyBindingsManager, RoomListAction } from "../../KeyBindingsManager";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
import SpaceStore, {UPDATE_SELECTED_SPACE} from "../../stores/SpaceStore";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
isMinimized: boolean;
|
isMinimized: boolean;
|
||||||
onVerticalArrow(ev: React.KeyboardEvent): void;
|
onKeyDown(ev: React.KeyboardEvent): void;
|
||||||
onEnter(ev: React.KeyboardEvent): boolean;
|
/**
|
||||||
|
* @returns true if a room has been selected and the search field should be cleared
|
||||||
|
*/
|
||||||
|
onSelectRoom(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
@ -53,6 +57,8 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dispatcherRef = defaultDispatcher.register(this.onAction);
|
this.dispatcherRef = defaultDispatcher.register(this.onAction);
|
||||||
|
// clear filter when changing spaces, in future we may wish to maintain a filter per-space
|
||||||
|
SpaceStore.instance.on(UPDATE_SELECTED_SPACE, this.clearInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<IState>): void {
|
public componentDidUpdate(prevProps: Readonly<IProps>, prevState: Readonly<IState>): void {
|
||||||
|
@ -72,6 +78,7 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
|
||||||
|
|
||||||
public componentWillUnmount() {
|
public componentWillUnmount() {
|
||||||
defaultDispatcher.unregister(this.dispatcherRef);
|
defaultDispatcher.unregister(this.dispatcherRef);
|
||||||
|
SpaceStore.instance.off(UPDATE_SELECTED_SPACE, this.clearInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onAction = (payload: ActionPayload) => {
|
private onAction = (payload: ActionPayload) => {
|
||||||
|
@ -108,19 +115,27 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private onKeyDown = (ev: React.KeyboardEvent) => {
|
private onKeyDown = (ev: React.KeyboardEvent) => {
|
||||||
if (ev.key === Key.ESCAPE) {
|
const action = getKeyBindingsManager().getRoomListAction(ev);
|
||||||
|
switch (action) {
|
||||||
|
case RoomListAction.ClearSearch:
|
||||||
this.clearInput();
|
this.clearInput();
|
||||||
defaultDispatcher.fire(Action.FocusComposer);
|
defaultDispatcher.fire(Action.FocusComposer);
|
||||||
} else if (ev.key === Key.ARROW_UP || ev.key === Key.ARROW_DOWN) {
|
break;
|
||||||
this.props.onVerticalArrow(ev);
|
case RoomListAction.NextRoom:
|
||||||
} else if (ev.key === Key.ENTER) {
|
case RoomListAction.PrevRoom:
|
||||||
const shouldClear = this.props.onEnter(ev);
|
// we don't handle these actions here put pass the event on to the interested party (LeftPanel)
|
||||||
|
this.props.onKeyDown(ev);
|
||||||
|
break;
|
||||||
|
case RoomListAction.SelectRoom: {
|
||||||
|
const shouldClear = this.props.onSelectRoom();
|
||||||
if (shouldClear) {
|
if (shouldClear) {
|
||||||
// wrap in set immediate to delay it so that we don't clear the filter & then change room
|
// wrap in set immediate to delay it so that we don't clear the filter & then change room
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
this.clearInput();
|
this.clearInput();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Matrix from 'matrix-js-sdk';
|
|
||||||
import { _t, _td } from '../../languageHandler';
|
import { _t, _td } from '../../languageHandler';
|
||||||
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../MatrixClientPeg';
|
||||||
import Resend from '../../Resend';
|
import Resend from '../../Resend';
|
||||||
|
@ -24,6 +23,7 @@ import dis from '../../dispatcher/dispatcher';
|
||||||
import {messageForResourceLimitError, messageForSendError} from '../../utils/ErrorUtils';
|
import {messageForResourceLimitError, messageForSendError} from '../../utils/ErrorUtils';
|
||||||
import {Action} from "../../dispatcher/actions";
|
import {Action} from "../../dispatcher/actions";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
import {EventStatus} from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
const STATUS_BAR_HIDDEN = 0;
|
const STATUS_BAR_HIDDEN = 0;
|
||||||
const STATUS_BAR_EXPANDED = 1;
|
const STATUS_BAR_EXPANDED = 1;
|
||||||
|
@ -32,7 +32,7 @@ const STATUS_BAR_EXPANDED_LARGE = 2;
|
||||||
function getUnsentMessages(room) {
|
function getUnsentMessages(room) {
|
||||||
if (!room) { return []; }
|
if (!room) { return []; }
|
||||||
return room.getPendingEvents().filter(function(ev) {
|
return room.getPendingEvents().filter(function(ev) {
|
||||||
return ev.status === Matrix.EventStatus.NOT_SENT;
|
return ev.status === EventStatus.NOT_SENT;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ import Tinter from '../../Tinter';
|
||||||
import rateLimitedFunc from '../../ratelimitedfunc';
|
import rateLimitedFunc from '../../ratelimitedfunc';
|
||||||
import * as Rooms from '../../Rooms';
|
import * as Rooms from '../../Rooms';
|
||||||
import eventSearch, { searchPagination } from '../../Searching';
|
import eventSearch, { searchPagination } from '../../Searching';
|
||||||
import { isOnlyCtrlOrCmdIgnoreShiftKeyEvent, Key } from '../../Keyboard';
|
|
||||||
import MainSplit from './MainSplit';
|
import MainSplit from './MainSplit';
|
||||||
import RightPanel from './RightPanel';
|
import RightPanel from './RightPanel';
|
||||||
import RoomViewStore from '../../stores/RoomViewStore';
|
import RoomViewStore from '../../stores/RoomViewStore';
|
||||||
|
@ -79,6 +78,7 @@ import Notifier from "../../Notifier";
|
||||||
import { showToast as showNotificationsToast } from "../../toasts/DesktopNotificationsToast";
|
import { showToast as showNotificationsToast } from "../../toasts/DesktopNotificationsToast";
|
||||||
import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore";
|
import { RoomNotificationStateStore } from "../../stores/notifications/RoomNotificationStateStore";
|
||||||
import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutStore";
|
import { Container, WidgetLayoutStore } from "../../stores/widgets/WidgetLayoutStore";
|
||||||
|
import { getKeyBindingsManager, RoomAction } from '../../KeyBindingsManager';
|
||||||
import { objectHasDiff } from "../../utils/objects";
|
import { objectHasDiff } from "../../utils/objects";
|
||||||
import SpaceRoomView from "./SpaceRoomView";
|
import SpaceRoomView from "./SpaceRoomView";
|
||||||
import { IOpts } from "../../createRoom";
|
import { IOpts } from "../../createRoom";
|
||||||
|
@ -112,10 +112,6 @@ interface IProps {
|
||||||
inviterName?: string;
|
inviterName?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Servers the RoomView can use to try and assist joins
|
|
||||||
viaServers?: string[];
|
|
||||||
|
|
||||||
autoJoin?: boolean;
|
|
||||||
resizeNotifier: ResizeNotifier;
|
resizeNotifier: ResizeNotifier;
|
||||||
justCreatedOpts?: IOpts;
|
justCreatedOpts?: IOpts;
|
||||||
|
|
||||||
|
@ -450,9 +446,7 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
// now not joined because the js-sdk peeking API will clobber our historical room,
|
// now not joined because the js-sdk peeking API will clobber our historical room,
|
||||||
// making it impossible to indicate a newly joined room.
|
// making it impossible to indicate a newly joined room.
|
||||||
if (!joining && roomId) {
|
if (!joining && roomId) {
|
||||||
if (this.props.autoJoin) {
|
if (!room && shouldPeek) {
|
||||||
this.onJoinButtonClicked();
|
|
||||||
} else if (!room && shouldPeek) {
|
|
||||||
console.info("Attempting to peek into room %s", roomId);
|
console.info("Attempting to peek into room %s", roomId);
|
||||||
this.setState({
|
this.setState({
|
||||||
peekLoading: true,
|
peekLoading: true,
|
||||||
|
@ -668,26 +662,20 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
private onReactKeyDown = ev => {
|
private onReactKeyDown = ev => {
|
||||||
let handled = false;
|
let handled = false;
|
||||||
|
|
||||||
switch (ev.key) {
|
const action = getKeyBindingsManager().getRoomAction(ev);
|
||||||
case Key.ESCAPE:
|
switch (action) {
|
||||||
if (!ev.altKey && !ev.ctrlKey && !ev.shiftKey && !ev.metaKey) {
|
case RoomAction.DismissReadMarker:
|
||||||
this.messagePanel.forgetReadMarker();
|
this.messagePanel.forgetReadMarker();
|
||||||
this.jumpToLiveTimeline();
|
this.jumpToLiveTimeline();
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Key.PAGE_UP:
|
case RoomAction.JumpToOldestUnread:
|
||||||
if (!ev.altKey && !ev.ctrlKey && ev.shiftKey && !ev.metaKey) {
|
|
||||||
this.jumpToReadMarker();
|
this.jumpToReadMarker();
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Key.U: // Mac returns lowercase
|
case RoomAction.UploadFile:
|
||||||
case Key.U.toUpperCase():
|
|
||||||
if (isOnlyCtrlOrCmdIgnoreShiftKeyEvent(ev) && ev.shiftKey) {
|
|
||||||
dis.dispatch({ action: "upload_file" }, true);
|
dis.dispatch({ action: "upload_file" }, true);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1123,7 +1111,7 @@ export default class RoomView extends React.Component<IProps, IState> {
|
||||||
const signUrl = this.props.threepidInvite?.signUrl;
|
const signUrl = this.props.threepidInvite?.signUrl;
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'join_room',
|
action: 'join_room',
|
||||||
opts: { inviteSignUrl: signUrl, viaServers: this.props.viaServers },
|
opts: { inviteSignUrl: signUrl },
|
||||||
_type: "unknown", // TODO: instrumentation
|
_type: "unknown", // TODO: instrumentation
|
||||||
});
|
});
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
|
@ -16,10 +16,10 @@ limitations under the License.
|
||||||
|
|
||||||
import React, {createRef} from "react";
|
import React, {createRef} from "react";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Key } from '../../Keyboard';
|
|
||||||
import Timer from '../../utils/Timer';
|
import Timer from '../../utils/Timer';
|
||||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
import {getKeyBindingsManager, RoomAction} from "../../KeyBindingsManager";
|
||||||
|
|
||||||
const DEBUG_SCROLL = false;
|
const DEBUG_SCROLL = false;
|
||||||
|
|
||||||
|
@ -535,29 +535,19 @@ export default class ScrollPanel extends React.Component {
|
||||||
* @param {object} ev the keyboard event
|
* @param {object} ev the keyboard event
|
||||||
*/
|
*/
|
||||||
handleScrollKey = ev => {
|
handleScrollKey = ev => {
|
||||||
switch (ev.key) {
|
const roomAction = getKeyBindingsManager().getRoomAction(ev);
|
||||||
case Key.PAGE_UP:
|
switch (roomAction) {
|
||||||
if (!ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
|
case RoomAction.ScrollUp:
|
||||||
this.scrollRelative(-1);
|
this.scrollRelative(-1);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case RoomAction.RoomScrollDown:
|
||||||
case Key.PAGE_DOWN:
|
|
||||||
if (!ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
|
|
||||||
this.scrollRelative(1);
|
this.scrollRelative(1);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case RoomAction.JumpToFirstMessage:
|
||||||
case Key.HOME:
|
|
||||||
if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
|
|
||||||
this.scrollToTop();
|
this.scrollToTop();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
case RoomAction.JumpToLatestMessage:
|
||||||
case Key.END:
|
|
||||||
if (ev.ctrlKey && !ev.shiftKey && !ev.altKey && !ev.metaKey) {
|
|
||||||
this.scrollToBottom();
|
this.scrollToBottom();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,6 +32,8 @@ export default class SearchBox extends React.Component {
|
||||||
onKeyDown: PropTypes.func,
|
onKeyDown: PropTypes.func,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
placeholder: PropTypes.string.isRequired,
|
placeholder: PropTypes.string.isRequired,
|
||||||
|
autoFocus: PropTypes.bool,
|
||||||
|
initialValue: PropTypes.string,
|
||||||
|
|
||||||
// If true, the search box will focus and clear itself
|
// If true, the search box will focus and clear itself
|
||||||
// on room search focus action (it would be nicer to take
|
// on room search focus action (it would be nicer to take
|
||||||
|
@ -49,7 +51,7 @@ export default class SearchBox extends React.Component {
|
||||||
this._search = createRef();
|
this._search = createRef();
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
searchTerm: "",
|
searchTerm: this.props.initialValue || "",
|
||||||
blurred: true,
|
blurred: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -158,6 +160,7 @@ export default class SearchBox extends React.Component {
|
||||||
onBlur={this._onBlur}
|
onBlur={this._onBlur}
|
||||||
placeholder={ placeholder }
|
placeholder={ placeholder }
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
|
autoFocus={this.props.autoFocus}
|
||||||
/>
|
/>
|
||||||
{ clearButton }
|
{ clearButton }
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,32 +14,37 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {useMemo, useRef, useState} from "react";
|
import React, {useMemo, useState} from "react";
|
||||||
import Room from "matrix-js-sdk/src/models/room";
|
import {Room} from "matrix-js-sdk/src/models/room";
|
||||||
import MatrixEvent from "matrix-js-sdk/src/models/event";
|
import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||||
import {EventType, RoomType} from "matrix-js-sdk/src/@types/event";
|
import {EventType, RoomType} from "matrix-js-sdk/src/@types/event";
|
||||||
|
import classNames from "classnames";
|
||||||
|
import {sortBy} from "lodash";
|
||||||
|
|
||||||
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
||||||
import dis from "../../dispatcher/dispatcher";
|
import dis from "../../dispatcher/dispatcher";
|
||||||
import {_t} from "../../languageHandler";
|
import {_t} from "../../languageHandler";
|
||||||
import AccessibleButton from "../views/elements/AccessibleButton";
|
import AccessibleButton from "../views/elements/AccessibleButton";
|
||||||
import BaseDialog from "../views/dialogs/BaseDialog";
|
import BaseDialog from "../views/dialogs/BaseDialog";
|
||||||
import FormButton from "../views/elements/FormButton";
|
import Spinner from "../views/elements/Spinner";
|
||||||
import SearchBox from "./SearchBox";
|
import SearchBox from "./SearchBox";
|
||||||
import RoomAvatar from "../views/avatars/RoomAvatar";
|
import RoomAvatar from "../views/avatars/RoomAvatar";
|
||||||
import RoomName from "../views/elements/RoomName";
|
import RoomName from "../views/elements/RoomName";
|
||||||
import {useAsyncMemo} from "../../hooks/useAsyncMemo";
|
import {useAsyncMemo} from "../../hooks/useAsyncMemo";
|
||||||
import {shouldShowSpaceSettings} from "../../utils/space";
|
|
||||||
import {EnhancedMap} from "../../utils/maps";
|
import {EnhancedMap} from "../../utils/maps";
|
||||||
import StyledCheckbox from "../views/elements/StyledCheckbox";
|
import StyledCheckbox from "../views/elements/StyledCheckbox";
|
||||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
import AutoHideScrollbar from "./AutoHideScrollbar";
|
||||||
import BaseAvatar from "../views/avatars/BaseAvatar";
|
import BaseAvatar from "../views/avatars/BaseAvatar";
|
||||||
import {mediaFromMxc} from "../../customisations/Media";
|
import {mediaFromMxc} from "../../customisations/Media";
|
||||||
|
import InfoTooltip from "../views/elements/InfoTooltip";
|
||||||
|
import TextWithTooltip from "../views/elements/TextWithTooltip";
|
||||||
|
import {useStateToggle} from "../../hooks/useStateToggle";
|
||||||
|
|
||||||
interface IProps {
|
interface IHierarchyProps {
|
||||||
space: Room;
|
space: Room;
|
||||||
initialText?: string;
|
initialText?: string;
|
||||||
onFinished(): void;
|
refreshToken?: any;
|
||||||
|
showRoom(room: ISpaceSummaryRoom, viaServers?: string[], autoJoin?: boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
@ -72,227 +77,131 @@ export interface ISpaceSummaryEvent {
|
||||||
}
|
}
|
||||||
/* eslint-enable camelcase */
|
/* eslint-enable camelcase */
|
||||||
|
|
||||||
interface ISubspaceProps {
|
interface ITileProps {
|
||||||
space: ISpaceSummaryRoom;
|
room: ISpaceSummaryRoom;
|
||||||
event?: MatrixEvent;
|
suggested?: boolean;
|
||||||
editing?: boolean;
|
selected?: boolean;
|
||||||
onPreviewClick?(): void;
|
numChildRooms?: number;
|
||||||
queueAction?(action: IAction): void;
|
hasPermissions?: boolean;
|
||||||
onJoinClick?(): void;
|
onViewRoomClick(autoJoin: boolean): void;
|
||||||
|
onToggleClick?(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SubSpace: React.FC<ISubspaceProps> = ({
|
const Tile: React.FC<ITileProps> = ({
|
||||||
space,
|
room,
|
||||||
editing,
|
suggested,
|
||||||
event,
|
selected,
|
||||||
queueAction,
|
hasPermissions,
|
||||||
onJoinClick,
|
onToggleClick,
|
||||||
onPreviewClick,
|
onViewRoomClick,
|
||||||
|
numChildRooms,
|
||||||
children,
|
children,
|
||||||
}) => {
|
}) => {
|
||||||
const name = space.name || space.canonical_alias || space.aliases?.[0] || _t("Unnamed Space");
|
const name = room.name || room.canonical_alias || room.aliases?.[0]
|
||||||
|
|| (room.room_type === RoomType.Space ? _t("Unnamed Space") : _t("Unnamed Room"));
|
||||||
|
|
||||||
const evContent = event?.getContent();
|
const [showChildren, toggleShowChildren] = useStateToggle(true);
|
||||||
const [suggested, _setSuggested] = useState(evContent?.suggested);
|
|
||||||
const [removed, _setRemoved] = useState(!evContent?.via);
|
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
|
||||||
const cliRoom = cli.getRoom(space.room_id);
|
|
||||||
const myMembership = cliRoom?.getMyMembership();
|
|
||||||
|
|
||||||
// TODO DRY code
|
|
||||||
let actions;
|
|
||||||
if (editing && queueAction) {
|
|
||||||
if (event && cli.getRoom(event.getRoomId())?.currentState.maySendStateEvent(event.getType(), cli.getUserId())) {
|
|
||||||
const setSuggested = () => {
|
|
||||||
_setSuggested(v => {
|
|
||||||
queueAction({
|
|
||||||
event,
|
|
||||||
removed,
|
|
||||||
suggested: !v,
|
|
||||||
});
|
|
||||||
return !v;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const setRemoved = () => {
|
|
||||||
_setRemoved(v => {
|
|
||||||
queueAction({
|
|
||||||
event,
|
|
||||||
removed: !v,
|
|
||||||
suggested,
|
|
||||||
});
|
|
||||||
return !v;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (removed) {
|
|
||||||
actions = <React.Fragment>
|
|
||||||
<FormButton kind="danger" onClick={setRemoved} label={_t("Undo")} />
|
|
||||||
</React.Fragment>;
|
|
||||||
} else {
|
|
||||||
actions = <React.Fragment>
|
|
||||||
<FormButton kind="danger" onClick={setRemoved} label={_t("Remove from Space")} />
|
|
||||||
<StyledCheckbox checked={suggested} onChange={setSuggested} />
|
|
||||||
</React.Fragment>;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
actions = <span className="mx_SpaceRoomDirectory_actionsText">
|
|
||||||
{ _t("No permissions")}
|
|
||||||
</span>;
|
|
||||||
}
|
|
||||||
// TODO confirm remove from space click behaviour here
|
|
||||||
} else {
|
|
||||||
if (myMembership === "join") {
|
|
||||||
actions = <span className="mx_SpaceRoomDirectory_actionsText">
|
|
||||||
{ _t("You're in this space")}
|
|
||||||
</span>;
|
|
||||||
} else if (onJoinClick) {
|
|
||||||
actions = <React.Fragment>
|
|
||||||
<AccessibleButton onClick={onPreviewClick} kind="link">
|
|
||||||
{ _t("Preview") }
|
|
||||||
</AccessibleButton>
|
|
||||||
<FormButton onClick={onJoinClick} label={_t("Join")} />
|
|
||||||
</React.Fragment>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let url: string;
|
|
||||||
if (space.avatar_url) {
|
|
||||||
url = mediaFromMxc(space.avatar_url).getSquareThumbnailHttp(Math.floor(24 * window.devicePixelRatio));
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div className="mx_SpaceRoomDirectory_subspace">
|
|
||||||
<div className="mx_SpaceRoomDirectory_subspace_info">
|
|
||||||
<BaseAvatar name={name} idName={space.room_id} url={url} width={24} height={24} />
|
|
||||||
{ name }
|
|
||||||
|
|
||||||
<div className="mx_SpaceRoomDirectory_actions">
|
|
||||||
{ actions }
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mx_SpaceRoomDirectory_subspace_children">
|
|
||||||
{ children }
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
};
|
|
||||||
|
|
||||||
interface IAction {
|
|
||||||
event: MatrixEvent;
|
|
||||||
suggested: boolean;
|
|
||||||
removed: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRoomTileProps {
|
|
||||||
room: ISpaceSummaryRoom;
|
|
||||||
event?: MatrixEvent;
|
|
||||||
editing?: boolean;
|
|
||||||
onPreviewClick(): void;
|
|
||||||
queueAction?(action: IAction): void;
|
|
||||||
onJoinClick?(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RoomTile = ({ room, event, editing, queueAction, onPreviewClick, onJoinClick }: IRoomTileProps) => {
|
|
||||||
const name = room.name || room.canonical_alias || room.aliases?.[0] || _t("Unnamed Room");
|
|
||||||
|
|
||||||
const evContent = event?.getContent();
|
|
||||||
const [suggested, _setSuggested] = useState(evContent?.suggested);
|
|
||||||
const [removed, _setRemoved] = useState(!evContent?.via);
|
|
||||||
|
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const cliRoom = cli.getRoom(room.room_id);
|
const cliRoom = cli.getRoom(room.room_id);
|
||||||
const myMembership = cliRoom?.getMyMembership();
|
const myMembership = cliRoom?.getMyMembership();
|
||||||
|
|
||||||
let actions;
|
const onPreviewClick = () => onViewRoomClick(false);
|
||||||
if (editing && queueAction) {
|
const onJoinClick = () => onViewRoomClick(true);
|
||||||
if (event && cli.getRoom(event.getRoomId())?.currentState.maySendStateEvent(event.getType(), cli.getUserId())) {
|
|
||||||
const setSuggested = () => {
|
|
||||||
_setSuggested(v => {
|
|
||||||
queueAction({
|
|
||||||
event,
|
|
||||||
removed,
|
|
||||||
suggested: !v,
|
|
||||||
});
|
|
||||||
return !v;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const setRemoved = () => {
|
let button;
|
||||||
_setRemoved(v => {
|
|
||||||
queueAction({
|
|
||||||
event,
|
|
||||||
removed: !v,
|
|
||||||
suggested,
|
|
||||||
});
|
|
||||||
return !v;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (removed) {
|
|
||||||
actions = <React.Fragment>
|
|
||||||
<FormButton kind="danger" onClick={setRemoved} label={_t("Undo")} />
|
|
||||||
</React.Fragment>;
|
|
||||||
} else {
|
|
||||||
actions = <React.Fragment>
|
|
||||||
<FormButton kind="danger" onClick={setRemoved} label={_t("Remove from Space")} />
|
|
||||||
<StyledCheckbox checked={suggested} onChange={setSuggested} />
|
|
||||||
</React.Fragment>;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
actions = <span className="mx_SpaceRoomDirectory_actionsText">
|
|
||||||
{ _t("No permissions")}
|
|
||||||
</span>;
|
|
||||||
}
|
|
||||||
// TODO confirm remove from space click behaviour here
|
|
||||||
} else {
|
|
||||||
if (myMembership === "join") {
|
if (myMembership === "join") {
|
||||||
actions = <span className="mx_SpaceRoomDirectory_actionsText">
|
button = <AccessibleButton onClick={onPreviewClick} kind="primary_outline">
|
||||||
{ _t("You're in this room")}
|
{ _t("View") }
|
||||||
</span>;
|
</AccessibleButton>;
|
||||||
} else if (onJoinClick) {
|
} else if (onJoinClick) {
|
||||||
actions = <React.Fragment>
|
button = <AccessibleButton onClick={onJoinClick} kind="primary">
|
||||||
<AccessibleButton onClick={onPreviewClick} kind="link">
|
{ _t("Join") }
|
||||||
{ _t("Preview") }
|
</AccessibleButton>;
|
||||||
</AccessibleButton>
|
}
|
||||||
<FormButton onClick={onJoinClick} label={_t("Join")} />
|
|
||||||
</React.Fragment>
|
let checkbox;
|
||||||
|
if (onToggleClick) {
|
||||||
|
if (hasPermissions) {
|
||||||
|
checkbox = <StyledCheckbox checked={!!selected} onChange={onToggleClick} />;
|
||||||
|
} else {
|
||||||
|
checkbox = <TextWithTooltip
|
||||||
|
tooltip={_t("You don't have permission")}
|
||||||
|
onClick={ev => { ev.stopPropagation() }}
|
||||||
|
>
|
||||||
|
<StyledCheckbox disabled={true} />
|
||||||
|
</TextWithTooltip>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let url: string;
|
let url: string;
|
||||||
if (room.avatar_url) {
|
if (room.avatar_url) {
|
||||||
url = mediaFromMxc(room.avatar_url).getSquareThumbnailHttp(Math.floor(32 * window.devicePixelRatio));
|
url = mediaFromMxc(room.avatar_url).getSquareThumbnailHttp(Math.floor(20 * window.devicePixelRatio));
|
||||||
|
}
|
||||||
|
|
||||||
|
let description = _t("%(count)s members", { count: room.num_joined_members });
|
||||||
|
if (numChildRooms) {
|
||||||
|
description += " · " + _t("%(count)s rooms", { count: numChildRooms });
|
||||||
|
}
|
||||||
|
if (room.topic) {
|
||||||
|
description += " · " + room.topic;
|
||||||
|
}
|
||||||
|
|
||||||
|
let suggestedSection;
|
||||||
|
if (suggested) {
|
||||||
|
suggestedSection = <InfoTooltip tooltip={_t("This room is suggested as a good one to join")}>
|
||||||
|
{ _t("Suggested") }
|
||||||
|
</InfoTooltip>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const content = <React.Fragment>
|
const content = <React.Fragment>
|
||||||
<BaseAvatar name={name} idName={room.room_id} url={url} width={32} height={32} />
|
<BaseAvatar name={name} idName={room.room_id} url={url} width={20} height={20} />
|
||||||
|
|
||||||
<div className="mx_SpaceRoomDirectory_roomTile_info">
|
|
||||||
<div className="mx_SpaceRoomDirectory_roomTile_name">
|
<div className="mx_SpaceRoomDirectory_roomTile_name">
|
||||||
{ name }
|
{ name }
|
||||||
</div>
|
{ suggestedSection }
|
||||||
<div className="mx_SpaceRoomDirectory_roomTile_topic">
|
|
||||||
{ room.topic }
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mx_SpaceRoomDirectory_roomTile_memberCount">
|
|
||||||
{ room.num_joined_members }
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="mx_SpaceRoomDirectory_roomTile_info">
|
||||||
|
{ description }
|
||||||
|
</div>
|
||||||
<div className="mx_SpaceRoomDirectory_actions">
|
<div className="mx_SpaceRoomDirectory_actions">
|
||||||
{ actions }
|
{ button }
|
||||||
|
{ checkbox }
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>;
|
</React.Fragment>;
|
||||||
|
|
||||||
if (editing) {
|
let childToggle;
|
||||||
return <div className="mx_SpaceRoomDirectory_roomTile">
|
let childSection;
|
||||||
{ content }
|
if (children) {
|
||||||
</div>
|
// the chevron is purposefully a div rather than a button as it should be ignored for a11y
|
||||||
|
childToggle = <div
|
||||||
|
className={classNames("mx_SpaceRoomDirectory_subspace_toggle", {
|
||||||
|
mx_SpaceRoomDirectory_subspace_toggle_shown: showChildren,
|
||||||
|
})}
|
||||||
|
onClick={ev => {
|
||||||
|
ev.stopPropagation();
|
||||||
|
toggleShowChildren();
|
||||||
|
}}
|
||||||
|
/>;
|
||||||
|
if (showChildren) {
|
||||||
|
childSection = <div className="mx_SpaceRoomDirectory_subspace_children">
|
||||||
|
{ children }
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return <AccessibleButton className="mx_SpaceRoomDirectory_roomTile" onClick={onPreviewClick}>
|
return <>
|
||||||
|
<AccessibleButton
|
||||||
|
className={classNames("mx_SpaceRoomDirectory_roomTile", {
|
||||||
|
mx_SpaceRoomDirectory_subspace: room.room_type === RoomType.Space,
|
||||||
|
})}
|
||||||
|
onClick={(hasPermissions && onToggleClick) ? onToggleClick : onPreviewClick}
|
||||||
|
>
|
||||||
{ content }
|
{ content }
|
||||||
</AccessibleButton>;
|
{ childToggle }
|
||||||
|
</AccessibleButton>
|
||||||
|
{ childSection }
|
||||||
|
</>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const showRoom = (room: ISpaceSummaryRoom, viaServers?: string[], autoJoin = false) => {
|
export const showRoom = (room: ISpaceSummaryRoom, viaServers?: string[], autoJoin = false) => {
|
||||||
|
@ -325,99 +234,337 @@ export const showRoom = (room: ISpaceSummaryRoom, viaServers?: string[], autoJoi
|
||||||
interface IHierarchyLevelProps {
|
interface IHierarchyLevelProps {
|
||||||
spaceId: string;
|
spaceId: string;
|
||||||
rooms: Map<string, ISpaceSummaryRoom>;
|
rooms: Map<string, ISpaceSummaryRoom>;
|
||||||
editing?: boolean;
|
relations: Map<string, Map<string, ISpaceSummaryEvent>>;
|
||||||
relations: EnhancedMap<string, string[]>;
|
|
||||||
parents: Set<string>;
|
parents: Set<string>;
|
||||||
queueAction?(action: IAction): void;
|
selectedMap?: Map<string, Set<string>>;
|
||||||
onPreviewClick(roomId: string): void;
|
onViewRoomClick(roomId: string, autoJoin: boolean): void;
|
||||||
onRemoveFromSpaceClick?(roomId: string): void;
|
onToggleClick?(parentId: string, childId: string): void;
|
||||||
onJoinClick?(roomId: string): void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HierarchyLevel = ({
|
export const HierarchyLevel = ({
|
||||||
spaceId,
|
spaceId,
|
||||||
rooms,
|
rooms,
|
||||||
editing,
|
|
||||||
relations,
|
relations,
|
||||||
parents,
|
parents,
|
||||||
onPreviewClick,
|
selectedMap,
|
||||||
onJoinClick,
|
onViewRoomClick,
|
||||||
queueAction,
|
onToggleClick,
|
||||||
}: IHierarchyLevelProps) => {
|
}: IHierarchyLevelProps) => {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const space = cli.getRoom(spaceId);
|
const space = cli.getRoom(spaceId);
|
||||||
// TODO respect order
|
const hasPermissions = space?.currentState.maySendStateEvent(EventType.SpaceChild, cli.getUserId());
|
||||||
const [subspaces, childRooms] = relations.get(spaceId)?.reduce((result, roomId: string) => {
|
|
||||||
if (!rooms.has(roomId)) return result; // TODO wat
|
const sortedChildren = sortBy([...(relations.get(spaceId)?.values() || [])], ev => ev.content.order || null);
|
||||||
|
const [subspaces, childRooms] = sortedChildren.reduce((result, ev: ISpaceSummaryEvent) => {
|
||||||
|
const roomId = ev.state_key;
|
||||||
|
if (!rooms.has(roomId)) return result;
|
||||||
result[rooms.get(roomId).room_type === RoomType.Space ? 0 : 1].push(roomId);
|
result[rooms.get(roomId).room_type === RoomType.Space ? 0 : 1].push(roomId);
|
||||||
return result;
|
return result;
|
||||||
}, [[], []]) || [[], []];
|
}, [[], []]) || [[], []];
|
||||||
|
|
||||||
// Don't render this subspace if it has no rooms we can show
|
|
||||||
// TODO this is broken - as a space may have subspaces we still need to show
|
|
||||||
// if (!childRooms.length) return null;
|
|
||||||
|
|
||||||
const userId = cli.getUserId();
|
|
||||||
|
|
||||||
const newParents = new Set(parents).add(spaceId);
|
const newParents = new Set(parents).add(spaceId);
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
{
|
{
|
||||||
childRooms.map(roomId => (
|
childRooms.map(roomId => (
|
||||||
<RoomTile
|
<Tile
|
||||||
key={roomId}
|
key={roomId}
|
||||||
room={rooms.get(roomId)}
|
room={rooms.get(roomId)}
|
||||||
event={space?.currentState.maySendStateEvent(EventType.SpaceChild, userId)
|
suggested={relations.get(spaceId)?.get(roomId)?.content.suggested}
|
||||||
? space?.currentState.getStateEvents(EventType.SpaceChild, roomId)
|
selected={selectedMap?.get(spaceId)?.has(roomId)}
|
||||||
: undefined}
|
onViewRoomClick={(autoJoin) => {
|
||||||
editing={editing}
|
onViewRoomClick(roomId, autoJoin);
|
||||||
queueAction={queueAction}
|
|
||||||
onPreviewClick={() => {
|
|
||||||
onPreviewClick(roomId);
|
|
||||||
}}
|
}}
|
||||||
onJoinClick={onJoinClick ? () => {
|
hasPermissions={hasPermissions}
|
||||||
onJoinClick(roomId);
|
onToggleClick={onToggleClick ? () => onToggleClick(spaceId, roomId) : undefined}
|
||||||
} : undefined}
|
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
subspaces.filter(roomId => !newParents.has(roomId)).map(roomId => (
|
subspaces.filter(roomId => !newParents.has(roomId)).map(roomId => (
|
||||||
<SubSpace
|
<Tile
|
||||||
key={roomId}
|
key={roomId}
|
||||||
space={rooms.get(roomId)}
|
room={rooms.get(roomId)}
|
||||||
event={space?.currentState.getStateEvents(EventType.SpaceChild, roomId)}
|
numChildRooms={Array.from(relations.get(roomId)?.values() || [])
|
||||||
editing={editing}
|
.filter(ev => rooms.get(ev.state_key)?.room_type !== RoomType.Space).length}
|
||||||
queueAction={queueAction}
|
suggested={relations.get(spaceId)?.get(roomId)?.content.suggested}
|
||||||
onPreviewClick={() => {
|
selected={selectedMap?.get(spaceId)?.has(roomId)}
|
||||||
onPreviewClick(roomId);
|
onViewRoomClick={(autoJoin) => {
|
||||||
}}
|
onViewRoomClick(roomId, autoJoin);
|
||||||
onJoinClick={() => {
|
|
||||||
onJoinClick(roomId);
|
|
||||||
}}
|
}}
|
||||||
|
hasPermissions={hasPermissions}
|
||||||
|
onToggleClick={onToggleClick ? () => onToggleClick(spaceId, roomId) : undefined}
|
||||||
>
|
>
|
||||||
<HierarchyLevel
|
<HierarchyLevel
|
||||||
spaceId={roomId}
|
spaceId={roomId}
|
||||||
rooms={rooms}
|
rooms={rooms}
|
||||||
editing={editing}
|
|
||||||
relations={relations}
|
relations={relations}
|
||||||
parents={newParents}
|
parents={newParents}
|
||||||
onPreviewClick={onPreviewClick}
|
selectedMap={selectedMap}
|
||||||
onJoinClick={onJoinClick}
|
onViewRoomClick={onViewRoomClick}
|
||||||
queueAction={queueAction}
|
onToggleClick={onToggleClick}
|
||||||
/>
|
/>
|
||||||
</SubSpace>
|
</Tile>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
};
|
};
|
||||||
|
|
||||||
const SpaceRoomDirectory: React.FC<IProps> = ({ space, initialText = "", onFinished }) => {
|
// mutate argument refreshToken to force a reload
|
||||||
|
export const useSpaceSummary = (cli: MatrixClient, space: Room, refreshToken?: any): [
|
||||||
|
ISpaceSummaryRoom[],
|
||||||
|
Map<string, Map<string, ISpaceSummaryEvent>>,
|
||||||
|
Map<string, Set<string>>,
|
||||||
|
Map<string, Set<string>>,
|
||||||
|
] | [] => {
|
||||||
// TODO pagination
|
// TODO pagination
|
||||||
const cli = MatrixClientPeg.get();
|
return useAsyncMemo(async () => {
|
||||||
const [query, setQuery] = useState(initialText);
|
try {
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const data = await cli.getSpaceSummary(space.roomId);
|
||||||
|
|
||||||
|
const parentChildRelations = new EnhancedMap<string, Map<string, ISpaceSummaryEvent>>();
|
||||||
|
const childParentRelations = new EnhancedMap<string, Set<string>>();
|
||||||
|
const viaMap = new EnhancedMap<string, Set<string>>();
|
||||||
|
data.events.map((ev: ISpaceSummaryEvent) => {
|
||||||
|
if (ev.type === EventType.SpaceChild) {
|
||||||
|
parentChildRelations.getOrCreate(ev.room_id, new Map()).set(ev.state_key, ev);
|
||||||
|
childParentRelations.getOrCreate(ev.state_key, new Set()).add(ev.room_id);
|
||||||
|
}
|
||||||
|
if (Array.isArray(ev.content["via"])) {
|
||||||
|
const set = viaMap.getOrCreate(ev.state_key, new Set());
|
||||||
|
ev.content["via"].forEach(via => set.add(via));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return [data.rooms as ISpaceSummaryRoom[], parentChildRelations, viaMap, childParentRelations];
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}, [space, refreshToken], []);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const SpaceHierarchy: React.FC<IHierarchyProps> = ({
|
||||||
|
space,
|
||||||
|
initialText = "",
|
||||||
|
showRoom,
|
||||||
|
refreshToken,
|
||||||
|
children,
|
||||||
|
}) => {
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
const userId = cli.getUserId();
|
||||||
|
const [query, setQuery] = useState(initialText);
|
||||||
|
|
||||||
|
const [selected, setSelected] = useState(new Map<string, Set<string>>()); // Map<parentId, Set<childId>>
|
||||||
|
|
||||||
|
const [rooms, parentChildMap, viaMap, childParentMap] = useSpaceSummary(cli, space, refreshToken);
|
||||||
|
|
||||||
|
const roomsMap = useMemo(() => {
|
||||||
|
if (!rooms) return null;
|
||||||
|
const lcQuery = query.toLowerCase().trim();
|
||||||
|
|
||||||
|
const roomsMap = new Map<string, ISpaceSummaryRoom>(rooms.map(r => [r.room_id, r]));
|
||||||
|
if (!lcQuery) return roomsMap;
|
||||||
|
|
||||||
|
const directMatches = rooms.filter(r => {
|
||||||
|
return r.name?.toLowerCase().includes(lcQuery) || r.topic?.toLowerCase().includes(lcQuery);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Walk back up the tree to find all parents of the direct matches to show their place in the hierarchy
|
||||||
|
const visited = new Set<string>();
|
||||||
|
const queue = [...directMatches.map(r => r.room_id)];
|
||||||
|
while (queue.length) {
|
||||||
|
const roomId = queue.pop();
|
||||||
|
visited.add(roomId);
|
||||||
|
childParentMap.get(roomId)?.forEach(parentId => {
|
||||||
|
if (!visited.has(parentId)) {
|
||||||
|
queue.push(parentId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove any mappings for rooms which were not visited in the walk
|
||||||
|
Array.from(roomsMap.keys()).forEach(roomId => {
|
||||||
|
if (!visited.has(roomId)) {
|
||||||
|
roomsMap.delete(roomId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return roomsMap;
|
||||||
|
}, [rooms, childParentMap, query]);
|
||||||
|
|
||||||
|
const [error, setError] = useState("");
|
||||||
|
const [removing, setRemoving] = useState(false);
|
||||||
|
const [saving, setSaving] = useState(false);
|
||||||
|
|
||||||
|
let content;
|
||||||
|
if (roomsMap) {
|
||||||
|
const numRooms = Array.from(roomsMap.values()).filter(r => r.room_type !== RoomType.Space).length;
|
||||||
|
const numSpaces = roomsMap.size - numRooms - 1; // -1 at the end to exclude the space we are looking at
|
||||||
|
|
||||||
|
let countsStr;
|
||||||
|
if (numSpaces > 1) {
|
||||||
|
countsStr = _t("%(count)s rooms and %(numSpaces)s spaces", { count: numRooms, numSpaces });
|
||||||
|
} else if (numSpaces > 0) {
|
||||||
|
countsStr = _t("%(count)s rooms and 1 space", { count: numRooms, numSpaces });
|
||||||
|
} else {
|
||||||
|
countsStr = _t("%(count)s rooms", { count: numRooms, numSpaces });
|
||||||
|
}
|
||||||
|
|
||||||
|
let editSection;
|
||||||
|
if (space.getMyMembership() === "join" && space.currentState.maySendStateEvent(EventType.SpaceChild, userId)) {
|
||||||
|
const selectedRelations = Array.from(selected.keys()).flatMap(parentId => {
|
||||||
|
return [...selected.get(parentId).values()].map(childId => [parentId, childId]) as [string, string][];
|
||||||
|
});
|
||||||
|
|
||||||
|
let buttons;
|
||||||
|
if (selectedRelations.length) {
|
||||||
|
const selectionAllSuggested = selectedRelations.every(([parentId, childId]) => {
|
||||||
|
return parentChildMap.get(parentId)?.get(childId)?.content.suggested;
|
||||||
|
});
|
||||||
|
|
||||||
|
const disabled = removing || saving;
|
||||||
|
|
||||||
|
buttons = <>
|
||||||
|
<AccessibleButton
|
||||||
|
onClick={async () => {
|
||||||
|
setRemoving(true);
|
||||||
|
try {
|
||||||
|
for (const [parentId, childId] of selectedRelations) {
|
||||||
|
await cli.sendStateEvent(parentId, EventType.SpaceChild, {}, childId);
|
||||||
|
parentChildMap.get(parentId).get(childId).content = {};
|
||||||
|
parentChildMap.set(parentId, new Map(parentChildMap.get(parentId)));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setError(_t("Failed to remove some rooms. Try again later"));
|
||||||
|
}
|
||||||
|
setRemoving(false);
|
||||||
|
}}
|
||||||
|
kind="danger_outline"
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
{ removing ? _t("Removing...") : _t("Remove") }
|
||||||
|
</AccessibleButton>
|
||||||
|
<AccessibleButton
|
||||||
|
onClick={async () => {
|
||||||
|
setSaving(true);
|
||||||
|
try {
|
||||||
|
for (const [parentId, childId] of selectedRelations) {
|
||||||
|
const suggested = !selectionAllSuggested;
|
||||||
|
const existingContent = parentChildMap.get(parentId)?.get(childId)?.content;
|
||||||
|
if (!existingContent || existingContent.suggested === suggested) continue;
|
||||||
|
|
||||||
|
const content = {
|
||||||
|
...existingContent,
|
||||||
|
suggested: !selectionAllSuggested,
|
||||||
|
};
|
||||||
|
|
||||||
|
await cli.sendStateEvent(parentId, EventType.SpaceChild, content, childId);
|
||||||
|
|
||||||
|
parentChildMap.get(parentId).get(childId).content = content;
|
||||||
|
parentChildMap.set(parentId, new Map(parentChildMap.get(parentId)));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setError("Failed to update some suggestions. Try again later");
|
||||||
|
}
|
||||||
|
setSaving(false);
|
||||||
|
}}
|
||||||
|
kind="primary_outline"
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
|
{ saving
|
||||||
|
? _t("Saving...")
|
||||||
|
: (selectionAllSuggested ? _t("Mark as not suggested") : _t("Mark as suggested"))
|
||||||
|
}
|
||||||
|
</AccessibleButton>
|
||||||
|
</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
editSection = <span>
|
||||||
|
{ buttons }
|
||||||
|
</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
let results;
|
||||||
|
if (roomsMap.size) {
|
||||||
|
const hasPermissions = space?.currentState.maySendStateEvent(EventType.SpaceChild, cli.getUserId());
|
||||||
|
|
||||||
|
results = <>
|
||||||
|
<HierarchyLevel
|
||||||
|
spaceId={space.roomId}
|
||||||
|
rooms={roomsMap}
|
||||||
|
relations={parentChildMap}
|
||||||
|
parents={new Set()}
|
||||||
|
selectedMap={selected}
|
||||||
|
onToggleClick={hasPermissions ? (parentId, childId) => {
|
||||||
|
setError("");
|
||||||
|
if (!selected.has(parentId)) {
|
||||||
|
setSelected(new Map(selected.set(parentId, new Set([childId]))));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parentSet = selected.get(parentId);
|
||||||
|
if (!parentSet.has(childId)) {
|
||||||
|
setSelected(new Map(selected.set(parentId, new Set([...parentSet, childId]))));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
parentSet.delete(childId);
|
||||||
|
setSelected(new Map(selected.set(parentId, new Set(parentSet))));
|
||||||
|
} : undefined}
|
||||||
|
onViewRoomClick={(roomId, autoJoin) => {
|
||||||
|
showRoom(roomsMap.get(roomId), Array.from(viaMap.get(roomId) || []), autoJoin);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{ children && <hr /> }
|
||||||
|
</>;
|
||||||
|
} else {
|
||||||
|
results = <div className="mx_SpaceRoomDirectory_noResults">
|
||||||
|
<h3>{ _t("No results found") }</h3>
|
||||||
|
<div>{ _t("You may want to try a different search or check for typos.") }</div>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
content = <>
|
||||||
|
<div className="mx_SpaceRoomDirectory_listHeader">
|
||||||
|
{ countsStr }
|
||||||
|
{ editSection }
|
||||||
|
</div>
|
||||||
|
{ error && <div className="mx_SpaceRoomDirectory_error">
|
||||||
|
{ error }
|
||||||
|
</div> }
|
||||||
|
<AutoHideScrollbar className="mx_SpaceRoomDirectory_list">
|
||||||
|
{ results }
|
||||||
|
{ children }
|
||||||
|
</AutoHideScrollbar>
|
||||||
|
</>;
|
||||||
|
} else if (!rooms) {
|
||||||
|
content = <Spinner />;
|
||||||
|
} else {
|
||||||
|
content = <p>{_t("Your server does not support showing space hierarchies.")}</p>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO loading state/error state
|
||||||
|
return <>
|
||||||
|
<SearchBox
|
||||||
|
className="mx_textinput_icon mx_textinput_search"
|
||||||
|
placeholder={ _t("Search names and description") }
|
||||||
|
onSearch={setQuery}
|
||||||
|
autoFocus={true}
|
||||||
|
initialValue={initialText}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{ content }
|
||||||
|
</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
space: Room;
|
||||||
|
initialText?: string;
|
||||||
|
onFinished(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SpaceRoomDirectory: React.FC<IProps> = ({ space, onFinished, initialText }) => {
|
||||||
const onCreateRoomClick = () => {
|
const onCreateRoomClick = () => {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'view_create_room',
|
action: 'view_create_room',
|
||||||
|
@ -426,134 +573,40 @@ const SpaceRoomDirectory: React.FC<IProps> = ({ space, initialText = "", onFinis
|
||||||
onFinished();
|
onFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
// stored within a ref as we don't need to re-render when it changes
|
|
||||||
const pendingActions = useRef(new Map<string, IAction>());
|
|
||||||
|
|
||||||
let adminButton;
|
|
||||||
if (shouldShowSpaceSettings(cli, space)) { // TODO this is an imperfect test
|
|
||||||
const onManageButtonClicked = () => {
|
|
||||||
setIsEditing(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSaveButtonClicked = () => {
|
|
||||||
// TODO setBusy
|
|
||||||
pendingActions.current.forEach(({event, suggested, removed}) => {
|
|
||||||
const content = {
|
|
||||||
...event.getContent(),
|
|
||||||
suggested,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (removed) {
|
|
||||||
delete content["via"];
|
|
||||||
}
|
|
||||||
|
|
||||||
cli.sendStateEvent(event.getRoomId(), event.getType(), content, event.getStateKey());
|
|
||||||
});
|
|
||||||
setIsEditing(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (isEditing) {
|
|
||||||
adminButton = <React.Fragment>
|
|
||||||
<FormButton label={_t("Save changes")} onClick={onSaveButtonClicked} />
|
|
||||||
<span>{ _t("Promoted to users") }</span>
|
|
||||||
</React.Fragment>;
|
|
||||||
} else {
|
|
||||||
adminButton = <FormButton label={_t("Manage rooms")} onClick={onManageButtonClicked} />;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const [rooms, relations, viaMap] = useAsyncMemo(async () => {
|
|
||||||
try {
|
|
||||||
const data = await cli.getSpaceSummary(space.roomId);
|
|
||||||
|
|
||||||
const parentChildRelations = new EnhancedMap<string, string[]>();
|
|
||||||
const viaMap = new EnhancedMap<string, Set<string>>();
|
|
||||||
data.events.map((ev: ISpaceSummaryEvent) => {
|
|
||||||
if (ev.type === EventType.SpaceChild) {
|
|
||||||
parentChildRelations.getOrCreate(ev.room_id, []).push(ev.state_key);
|
|
||||||
}
|
|
||||||
if (Array.isArray(ev.content["via"])) {
|
|
||||||
const set = viaMap.getOrCreate(ev.state_key, new Set());
|
|
||||||
ev.content["via"].forEach(via => set.add(via));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return [data.rooms, parentChildRelations, viaMap];
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}, [space], []);
|
|
||||||
|
|
||||||
const roomsMap = useMemo(() => {
|
|
||||||
if (!rooms) return null;
|
|
||||||
const lcQuery = query.toLowerCase();
|
|
||||||
|
|
||||||
const filteredRooms = rooms.filter(r => {
|
|
||||||
return r.room_type === RoomType.Space // always include spaces to allow filtering of sub-space rooms
|
|
||||||
|| r.name?.toLowerCase().includes(lcQuery)
|
|
||||||
|| r.topic?.toLowerCase().includes(lcQuery);
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Map<string, ISpaceSummaryRoom>(filteredRooms.map(r => [r.room_id, r]));
|
|
||||||
// const root = rooms.get(space.roomId);
|
|
||||||
}, [rooms, query]);
|
|
||||||
|
|
||||||
const title = <React.Fragment>
|
const title = <React.Fragment>
|
||||||
<RoomAvatar room={space} height={40} width={40} />
|
<RoomAvatar room={space} height={32} width={32} />
|
||||||
<div>
|
<div>
|
||||||
<h1>{ _t("Explore rooms") }</h1>
|
<h1>{ _t("Explore rooms") }</h1>
|
||||||
<div><RoomName room={space} /></div>
|
<div><RoomName room={space} /></div>
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>;
|
</React.Fragment>;
|
||||||
const explanation =
|
|
||||||
_t("If you can't find the room you're looking for, ask for an invite or <a>Create a new room</a>.", null,
|
|
||||||
{a: sub => {
|
|
||||||
return <AccessibleButton kind="link" onClick={onCreateRoomClick}>{sub}</AccessibleButton>;
|
|
||||||
}},
|
|
||||||
);
|
|
||||||
|
|
||||||
let content;
|
|
||||||
if (roomsMap) {
|
|
||||||
content = <AutoHideScrollbar className="mx_SpaceRoomDirectory_list">
|
|
||||||
<HierarchyLevel
|
|
||||||
spaceId={space.roomId}
|
|
||||||
rooms={roomsMap}
|
|
||||||
editing={isEditing}
|
|
||||||
relations={relations}
|
|
||||||
parents={new Set()}
|
|
||||||
queueAction={action => {
|
|
||||||
pendingActions.current.set(action.event.room_id, action);
|
|
||||||
}}
|
|
||||||
onPreviewClick={roomId => {
|
|
||||||
showRoom(roomsMap.get(roomId), Array.from(viaMap.get(roomId) || []), false);
|
|
||||||
onFinished();
|
|
||||||
}}
|
|
||||||
onJoinClick={(roomId) => {
|
|
||||||
showRoom(roomsMap.get(roomId), Array.from(viaMap.get(roomId) || []), true);
|
|
||||||
onFinished();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AutoHideScrollbar>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO loading state/error state
|
|
||||||
return (
|
return (
|
||||||
<BaseDialog className="mx_SpaceRoomDirectory" hasCancel={true} onFinished={onFinished} title={title}>
|
<BaseDialog className="mx_SpaceRoomDirectory" hasCancel={true} onFinished={onFinished} title={title}>
|
||||||
<div className="mx_Dialog_content">
|
<div className="mx_Dialog_content">
|
||||||
{ explanation }
|
{ _t("If you can't find the room you're looking for, ask for an invite or <a>create a new room</a>.",
|
||||||
|
null,
|
||||||
|
{a: sub => {
|
||||||
|
return <AccessibleButton kind="link" onClick={onCreateRoomClick}>{sub}</AccessibleButton>;
|
||||||
|
}},
|
||||||
|
) }
|
||||||
|
|
||||||
<SearchBox
|
<SpaceHierarchy
|
||||||
className="mx_textinput_icon mx_textinput_search"
|
space={space}
|
||||||
placeholder={ _t("Find a room...") }
|
showRoom={(room: ISpaceSummaryRoom, viaServers?: string[], autoJoin = false) => {
|
||||||
onSearch={setQuery}
|
showRoom(room, viaServers, autoJoin);
|
||||||
/>
|
onFinished();
|
||||||
|
}}
|
||||||
<div className="mx_SpaceRoomDirectory_listHeader">
|
initialText={initialText}
|
||||||
{ adminButton }
|
>
|
||||||
</div>
|
<AccessibleButton
|
||||||
{ content }
|
onClick={onCreateRoomClick}
|
||||||
|
kind="primary"
|
||||||
|
className="mx_SpaceRoomDirectory_createRoom"
|
||||||
|
>
|
||||||
|
{ _t("Create room") }
|
||||||
|
</AccessibleButton>
|
||||||
|
</SpaceHierarchy>
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|
|
@ -15,8 +15,9 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {RefObject, useContext, useRef, useState} from "react";
|
import React, {RefObject, useContext, useRef, useState} from "react";
|
||||||
import {EventType, RoomType} from "matrix-js-sdk/src/@types/event";
|
import {EventType} from "matrix-js-sdk/src/@types/event";
|
||||||
import {Room} from "matrix-js-sdk/src/models/room";
|
import {Room} from "matrix-js-sdk/src/models/room";
|
||||||
|
import {EventSubscription} from "fbemitter";
|
||||||
|
|
||||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||||
import RoomAvatar from "../views/avatars/RoomAvatar";
|
import RoomAvatar from "../views/avatars/RoomAvatar";
|
||||||
|
@ -25,13 +26,11 @@ import AccessibleButton from "../views/elements/AccessibleButton";
|
||||||
import RoomName from "../views/elements/RoomName";
|
import RoomName from "../views/elements/RoomName";
|
||||||
import RoomTopic from "../views/elements/RoomTopic";
|
import RoomTopic from "../views/elements/RoomTopic";
|
||||||
import InlineSpinner from "../views/elements/InlineSpinner";
|
import InlineSpinner from "../views/elements/InlineSpinner";
|
||||||
import FormButton from "../views/elements/FormButton";
|
|
||||||
import {inviteMultipleToRoom, showRoomInviteDialog} from "../../RoomInvite";
|
import {inviteMultipleToRoom, showRoomInviteDialog} from "../../RoomInvite";
|
||||||
import {useRoomMembers} from "../../hooks/useRoomMembers";
|
import {useRoomMembers} from "../../hooks/useRoomMembers";
|
||||||
import createRoom, {IOpts, Preset} from "../../createRoom";
|
import createRoom, {IOpts, Preset} from "../../createRoom";
|
||||||
import Field from "../views/elements/Field";
|
import Field from "../views/elements/Field";
|
||||||
import {useEventEmitter} from "../../hooks/useEventEmitter";
|
import {useEventEmitter} from "../../hooks/useEventEmitter";
|
||||||
import StyledRadioGroup from "../views/elements/StyledRadioGroup";
|
|
||||||
import withValidation from "../views/elements/Validation";
|
import withValidation from "../views/elements/Validation";
|
||||||
import * as Email from "../../email";
|
import * as Email from "../../email";
|
||||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||||
|
@ -42,18 +41,16 @@ import ErrorBoundary from "../views/elements/ErrorBoundary";
|
||||||
import {ActionPayload} from "../../dispatcher/payloads";
|
import {ActionPayload} from "../../dispatcher/payloads";
|
||||||
import RightPanel from "./RightPanel";
|
import RightPanel from "./RightPanel";
|
||||||
import RightPanelStore from "../../stores/RightPanelStore";
|
import RightPanelStore from "../../stores/RightPanelStore";
|
||||||
import {EventSubscription} from "fbemitter";
|
|
||||||
import {RightPanelPhases} from "../../stores/RightPanelStorePhases";
|
import {RightPanelPhases} from "../../stores/RightPanelStorePhases";
|
||||||
import {SetRightPanelPhasePayload} from "../../dispatcher/payloads/SetRightPanelPhasePayload";
|
import {SetRightPanelPhasePayload} from "../../dispatcher/payloads/SetRightPanelPhasePayload";
|
||||||
import {useStateArray} from "../../hooks/useStateArray";
|
import {useStateArray} from "../../hooks/useStateArray";
|
||||||
import SpacePublicShare from "../views/spaces/SpacePublicShare";
|
import SpacePublicShare from "../views/spaces/SpacePublicShare";
|
||||||
import {showAddExistingRooms, showCreateNewRoom, shouldShowSpaceSettings, showSpaceSettings} from "../../utils/space";
|
import {showAddExistingRooms, showCreateNewRoom, shouldShowSpaceSettings, showSpaceSettings} from "../../utils/space";
|
||||||
import {HierarchyLevel, ISpaceSummaryEvent, ISpaceSummaryRoom, showRoom} from "./SpaceRoomDirectory";
|
import {showRoom, SpaceHierarchy} from "./SpaceRoomDirectory";
|
||||||
import {useAsyncMemo} from "../../hooks/useAsyncMemo";
|
|
||||||
import {EnhancedMap} from "../../utils/maps";
|
|
||||||
import AutoHideScrollbar from "./AutoHideScrollbar";
|
|
||||||
import MemberAvatar from "../views/avatars/MemberAvatar";
|
import MemberAvatar from "../views/avatars/MemberAvatar";
|
||||||
import {useStateToggle} from "../../hooks/useStateToggle";
|
import {useStateToggle} from "../../hooks/useStateToggle";
|
||||||
|
import SpaceStore from "../../stores/SpaceStore";
|
||||||
|
import FacePile from "../views/elements/FacePile";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
space: Room;
|
space: Room;
|
||||||
|
@ -66,6 +63,7 @@ interface IProps {
|
||||||
interface IState {
|
interface IState {
|
||||||
phase: Phase;
|
phase: Phase;
|
||||||
showRightPanel: boolean;
|
showRightPanel: boolean;
|
||||||
|
myMembership: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Phase {
|
enum Phase {
|
||||||
|
@ -94,10 +92,47 @@ const useMyRoomMembership = (room: Room) => {
|
||||||
return membership;
|
return membership;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const SpaceInfo = ({ space }) => {
|
||||||
|
const joinRule = space.getJoinRule();
|
||||||
|
|
||||||
|
let visibilitySection;
|
||||||
|
if (joinRule === "public") {
|
||||||
|
visibilitySection = <span className="mx_SpaceRoomView_info_public">
|
||||||
|
{ _t("Public space") }
|
||||||
|
</span>;
|
||||||
|
} else {
|
||||||
|
visibilitySection = <span className="mx_SpaceRoomView_info_private">
|
||||||
|
{ _t("Private space") }
|
||||||
|
</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return <div className="mx_SpaceRoomView_info">
|
||||||
|
{ visibilitySection }
|
||||||
|
{ joinRule === "public" && <RoomMemberCount room={space}>
|
||||||
|
{(count) => count > 0 ? (
|
||||||
|
<AccessibleButton
|
||||||
|
kind="link"
|
||||||
|
onClick={() => {
|
||||||
|
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
|
||||||
|
action: Action.SetRightPanelPhase,
|
||||||
|
phase: RightPanelPhases.RoomMemberList,
|
||||||
|
refireParams: { space },
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{ _t("%(count)s members", { count }) }
|
||||||
|
</AccessibleButton>
|
||||||
|
) : null}
|
||||||
|
</RoomMemberCount> }
|
||||||
|
</div>
|
||||||
|
};
|
||||||
|
|
||||||
const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }) => {
|
const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }) => {
|
||||||
const cli = useContext(MatrixClientContext);
|
const cli = useContext(MatrixClientContext);
|
||||||
const myMembership = useMyRoomMembership(space);
|
const myMembership = useMyRoomMembership(space);
|
||||||
|
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
|
||||||
let inviterSection;
|
let inviterSection;
|
||||||
let joinButtons;
|
let joinButtons;
|
||||||
if (myMembership === "invite") {
|
if (myMembership === "invite") {
|
||||||
|
@ -121,22 +156,41 @@ const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
joinButtons = <>
|
joinButtons = <>
|
||||||
<FormButton label={_t("Reject")} kind="secondary" onClick={onRejectButtonClicked} />
|
<AccessibleButton
|
||||||
<FormButton label={_t("Accept")} onClick={onJoinButtonClicked} />
|
kind="secondary"
|
||||||
|
onClick={() => {
|
||||||
|
setBusy(true);
|
||||||
|
onRejectButtonClicked();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{ _t("Reject") }
|
||||||
|
</AccessibleButton>
|
||||||
|
<AccessibleButton
|
||||||
|
kind="primary"
|
||||||
|
onClick={() => {
|
||||||
|
setBusy(true);
|
||||||
|
onJoinButtonClicked();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{ _t("Accept") }
|
||||||
|
</AccessibleButton>
|
||||||
</>;
|
</>;
|
||||||
} else {
|
} else {
|
||||||
joinButtons = <FormButton label={_t("Join")} onClick={onJoinButtonClicked} />
|
joinButtons = (
|
||||||
|
<AccessibleButton
|
||||||
|
kind="primary"
|
||||||
|
onClick={() => {
|
||||||
|
setBusy(true);
|
||||||
|
onJoinButtonClicked();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{ _t("Join") }
|
||||||
|
</AccessibleButton>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
let visibilitySection;
|
if (busy) {
|
||||||
if (space.getJoinRule() === "public") {
|
joinButtons = <InlineSpinner />;
|
||||||
visibilitySection = <span className="mx_SpaceRoomView_preview_info_public">
|
|
||||||
{ _t("Public space") }
|
|
||||||
</span>;
|
|
||||||
} else {
|
|
||||||
visibilitySection = <span className="mx_SpaceRoomView_preview_info_private">
|
|
||||||
{ _t("Private space") }
|
|
||||||
</span>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div className="mx_SpaceRoomView_preview">
|
return <div className="mx_SpaceRoomView_preview">
|
||||||
|
@ -145,26 +199,7 @@ const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }) =>
|
||||||
<h1 className="mx_SpaceRoomView_preview_name">
|
<h1 className="mx_SpaceRoomView_preview_name">
|
||||||
<RoomName room={space} />
|
<RoomName room={space} />
|
||||||
</h1>
|
</h1>
|
||||||
<div className="mx_SpaceRoomView_preview_info">
|
<SpaceInfo space={space} />
|
||||||
{ visibilitySection }
|
|
||||||
<RoomMemberCount room={space}>
|
|
||||||
{(count) => count > 0 ? (
|
|
||||||
<AccessibleButton
|
|
||||||
className="mx_SpaceRoomView_preview_memberCount"
|
|
||||||
kind="link"
|
|
||||||
onClick={() => {
|
|
||||||
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
|
|
||||||
action: Action.SetRightPanelPhase,
|
|
||||||
phase: RightPanelPhases.RoomMemberList,
|
|
||||||
refireParams: { space },
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{ _t("%(count)s members", { count }) }
|
|
||||||
</AccessibleButton>
|
|
||||||
) : null}
|
|
||||||
</RoomMemberCount>
|
|
||||||
</div>
|
|
||||||
<RoomTopic room={space}>
|
<RoomTopic room={space}>
|
||||||
{(topic, ref) =>
|
{(topic, ref) =>
|
||||||
<div className="mx_SpaceRoomView_preview_topic" ref={ref}>
|
<div className="mx_SpaceRoomView_preview_topic" ref={ref}>
|
||||||
|
@ -172,6 +207,7 @@ const SpacePreview = ({ space, onJoinButtonClicked, onRejectButtonClicked }) =>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</RoomTopic>
|
</RoomTopic>
|
||||||
|
{ space.getJoinRule() === "public" && <FacePile room={space} /> }
|
||||||
<div className="mx_SpaceRoomView_preview_joinButtons">
|
<div className="mx_SpaceRoomView_preview_joinButtons">
|
||||||
{ joinButtons }
|
{ joinButtons }
|
||||||
</div>
|
</div>
|
||||||
|
@ -186,17 +222,21 @@ const SpaceLanding = ({ space }) => {
|
||||||
let inviteButton;
|
let inviteButton;
|
||||||
if (myMembership === "join" && space.canInvite(userId)) {
|
if (myMembership === "join" && space.canInvite(userId)) {
|
||||||
inviteButton = (
|
inviteButton = (
|
||||||
<AccessibleButton className="mx_SpaceRoomView_landing_inviteButton" onClick={() => {
|
<AccessibleButton
|
||||||
|
kind="primary"
|
||||||
|
className="mx_SpaceRoomView_landing_inviteButton"
|
||||||
|
onClick={() => {
|
||||||
showRoomInviteDialog(space.roomId);
|
showRoomInviteDialog(space.roomId);
|
||||||
}}>
|
}}
|
||||||
{ _t("Invite people") }
|
>
|
||||||
|
{ _t("Invite") }
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const canAddRooms = myMembership === "join" && space.currentState.maySendStateEvent(EventType.SpaceChild, userId);
|
const canAddRooms = myMembership === "join" && space.currentState.maySendStateEvent(EventType.SpaceChild, userId);
|
||||||
|
|
||||||
const [_, forceUpdate] = useStateToggle(false); // TODO
|
const [refreshToken, forceUpdate] = useStateToggle(false);
|
||||||
|
|
||||||
let addRoomButtons;
|
let addRoomButtons;
|
||||||
if (canAddRooms) {
|
if (canAddRooms) {
|
||||||
|
@ -226,50 +266,13 @@ const SpaceLanding = ({ space }) => {
|
||||||
</AccessibleButton>;
|
</AccessibleButton>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [loading, roomsMap, relations, numRooms] = useAsyncMemo(async () => {
|
const onMembersClick = () => {
|
||||||
try {
|
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
|
||||||
const data = await cli.getSpaceSummary(space.roomId, undefined, myMembership !== "join");
|
action: Action.SetRightPanelPhase,
|
||||||
|
phase: RightPanelPhases.RoomMemberList,
|
||||||
const parentChildRelations = new EnhancedMap<string, string[]>();
|
refireParams: { space },
|
||||||
data.events.map((ev: ISpaceSummaryEvent) => {
|
|
||||||
if (ev.type === EventType.SpaceChild) {
|
|
||||||
parentChildRelations.getOrCreate(ev.room_id, []).push(ev.state_key);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
};
|
||||||
const roomsMap = new Map<string, ISpaceSummaryRoom>(data.rooms.map(r => [r.room_id, r]));
|
|
||||||
const numRooms = data.rooms.filter(r => r.room_type !== RoomType.Space).length;
|
|
||||||
return [false, roomsMap, parentChildRelations, numRooms];
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e); // TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
return [false];
|
|
||||||
}, [space, _], [true]);
|
|
||||||
|
|
||||||
let previewRooms;
|
|
||||||
if (roomsMap) {
|
|
||||||
previewRooms = <AutoHideScrollbar className="mx_SpaceRoomDirectory_list">
|
|
||||||
<div className="mx_SpaceRoomDirectory_roomCount">
|
|
||||||
<h3>{ myMembership === "join" ? _t("Rooms") : _t("Default Rooms")}</h3>
|
|
||||||
<span>{ numRooms }</span>
|
|
||||||
</div>
|
|
||||||
<HierarchyLevel
|
|
||||||
spaceId={space.roomId}
|
|
||||||
rooms={roomsMap}
|
|
||||||
editing={false}
|
|
||||||
relations={relations}
|
|
||||||
parents={new Set()}
|
|
||||||
onPreviewClick={roomId => {
|
|
||||||
showRoom(roomsMap.get(roomId), [], false); // TODO
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AutoHideScrollbar>;
|
|
||||||
} else if (loading) {
|
|
||||||
previewRooms = <InlineSpinner />;
|
|
||||||
} else {
|
|
||||||
previewRooms = <p>{_t("Your server does not support showing space hierarchies.")}</p>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <div className="mx_SpaceRoomView_landing">
|
return <div className="mx_SpaceRoomView_landing">
|
||||||
<RoomAvatar room={space} height={80} width={80} viewAvatarOnClick={true} />
|
<RoomAvatar room={space} height={80} width={80} viewAvatarOnClick={true} />
|
||||||
|
@ -278,45 +281,26 @@ const SpaceLanding = ({ space }) => {
|
||||||
{(name) => {
|
{(name) => {
|
||||||
const tags = { name: () => <div className="mx_SpaceRoomView_landing_nameRow">
|
const tags = { name: () => <div className="mx_SpaceRoomView_landing_nameRow">
|
||||||
<h1>{ name }</h1>
|
<h1>{ name }</h1>
|
||||||
<RoomMemberCount room={space}>
|
|
||||||
{(count) => count > 0 ? (
|
|
||||||
<AccessibleButton
|
|
||||||
className="mx_SpaceRoomView_landing_memberCount"
|
|
||||||
kind="link"
|
|
||||||
onClick={() => {
|
|
||||||
defaultDispatcher.dispatch<SetRightPanelPhasePayload>({
|
|
||||||
action: Action.SetRightPanelPhase,
|
|
||||||
phase: RightPanelPhases.RoomMemberList,
|
|
||||||
refireParams: { space },
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{ _t("%(count)s members", { count }) }
|
|
||||||
</AccessibleButton>
|
|
||||||
) : null}
|
|
||||||
</RoomMemberCount>
|
|
||||||
</div> };
|
</div> };
|
||||||
if (shouldShowSpaceSettings(cli, space)) {
|
|
||||||
if (space.getJoinRule() === "public") {
|
|
||||||
return _t("Your public space <name/>", {}, tags) as JSX.Element;
|
|
||||||
} else {
|
|
||||||
return _t("Your private space <name/>", {}, tags) as JSX.Element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _t("Welcome to <name/>", {}, tags) as JSX.Element;
|
return _t("Welcome to <name/>", {}, tags) as JSX.Element;
|
||||||
}}
|
}}
|
||||||
</RoomName>
|
</RoomName>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="mx_SpaceRoomView_landing_info">
|
||||||
|
<SpaceInfo space={space} />
|
||||||
|
<FacePile room={space} onlyKnownUsers={false} numShown={7} onClick={onMembersClick} />
|
||||||
|
{ inviteButton }
|
||||||
|
</div>
|
||||||
<div className="mx_SpaceRoomView_landing_topic">
|
<div className="mx_SpaceRoomView_landing_topic">
|
||||||
<RoomTopic room={space} />
|
<RoomTopic room={space} />
|
||||||
</div>
|
</div>
|
||||||
|
<hr />
|
||||||
<div className="mx_SpaceRoomView_landing_adminButtons">
|
<div className="mx_SpaceRoomView_landing_adminButtons">
|
||||||
{ inviteButton }
|
|
||||||
{ addRoomButtons }
|
{ addRoomButtons }
|
||||||
{ settingsButton }
|
{ settingsButton }
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{ previewRooms }
|
<SpaceHierarchy space={space} showRoom={showRoom} refreshToken={refreshToken} />
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -337,6 +321,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
placeholder={placeholders[i]}
|
placeholder={placeholders[i]}
|
||||||
value={roomNames[i]}
|
value={roomNames[i]}
|
||||||
onChange={ev => setRoomName(i, ev.target.value)}
|
onChange={ev => setRoomName(i, ev.target.value)}
|
||||||
|
autoFocus={i === 2}
|
||||||
/>;
|
/>;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -369,7 +354,7 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
let buttonLabel = _t("Skip for now");
|
let buttonLabel = _t("Skip for now");
|
||||||
if (roomNames.some(name => name.trim())) {
|
if (roomNames.some(name => name.trim())) {
|
||||||
onClick = onNextClick;
|
onClick = onNextClick;
|
||||||
buttonLabel = busy ? _t("Creating rooms...") : _t("Next")
|
buttonLabel = busy ? _t("Creating rooms...") : _t("Continue")
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div>
|
return <div>
|
||||||
|
@ -380,61 +365,55 @@ const SpaceSetupFirstRooms = ({ space, title, description, onFinished }) => {
|
||||||
{ fields }
|
{ fields }
|
||||||
|
|
||||||
<div className="mx_SpaceRoomView_buttons">
|
<div className="mx_SpaceRoomView_buttons">
|
||||||
<FormButton
|
<AccessibleButton
|
||||||
label={buttonLabel}
|
kind="primary"
|
||||||
disabled={busy}
|
disabled={busy}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
/>
|
>
|
||||||
|
{ buttonLabel }
|
||||||
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SpaceSetupPublicShare = ({ space, onFinished }) => {
|
const SpaceSetupPublicShare = ({ space, onFinished }) => {
|
||||||
return <div className="mx_SpaceRoomView_publicShare">
|
return <div className="mx_SpaceRoomView_publicShare">
|
||||||
<h1>{ _t("Share your public space") }</h1>
|
<h1>{ _t("Share %(name)s", { name: space.name }) }</h1>
|
||||||
<div className="mx_SpacePublicShare_description">{ _t("At the moment only you can see it.") }</div>
|
<div className="mx_SpaceRoomView_description">
|
||||||
|
{ _t("It's just you at the moment, it will be even better with others.") }
|
||||||
|
</div>
|
||||||
|
|
||||||
<SpacePublicShare space={space} onFinished={onFinished} />
|
<SpacePublicShare space={space} />
|
||||||
|
|
||||||
<div className="mx_SpaceRoomView_buttons">
|
<div className="mx_SpaceRoomView_buttons">
|
||||||
<FormButton label={_t("Finish")} onClick={onFinished} />
|
<AccessibleButton kind="primary" onClick={onFinished}>
|
||||||
|
{ _t("Go to my first room") }
|
||||||
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const SpaceSetupPrivateScope = ({ onFinished }) => {
|
const SpaceSetupPrivateScope = ({ space, onFinished }) => {
|
||||||
const [option, setOption] = useState<string>(null);
|
|
||||||
|
|
||||||
return <div className="mx_SpaceRoomView_privateScope">
|
return <div className="mx_SpaceRoomView_privateScope">
|
||||||
<h1>{ _t("Who are you working with?") }</h1>
|
<h1>{ _t("Who are you working with?") }</h1>
|
||||||
<div className="mx_SpaceRoomView_description">{ _t("Ensure the right people have access to the space.") }</div>
|
<div className="mx_SpaceRoomView_description">
|
||||||
|
{ _t("Make sure the right people have access to %(name)s", { name: space.name }) }
|
||||||
|
</div>
|
||||||
|
|
||||||
<StyledRadioGroup
|
<AccessibleButton
|
||||||
name="privateSpaceScope"
|
className="mx_SpaceRoomView_privateScope_justMeButton"
|
||||||
value={option}
|
onClick={() => { onFinished(false) }}
|
||||||
onChange={setOption}
|
>
|
||||||
definitions={[
|
<h3>{ _t("Just me") }</h3>
|
||||||
{
|
<div>{ _t("A private space to organise your rooms") }</div>
|
||||||
value: "justMe",
|
</AccessibleButton>
|
||||||
className: "mx_SpaceRoomView_privateScope_justMeButton",
|
<AccessibleButton
|
||||||
label: <React.Fragment>
|
className="mx_SpaceRoomView_privateScope_meAndMyTeammatesButton"
|
||||||
<h3>{ _t("Just Me") }</h3>
|
onClick={() => { onFinished(true) }}
|
||||||
<div>{ _t("A private space just for you") }</div>
|
>
|
||||||
</React.Fragment>,
|
|
||||||
}, {
|
|
||||||
value: "meAndMyTeammates",
|
|
||||||
className: "mx_SpaceRoomView_privateScope_meAndMyTeammatesButton",
|
|
||||||
label: <React.Fragment>
|
|
||||||
<h3>{ _t("Me and my teammates") }</h3>
|
<h3>{ _t("Me and my teammates") }</h3>
|
||||||
<div>{ _t("A private space for you and your teammates") }</div>
|
<div>{ _t("A private space for you and your teammates") }</div>
|
||||||
</React.Fragment>,
|
</AccessibleButton>
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="mx_SpaceRoomView_buttons">
|
|
||||||
<FormButton label={_t("Next")} disabled={!option} onClick={() => onFinished(option !== "justMe")} />
|
|
||||||
</div>
|
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -464,6 +443,7 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
|
||||||
onChange={ev => setEmailAddress(i, ev.target.value)}
|
onChange={ev => setEmailAddress(i, ev.target.value)}
|
||||||
ref={fieldRefs[i]}
|
ref={fieldRefs[i]}
|
||||||
onValidate={validateEmailRules}
|
onValidate={validateEmailRules}
|
||||||
|
autoFocus={i === 0}
|
||||||
/>;
|
/>;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -501,9 +481,18 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let onClick = onFinished;
|
||||||
|
let buttonLabel = _t("Skip for now");
|
||||||
|
if (emailAddresses.some(name => name.trim())) {
|
||||||
|
onClick = onNextClick;
|
||||||
|
buttonLabel = busy ? _t("Inviting...") : _t("Continue")
|
||||||
|
}
|
||||||
|
|
||||||
return <div className="mx_SpaceRoomView_inviteTeammates">
|
return <div className="mx_SpaceRoomView_inviteTeammates">
|
||||||
<h1>{ _t("Invite your teammates") }</h1>
|
<h1>{ _t("Invite your teammates") }</h1>
|
||||||
<div className="mx_SpaceRoomView_description">{ _t("Ensure the right people have access to the space.") }</div>
|
<div className="mx_SpaceRoomView_description">
|
||||||
|
{ _t("Make sure the right people have access. You can invite more later.") }
|
||||||
|
</div>
|
||||||
|
|
||||||
{ error && <div className="mx_SpaceRoomView_errorText">{ error }</div> }
|
{ error && <div className="mx_SpaceRoomView_errorText">{ error }</div> }
|
||||||
{ fields }
|
{ fields }
|
||||||
|
@ -518,8 +507,9 @@ const SpaceSetupPrivateInvite = ({ space, onFinished }) => {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mx_SpaceRoomView_buttons">
|
<div className="mx_SpaceRoomView_buttons">
|
||||||
<AccessibleButton onClick={onFinished} kind="link">{_t("Skip for now")}</AccessibleButton>
|
<AccessibleButton kind="primary" disabled={busy} onClick={onClick}>
|
||||||
<FormButton label={busy ? _t("Inviting...") : _t("Next")} disabled={busy} onClick={onNextClick} />
|
{ buttonLabel }
|
||||||
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
@ -547,17 +537,26 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||||
this.state = {
|
this.state = {
|
||||||
phase,
|
phase,
|
||||||
showRightPanel: RightPanelStore.getSharedInstance().isOpenForRoom,
|
showRightPanel: RightPanelStore.getSharedInstance().isOpenForRoom,
|
||||||
|
myMembership: this.props.space.getMyMembership(),
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dispatcherRef = defaultDispatcher.register(this.onAction);
|
this.dispatcherRef = defaultDispatcher.register(this.onAction);
|
||||||
this.rightPanelStoreToken = RightPanelStore.getSharedInstance().addListener(this.onRightPanelStoreUpdate);
|
this.rightPanelStoreToken = RightPanelStore.getSharedInstance().addListener(this.onRightPanelStoreUpdate);
|
||||||
|
this.context.on("Room.myMembership", this.onMyMembership);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
defaultDispatcher.unregister(this.dispatcherRef);
|
defaultDispatcher.unregister(this.dispatcherRef);
|
||||||
this.rightPanelStoreToken.remove();
|
this.rightPanelStoreToken.remove();
|
||||||
|
this.context.off("Room.myMembership", this.onMyMembership);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onMyMembership = (room: Room, myMembership: string) => {
|
||||||
|
if (room.roomId === this.props.space.roomId) {
|
||||||
|
this.setState({ myMembership });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private onRightPanelStoreUpdate = () => {
|
private onRightPanelStoreUpdate = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
showRightPanel: RightPanelStore.getSharedInstance().isOpenForRoom,
|
showRightPanel: RightPanelStore.getSharedInstance().isOpenForRoom,
|
||||||
|
@ -594,10 +593,45 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private goToFirstRoom = async () => {
|
||||||
|
// TODO actually go to the first room
|
||||||
|
|
||||||
|
const childRooms = SpaceStore.instance.getChildRooms(this.props.space.roomId);
|
||||||
|
if (childRooms.length) {
|
||||||
|
const room = childRooms[0];
|
||||||
|
defaultDispatcher.dispatch({
|
||||||
|
action: "view_room",
|
||||||
|
room_id: room.roomId,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let suggestedRooms = SpaceStore.instance.suggestedRooms;
|
||||||
|
if (SpaceStore.instance.activeSpace !== this.props.space) {
|
||||||
|
// the space store has the suggested rooms loaded for a different space, fetch the right ones
|
||||||
|
suggestedRooms = (await SpaceStore.instance.fetchSuggestedRooms(this.props.space, 1)).rooms;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suggestedRooms.length) {
|
||||||
|
const room = suggestedRooms[0];
|
||||||
|
defaultDispatcher.dispatch({
|
||||||
|
action: "view_room",
|
||||||
|
room_id: room.room_id,
|
||||||
|
oobData: {
|
||||||
|
avatarUrl: room.avatar_url,
|
||||||
|
name: room.name || room.canonical_alias || room.aliases.pop() || _t("Empty room"),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({ phase: Phase.Landing });
|
||||||
|
};
|
||||||
|
|
||||||
private renderBody() {
|
private renderBody() {
|
||||||
switch (this.state.phase) {
|
switch (this.state.phase) {
|
||||||
case Phase.Landing:
|
case Phase.Landing:
|
||||||
if (this.props.space.getMyMembership() === "join") {
|
if (this.state.myMembership === "join") {
|
||||||
return <SpaceLanding space={this.props.space} />;
|
return <SpaceLanding space={this.props.space} />;
|
||||||
} else {
|
} else {
|
||||||
return <SpacePreview
|
return <SpacePreview
|
||||||
|
@ -609,18 +643,21 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||||
case Phase.PublicCreateRooms:
|
case Phase.PublicCreateRooms:
|
||||||
return <SpaceSetupFirstRooms
|
return <SpaceSetupFirstRooms
|
||||||
space={this.props.space}
|
space={this.props.space}
|
||||||
title={_t("What are some things you want to discuss?")}
|
title={_t("What are some things you want to discuss in %(spaceName)s?", {
|
||||||
description={_t("We'll create rooms for each topic.")}
|
spaceName: this.props.space.name,
|
||||||
|
})}
|
||||||
|
description={
|
||||||
|
_t("Let's create a room for each of them.") + "\n" +
|
||||||
|
_t("You can add more later too, including already existing ones.")
|
||||||
|
}
|
||||||
onFinished={() => this.setState({ phase: Phase.PublicShare })}
|
onFinished={() => this.setState({ phase: Phase.PublicShare })}
|
||||||
/>;
|
/>;
|
||||||
case Phase.PublicShare:
|
case Phase.PublicShare:
|
||||||
return <SpaceSetupPublicShare
|
return <SpaceSetupPublicShare space={this.props.space} onFinished={this.goToFirstRoom} />;
|
||||||
space={this.props.space}
|
|
||||||
onFinished={() => this.setState({ phase: Phase.Landing })}
|
|
||||||
/>;
|
|
||||||
|
|
||||||
case Phase.PrivateScope:
|
case Phase.PrivateScope:
|
||||||
return <SpaceSetupPrivateScope
|
return <SpaceSetupPrivateScope
|
||||||
|
space={this.props.space}
|
||||||
onFinished={(invite: boolean) => {
|
onFinished={(invite: boolean) => {
|
||||||
this.setState({ phase: invite ? Phase.PrivateInvite : Phase.PrivateCreateRooms });
|
this.setState({ phase: invite ? Phase.PrivateInvite : Phase.PrivateCreateRooms });
|
||||||
}}
|
}}
|
||||||
|
@ -634,7 +671,8 @@ export default class SpaceRoomView extends React.PureComponent<IProps, IState> {
|
||||||
return <SpaceSetupFirstRooms
|
return <SpaceSetupFirstRooms
|
||||||
space={this.props.space}
|
space={this.props.space}
|
||||||
title={_t("What projects are you working on?")}
|
title={_t("What projects are you working on?")}
|
||||||
description={_t("We'll create rooms for each of them. You can add existing rooms after setup.")}
|
description={_t("We'll create rooms for each of them. " +
|
||||||
|
"You can add more later too, including already existing ones.")}
|
||||||
onFinished={() => this.setState({ phase: Phase.Landing })}
|
onFinished={() => this.setState({ phase: Phase.Landing })}
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ import {LayoutPropType} from "../../settings/Layout";
|
||||||
import React, {createRef} from 'react';
|
import React, {createRef} from 'react';
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {EventTimeline} from "matrix-js-sdk";
|
import {EventTimeline} from "matrix-js-sdk/src/models/event-timeline";
|
||||||
import * as Matrix from "matrix-js-sdk";
|
import {TimelineWindow} from "matrix-js-sdk/src/timeline-window";
|
||||||
import { _t } from '../../languageHandler';
|
import { _t } from '../../languageHandler';
|
||||||
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
||||||
import UserActivity from "../../UserActivity";
|
import UserActivity from "../../UserActivity";
|
||||||
|
@ -463,6 +463,9 @@ class TimelinePanel extends React.Component {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (payload.action === "scroll_to_bottom") {
|
||||||
|
this.jumpToLiveTimeline();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onRoomTimeline = (ev, room, toStartOfTimeline, removed, data) => {
|
onRoomTimeline = (ev, room, toStartOfTimeline, removed, data) => {
|
||||||
|
@ -1007,7 +1010,7 @@ class TimelinePanel extends React.Component {
|
||||||
* returns a promise which will resolve when the load completes.
|
* returns a promise which will resolve when the load completes.
|
||||||
*/
|
*/
|
||||||
_loadTimeline(eventId, pixelOffset, offsetBase) {
|
_loadTimeline(eventId, pixelOffset, offsetBase) {
|
||||||
this._timelineWindow = new Matrix.TimelineWindow(
|
this._timelineWindow = new TimelineWindow(
|
||||||
MatrixClientPeg.get(), this.props.timelineSet,
|
MatrixClientPeg.get(), this.props.timelineSet,
|
||||||
{windowLimit: this.props.timelineCap});
|
{windowLimit: this.props.timelineCap});
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,11 @@ export default class UploadBar extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {uploadsHere: []};
|
|
||||||
|
// Set initial state to any available upload in this room - we might be mounting
|
||||||
|
// earlier than the first progress event, so should show something relevant.
|
||||||
|
const uploadsHere = this.getUploadsInRoom();
|
||||||
|
this.state = {currentUpload: uploadsHere[0], uploadsHere};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -56,6 +60,11 @@ export default class UploadBar extends React.Component<IProps, IState> {
|
||||||
dis.unregister(this.dispatcherRef);
|
dis.unregister(this.dispatcherRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getUploadsInRoom(): IUpload[] {
|
||||||
|
const uploads = ContentMessages.sharedInstance().getCurrentUploads();
|
||||||
|
return uploads.filter(u => u.roomId === this.props.room.roomId);
|
||||||
|
}
|
||||||
|
|
||||||
private onAction = (payload: ActionPayload) => {
|
private onAction = (payload: ActionPayload) => {
|
||||||
switch (payload.action) {
|
switch (payload.action) {
|
||||||
case Action.UploadStarted:
|
case Action.UploadStarted:
|
||||||
|
@ -64,8 +73,7 @@ export default class UploadBar extends React.Component<IProps, IState> {
|
||||||
case Action.UploadCanceled:
|
case Action.UploadCanceled:
|
||||||
case Action.UploadFailed: {
|
case Action.UploadFailed: {
|
||||||
if (!this.mounted) return;
|
if (!this.mounted) return;
|
||||||
const uploads = ContentMessages.sharedInstance().getCurrentUploads();
|
const uploadsHere = this.getUploadsInRoom();
|
||||||
const uploadsHere = uploads.filter(u => u.roomId === this.props.room.roomId);
|
|
||||||
this.setState({currentUpload: uploadsHere[0], uploadsHere});
|
this.setState({currentUpload: uploadsHere[0], uploadsHere});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,14 @@ limitations under the License.
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import Matrix from "matrix-js-sdk";
|
|
||||||
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../MatrixClientPeg";
|
||||||
import * as sdk from "../../index";
|
import * as sdk from "../../index";
|
||||||
import Modal from '../../Modal';
|
import Modal from '../../Modal';
|
||||||
import { _t } from '../../languageHandler';
|
import { _t } from '../../languageHandler';
|
||||||
import HomePage from "./HomePage";
|
import HomePage from "./HomePage";
|
||||||
import {replaceableComponent} from "../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../utils/replaceableComponent";
|
||||||
|
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
||||||
|
import {RoomMember} from "matrix-js-sdk/src/models/room-member";
|
||||||
|
|
||||||
@replaceableComponent("structures.UserView")
|
@replaceableComponent("structures.UserView")
|
||||||
export default class UserView extends React.Component {
|
export default class UserView extends React.Component {
|
||||||
|
@ -68,8 +69,8 @@ export default class UserView extends React.Component {
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fakeEvent = new Matrix.MatrixEvent({type: "m.room.member", content: profileInfo});
|
const fakeEvent = new MatrixEvent({type: "m.room.member", content: profileInfo});
|
||||||
const member = new Matrix.RoomMember(null, this.props.userId);
|
const member = new RoomMember(null, this.props.userId);
|
||||||
member.setMembershipEvent(fakeEvent);
|
member.setMembershipEvent(fakeEvent);
|
||||||
this.setState({member, loading: false});
|
this.setState({member, loading: false});
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,8 +176,8 @@ export default class ViewSource extends React.Component {
|
||||||
return (
|
return (
|
||||||
<BaseDialog className="mx_ViewSource" onFinished={this.props.onFinished} title={_t("View Source")}>
|
<BaseDialog className="mx_ViewSource" onFinished={this.props.onFinished} title={_t("View Source")}>
|
||||||
<div>
|
<div>
|
||||||
<div className="mx_ViewSource_label_left">Room ID: {roomId}</div>
|
<div>Room ID: {roomId}</div>
|
||||||
<div className="mx_ViewSource_label_left">Event ID: {eventId}</div>
|
<div>Event ID: {eventId}</div>
|
||||||
<div className="mx_ViewSource_separator" />
|
<div className="mx_ViewSource_separator" />
|
||||||
{isEditing ? this.editSourceContent() : this.viewSourceContent()}
|
{isEditing ? this.editSourceContent() : this.viewSourceContent()}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Matrix from 'matrix-js-sdk';
|
import {createClient} from 'matrix-js-sdk/src/matrix';
|
||||||
import React, {ReactNode} from 'react';
|
import React, {ReactNode} from 'react';
|
||||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ export default class Registration extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const {hsUrl, isUrl} = serverConfig;
|
const {hsUrl, isUrl} = serverConfig;
|
||||||
const cli = Matrix.createClient({
|
const cli = createClient({
|
||||||
baseUrl: hsUrl,
|
baseUrl: hsUrl,
|
||||||
idBaseUrl: isUrl,
|
idBaseUrl: isUrl,
|
||||||
});
|
});
|
||||||
|
|
|
@ -155,15 +155,14 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
let verifyButton;
|
let verifyButton;
|
||||||
if (store.hasDevicesToVerifyAgainst) {
|
if (store.hasDevicesToVerifyAgainst) {
|
||||||
verifyButton = <AccessibleButton kind="primary" onClick={this._onVerifyClick}>
|
verifyButton = <AccessibleButton kind="primary" onClick={this._onVerifyClick}>
|
||||||
{ _t("Verify with another session") }
|
{ _t("Use another login") }
|
||||||
</AccessibleButton>;
|
</AccessibleButton>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Verify this login to access your encrypted messages and " +
|
"Verify your identity to access encrypted messages and prove your identity to others.",
|
||||||
"prove to others that this login is really you.",
|
|
||||||
)}</p>
|
)}</p>
|
||||||
|
|
||||||
<div className="mx_CompleteSecurity_actionRow">
|
<div className="mx_CompleteSecurity_actionRow">
|
||||||
|
@ -205,8 +204,8 @@ export default class SetupEncryptionBody extends React.Component {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<p>{_t(
|
<p>{_t(
|
||||||
"Without completing security on this session, it won’t have " +
|
"Without verifying, you won’t have access to all your messages " +
|
||||||
"access to encrypted messages.",
|
"and may appear as untrusted to others.",
|
||||||
)}</p>
|
)}</p>
|
||||||
<div className="mx_CompleteSecurity_actionRow">
|
<div className="mx_CompleteSecurity_actionRow">
|
||||||
<AccessibleButton
|
<AccessibleButton
|
||||||
|
|
|
@ -26,6 +26,7 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
||||||
import {toPx} from "../../../utils/units";
|
import {toPx} from "../../../utils/units";
|
||||||
import {ResizeMethod} from "../../../Avatar";
|
import {ResizeMethod} from "../../../Avatar";
|
||||||
|
import { _t } from '../../../languageHandler';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
name: string; // The name (first initial used as default)
|
name: string; // The name (first initial used as default)
|
||||||
|
@ -140,6 +141,7 @@ const BaseAvatar = (props: IProps) => {
|
||||||
if (onClick) {
|
if (onClick) {
|
||||||
return (
|
return (
|
||||||
<AccessibleButton
|
<AccessibleButton
|
||||||
|
aria-label={_t("Avatar")}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
element="span"
|
element="span"
|
||||||
className={classNames("mx_BaseAvatar", className)}
|
className={classNames("mx_BaseAvatar", className)}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import PropTypes from 'prop-types';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import Modal from '../../../Modal';
|
import Modal from '../../../Modal';
|
||||||
import {Group} from 'matrix-js-sdk';
|
import {Group} from 'matrix-js-sdk/src/models/group';
|
||||||
import GroupStore from "../../../stores/GroupStore";
|
import GroupStore from "../../../stores/GroupStore";
|
||||||
import {MenuItem} from "../../structures/ContextMenu";
|
import {MenuItem} from "../../structures/ContextMenu";
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
|
|
@ -19,7 +19,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {EventStatus} from 'matrix-js-sdk';
|
import {EventStatus} from 'matrix-js-sdk/src/models/event';
|
||||||
|
|
||||||
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
||||||
import dis from '../../../dispatcher/dispatcher';
|
import dis from '../../../dispatcher/dispatcher';
|
||||||
|
|
|
@ -22,7 +22,6 @@ import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||||
import {_t} from '../../../languageHandler';
|
import {_t} from '../../../languageHandler';
|
||||||
import {IDialogProps} from "./IDialogProps";
|
import {IDialogProps} from "./IDialogProps";
|
||||||
import BaseDialog from "./BaseDialog";
|
import BaseDialog from "./BaseDialog";
|
||||||
import FormButton from "../elements/FormButton";
|
|
||||||
import Dropdown from "../elements/Dropdown";
|
import Dropdown from "../elements/Dropdown";
|
||||||
import SearchBox from "../../structures/SearchBox";
|
import SearchBox from "../../structures/SearchBox";
|
||||||
import SpaceStore from "../../../stores/SpaceStore";
|
import SpaceStore from "../../../stores/SpaceStore";
|
||||||
|
@ -69,6 +68,7 @@ const AddExistingToSpaceDialog: React.FC<IProps> = ({ matrixClient: cli, space,
|
||||||
const existingRoomsSet = new Set(existingRooms);
|
const existingRoomsSet = new Set(existingRooms);
|
||||||
const rooms = cli.getVisibleRooms().filter(room => {
|
const rooms = cli.getVisibleRooms().filter(room => {
|
||||||
return !existingRoomsSet.has(room) // not already in space
|
return !existingRoomsSet.has(room) // not already in space
|
||||||
|
&& !room.isSpaceRoom() // not a space itself
|
||||||
&& room.name.toLowerCase().includes(lcQuery) // contains query
|
&& room.name.toLowerCase().includes(lcQuery) // contains query
|
||||||
&& !DMRoomMap.shared().getUserIdForRoomId(room.roomId); // not a DM
|
&& !DMRoomMap.shared().getUserIdForRoomId(room.roomId); // not a DM
|
||||||
});
|
});
|
||||||
|
@ -109,7 +109,7 @@ const AddExistingToSpaceDialog: React.FC<IProps> = ({ matrixClient: cli, space,
|
||||||
const title = <React.Fragment>
|
const title = <React.Fragment>
|
||||||
<RoomAvatar room={selectedSpace} height={40} width={40} />
|
<RoomAvatar room={selectedSpace} height={40} width={40} />
|
||||||
<div>
|
<div>
|
||||||
<h1>{ _t("Add existing spaces/rooms") }</h1>
|
<h1>{ _t("Add existing rooms") }</h1>
|
||||||
{ spaceOptionSection }
|
{ spaceOptionSection }
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>;
|
</React.Fragment>;
|
||||||
|
@ -127,29 +127,9 @@ const AddExistingToSpaceDialog: React.FC<IProps> = ({ matrixClient: cli, space,
|
||||||
className="mx_textinput_icon mx_textinput_search"
|
className="mx_textinput_icon mx_textinput_search"
|
||||||
placeholder={ _t("Filter your rooms and spaces") }
|
placeholder={ _t("Filter your rooms and spaces") }
|
||||||
onSearch={setQuery}
|
onSearch={setQuery}
|
||||||
|
autoComplete={true}
|
||||||
/>
|
/>
|
||||||
<AutoHideScrollbar className="mx_AddExistingToSpaceDialog_content" id="mx_AddExistingToSpaceDialog">
|
<AutoHideScrollbar className="mx_AddExistingToSpaceDialog_content" id="mx_AddExistingToSpaceDialog">
|
||||||
{ spaces.length > 0 ? (
|
|
||||||
<div className="mx_AddExistingToSpaceDialog_section mx_AddExistingToSpaceDialog_section_spaces">
|
|
||||||
<h3>{ _t("Spaces") }</h3>
|
|
||||||
{ spaces.map(space => {
|
|
||||||
return <Entry
|
|
||||||
key={space.roomId}
|
|
||||||
room={space}
|
|
||||||
checked={selectedToAdd.has(space)}
|
|
||||||
onChange={(checked) => {
|
|
||||||
if (checked) {
|
|
||||||
selectedToAdd.add(space);
|
|
||||||
} else {
|
|
||||||
selectedToAdd.delete(space);
|
|
||||||
}
|
|
||||||
setSelectedToAdd(new Set(selectedToAdd));
|
|
||||||
}}
|
|
||||||
/>;
|
|
||||||
}) }
|
|
||||||
</div>
|
|
||||||
) : null }
|
|
||||||
|
|
||||||
{ rooms.length > 0 ? (
|
{ rooms.length > 0 ? (
|
||||||
<div className="mx_AddExistingToSpaceDialog_section">
|
<div className="mx_AddExistingToSpaceDialog_section">
|
||||||
<h3>{ _t("Rooms") }</h3>
|
<h3>{ _t("Rooms") }</h3>
|
||||||
|
@ -171,6 +151,27 @@ const AddExistingToSpaceDialog: React.FC<IProps> = ({ matrixClient: cli, space,
|
||||||
</div>
|
</div>
|
||||||
) : undefined }
|
) : undefined }
|
||||||
|
|
||||||
|
{ spaces.length > 0 ? (
|
||||||
|
<div className="mx_AddExistingToSpaceDialog_section mx_AddExistingToSpaceDialog_section_spaces">
|
||||||
|
<h3>{ _t("Spaces") }</h3>
|
||||||
|
{ spaces.map(space => {
|
||||||
|
return <Entry
|
||||||
|
key={space.roomId}
|
||||||
|
room={space}
|
||||||
|
checked={selectedToAdd.has(space)}
|
||||||
|
onChange={(checked) => {
|
||||||
|
if (checked) {
|
||||||
|
selectedToAdd.add(space);
|
||||||
|
} else {
|
||||||
|
selectedToAdd.delete(space);
|
||||||
|
}
|
||||||
|
setSelectedToAdd(new Set(selectedToAdd));
|
||||||
|
}}
|
||||||
|
/>;
|
||||||
|
}) }
|
||||||
|
</div>
|
||||||
|
) : null }
|
||||||
|
|
||||||
{ spaces.length + rooms.length < 1 ? <span className="mx_AddExistingToSpaceDialog_noResults">
|
{ spaces.length + rooms.length < 1 ? <span className="mx_AddExistingToSpaceDialog_noResults">
|
||||||
{ _t("No results") }
|
{ _t("No results") }
|
||||||
</span> : undefined }
|
</span> : undefined }
|
||||||
|
@ -184,8 +185,8 @@ const AddExistingToSpaceDialog: React.FC<IProps> = ({ matrixClient: cli, space,
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<FormButton
|
<AccessibleButton
|
||||||
label={busy ? _t("Applying...") : _t("Apply")}
|
kind="primary"
|
||||||
disabled={busy || selectedToAdd.size < 1}
|
disabled={busy || selectedToAdd.size < 1}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
|
@ -199,7 +200,9 @@ const AddExistingToSpaceDialog: React.FC<IProps> = ({ matrixClient: cli, space,
|
||||||
}
|
}
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{ busy ? _t("Adding...") : _t("Add") }
|
||||||
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>;
|
</BaseDialog>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { MatrixClient } from 'matrix-js-sdk';
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import { GroupMemberType } from '../../../groups';
|
import { GroupMemberType } from '../../../groups';
|
||||||
|
|
|
@ -19,7 +19,6 @@ import PropTypes from 'prop-types';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import SyntaxHighlight from '../elements/SyntaxHighlight';
|
import SyntaxHighlight from '../elements/SyntaxHighlight';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import { Room, MatrixEvent } from "matrix-js-sdk";
|
|
||||||
import Field from "../elements/Field";
|
import Field from "../elements/Field";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
||||||
|
@ -39,6 +38,8 @@ import SettingsStore, {LEVEL_ORDER} from "../../../settings/SettingsStore";
|
||||||
import Modal from "../../../Modal";
|
import Modal from "../../../Modal";
|
||||||
import ErrorDialog from "./ErrorDialog";
|
import ErrorDialog from "./ErrorDialog";
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
import {Room} from "matrix-js-sdk/src/models/room";
|
||||||
|
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
class GenericEditor extends React.PureComponent {
|
class GenericEditor extends React.PureComponent {
|
||||||
// static propTypes = {onBack: PropTypes.func.isRequired};
|
// static propTypes = {onBack: PropTypes.func.isRequired};
|
||||||
|
|
|
@ -29,7 +29,9 @@ import dis from "../../../dispatcher/dispatcher";
|
||||||
import IdentityAuthClient from "../../../IdentityAuthClient";
|
import IdentityAuthClient from "../../../IdentityAuthClient";
|
||||||
import Modal from "../../../Modal";
|
import Modal from "../../../Modal";
|
||||||
import {humanizeTime} from "../../../utils/humanize";
|
import {humanizeTime} from "../../../utils/humanize";
|
||||||
import createRoom, {canEncryptToAllUsers, findDMForUser, privateShouldBeEncrypted} from "../../../createRoom";
|
import createRoom, {
|
||||||
|
canEncryptToAllUsers, ensureDMExists, findDMForUser, privateShouldBeEncrypted,
|
||||||
|
} from "../../../createRoom";
|
||||||
import {inviteMultipleToRoom, showCommunityInviteDialog} from "../../../RoomInvite";
|
import {inviteMultipleToRoom, showCommunityInviteDialog} from "../../../RoomInvite";
|
||||||
import {Key} from "../../../Keyboard";
|
import {Key} from "../../../Keyboard";
|
||||||
import {Action} from "../../../dispatcher/actions";
|
import {Action} from "../../../dispatcher/actions";
|
||||||
|
@ -43,6 +45,7 @@ import {Room} from "matrix-js-sdk/src/models/room";
|
||||||
import { MatrixCall } from 'matrix-js-sdk/src/webrtc/call';
|
import { MatrixCall } from 'matrix-js-sdk/src/webrtc/call';
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
import {mediaFromMxc} from "../../../customisations/Media";
|
import {mediaFromMxc} from "../../../customisations/Media";
|
||||||
|
import {getAddressType} from "../../../UserAddress";
|
||||||
|
|
||||||
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
|
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
@ -331,6 +334,7 @@ interface IInviteDialogState {
|
||||||
threepidResultsMixin: { user: Member, userId: string}[];
|
threepidResultsMixin: { user: Member, userId: string}[];
|
||||||
canUseIdentityServer: boolean;
|
canUseIdentityServer: boolean;
|
||||||
tryingIdentityServer: boolean;
|
tryingIdentityServer: boolean;
|
||||||
|
consultFirst: boolean;
|
||||||
|
|
||||||
// These two flags are used for the 'Go' button to communicate what is going on.
|
// These two flags are used for the 'Go' button to communicate what is going on.
|
||||||
busy: boolean,
|
busy: boolean,
|
||||||
|
@ -379,6 +383,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
threepidResultsMixin: [],
|
threepidResultsMixin: [],
|
||||||
canUseIdentityServer: !!MatrixClientPeg.get().getIdentityServerUrl(),
|
canUseIdentityServer: !!MatrixClientPeg.get().getIdentityServerUrl(),
|
||||||
tryingIdentityServer: false,
|
tryingIdentityServer: false,
|
||||||
|
consultFirst: false,
|
||||||
|
|
||||||
// These two flags are used for the 'Go' button to communicate what is going on.
|
// These two flags are used for the 'Go' button to communicate what is going on.
|
||||||
busy: false,
|
busy: false,
|
||||||
|
@ -394,6 +399,10 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onConsultFirstChange = (ev) => {
|
||||||
|
this.setState({consultFirst: ev.target.checked});
|
||||||
|
}
|
||||||
|
|
||||||
static buildRecents(excludedTargetIds: Set<string>): {userId: string, user: RoomMember, lastActive: number}[] {
|
static buildRecents(excludedTargetIds: Set<string>): {userId: string, user: RoomMember, lastActive: number}[] {
|
||||||
const rooms = DMRoomMap.shared().getUniqueRoomsWithIndividuals(); // map of userId => js-sdk Room
|
const rooms = DMRoomMap.shared().getUniqueRoomsWithIndividuals(); // map of userId => js-sdk Room
|
||||||
|
|
||||||
|
@ -673,19 +682,20 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: false,
|
busy: false,
|
||||||
errorText: _t("We couldn't create your DM. Please check the users you want to invite and try again."),
|
errorText: _t("We couldn't create your DM."),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_inviteUsers = () => {
|
_inviteUsers = async () => {
|
||||||
const startTime = CountlyAnalytics.getTimestamp();
|
const startTime = CountlyAnalytics.getTimestamp();
|
||||||
this.setState({busy: true});
|
this.setState({busy: true});
|
||||||
this._convertFilter();
|
this._convertFilter();
|
||||||
const targets = this._convertFilter();
|
const targets = this._convertFilter();
|
||||||
const targetIds = targets.map(t => t.userId);
|
const targetIds = targets.map(t => t.userId);
|
||||||
|
|
||||||
const room = MatrixClientPeg.get().getRoom(this.props.roomId);
|
const cli = MatrixClientPeg.get();
|
||||||
|
const room = cli.getRoom(this.props.roomId);
|
||||||
if (!room) {
|
if (!room) {
|
||||||
console.error("Failed to find the room to invite users to");
|
console.error("Failed to find the room to invite users to");
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -695,12 +705,34 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
inviteMultipleToRoom(this.props.roomId, targetIds).then(result => {
|
try {
|
||||||
|
const result = await inviteMultipleToRoom(this.props.roomId, targetIds)
|
||||||
CountlyAnalytics.instance.trackSendInvite(startTime, this.props.roomId, targetIds.length);
|
CountlyAnalytics.instance.trackSendInvite(startTime, this.props.roomId, targetIds.length);
|
||||||
if (!this._shouldAbortAfterInviteError(result)) { // handles setting error message too
|
if (!this._shouldAbortAfterInviteError(result)) { // handles setting error message too
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
|
||||||
|
if (cli.isRoomEncrypted(this.props.roomId) &&
|
||||||
|
SettingsStore.getValue("feature_room_history_key_sharing")) {
|
||||||
|
const visibilityEvent = room.currentState.getStateEvents(
|
||||||
|
"m.room.history_visibility", "",
|
||||||
|
);
|
||||||
|
const visibility = visibilityEvent && visibilityEvent.getContent() &&
|
||||||
|
visibilityEvent.getContent().history_visibility;
|
||||||
|
if (visibility == "world_readable" || visibility == "shared") {
|
||||||
|
const invitedUsers = [];
|
||||||
|
for (const [addr, state] of Object.entries(result.states)) {
|
||||||
|
if (state === "invited" && getAddressType(addr) === "mx-user-id") {
|
||||||
|
invitedUsers.push(addr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("Sharing history with", invitedUsers);
|
||||||
|
cli.sendSharedHistoryKeys(
|
||||||
|
this.props.roomId, invitedUsers,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.setState({
|
this.setState({
|
||||||
busy: false,
|
busy: false,
|
||||||
|
@ -708,7 +740,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
"We couldn't invite those users. Please check the users you want to invite and try again.",
|
"We couldn't invite those users. Please check the users you want to invite and try again.",
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_transferCall = async () => {
|
_transferCall = async () => {
|
||||||
|
@ -721,6 +753,23 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.state.consultFirst) {
|
||||||
|
const dmRoomId = await ensureDMExists(MatrixClientPeg.get(), targetIds[0]);
|
||||||
|
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'place_call',
|
||||||
|
type: this.props.call.type,
|
||||||
|
room_id: dmRoomId,
|
||||||
|
transferee: this.props.call,
|
||||||
|
});
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'view_room',
|
||||||
|
room_id: dmRoomId,
|
||||||
|
should_peek: false,
|
||||||
|
joining: false,
|
||||||
|
});
|
||||||
|
this.props.onFinished();
|
||||||
|
} else {
|
||||||
this.setState({busy: true});
|
this.setState({busy: true});
|
||||||
try {
|
try {
|
||||||
await this.props.call.transfer(targetIds[0]);
|
await this.props.call.transfer(targetIds[0]);
|
||||||
|
@ -732,6 +781,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
errorText: _t("Failed to transfer call"),
|
errorText: _t("Failed to transfer call"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_onKeyDown = (e) => {
|
_onKeyDown = (e) => {
|
||||||
|
@ -886,6 +936,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
};
|
};
|
||||||
|
|
||||||
_toggleMember = (member: Member) => {
|
_toggleMember = (member: Member) => {
|
||||||
|
if (!this.state.busy) {
|
||||||
let filterText = this.state.filterText;
|
let filterText = this.state.filterText;
|
||||||
const targets = this.state.targets.map(t => t); // cheap clone for mutation
|
const targets = this.state.targets.map(t => t); // cheap clone for mutation
|
||||||
const idx = targets.indexOf(member);
|
const idx = targets.indexOf(member);
|
||||||
|
@ -900,6 +951,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
if (this._editorRef && this._editorRef.current) {
|
if (this._editorRef && this._editorRef.current) {
|
||||||
this._editorRef.current.focus();
|
this._editorRef.current.focus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_removeMember = (member: Member) => {
|
_removeMember = (member: Member) => {
|
||||||
|
@ -1189,10 +1241,13 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
let helpText;
|
let helpText;
|
||||||
let buttonText;
|
let buttonText;
|
||||||
let goButtonFn;
|
let goButtonFn;
|
||||||
|
let consultSection;
|
||||||
|
let keySharingWarning = <span />;
|
||||||
|
|
||||||
const identityServersEnabled = SettingsStore.getValue(UIFeature.IdentityServer);
|
const identityServersEnabled = SettingsStore.getValue(UIFeature.IdentityServer);
|
||||||
|
|
||||||
const userId = MatrixClientPeg.get().getUserId();
|
const cli = MatrixClientPeg.get();
|
||||||
|
const userId = cli.getUserId();
|
||||||
if (this.props.kind === KIND_DM) {
|
if (this.props.kind === KIND_DM) {
|
||||||
title = _t("Direct Messages");
|
title = _t("Direct Messages");
|
||||||
|
|
||||||
|
@ -1256,7 +1311,9 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
? _t("Invite to %(spaceName)s", {
|
? _t("Invite to %(spaceName)s", {
|
||||||
spaceName: room.name || _t("Unnamed Space"),
|
spaceName: room.name || _t("Unnamed Space"),
|
||||||
})
|
})
|
||||||
: _t("Invite to this room");
|
: _t("Invite to %(roomName)s", {
|
||||||
|
roomName: room.name || _t("Unnamed Room"),
|
||||||
|
});
|
||||||
|
|
||||||
let helpTextUntranslated;
|
let helpTextUntranslated;
|
||||||
if (isSpace) {
|
if (isSpace) {
|
||||||
|
@ -1286,10 +1343,35 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
|
|
||||||
buttonText = _t("Invite");
|
buttonText = _t("Invite");
|
||||||
goButtonFn = this._inviteUsers;
|
goButtonFn = this._inviteUsers;
|
||||||
|
|
||||||
|
if (SettingsStore.getValue("feature_room_history_key_sharing") &&
|
||||||
|
cli.isRoomEncrypted(this.props.roomId)) {
|
||||||
|
const room = cli.getRoom(this.props.roomId);
|
||||||
|
const visibilityEvent = room.currentState.getStateEvents(
|
||||||
|
"m.room.history_visibility", "",
|
||||||
|
);
|
||||||
|
const visibility = visibilityEvent && visibilityEvent.getContent() &&
|
||||||
|
visibilityEvent.getContent().history_visibility;
|
||||||
|
if (visibility === "world_readable" || visibility === "shared") {
|
||||||
|
keySharingWarning =
|
||||||
|
<p className='mx_InviteDialog_helpText'>
|
||||||
|
<img
|
||||||
|
src={require("../../../../res/img/element-icons/info.svg")}
|
||||||
|
width={14} height={14} />
|
||||||
|
{" " + _t("Invited people will be able to read old messages.")}
|
||||||
|
</p>;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (this.props.kind === KIND_CALL_TRANSFER) {
|
} else if (this.props.kind === KIND_CALL_TRANSFER) {
|
||||||
title = _t("Transfer");
|
title = _t("Transfer");
|
||||||
buttonText = _t("Transfer");
|
buttonText = _t("Transfer");
|
||||||
goButtonFn = this._transferCall;
|
goButtonFn = this._transferCall;
|
||||||
|
consultSection = <div>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" checked={this.state.consultFirst} onChange={this.onConsultFirstChange} />
|
||||||
|
{_t("Consult first")}
|
||||||
|
</label>
|
||||||
|
</div>;
|
||||||
} else {
|
} else {
|
||||||
console.error("Unknown kind of InviteDialog: " + this.props.kind);
|
console.error("Unknown kind of InviteDialog: " + this.props.kind);
|
||||||
}
|
}
|
||||||
|
@ -1319,12 +1401,14 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
{spinner}
|
{spinner}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{keySharingWarning}
|
||||||
{this._renderIdentityServerWarning()}
|
{this._renderIdentityServerWarning()}
|
||||||
<div className='error'>{this.state.errorText}</div>
|
<div className='error'>{this.state.errorText}</div>
|
||||||
<div className='mx_InviteDialog_userSections'>
|
<div className='mx_InviteDialog_userSections'>
|
||||||
{this._renderSection('recents')}
|
{this._renderSection('recents')}
|
||||||
{this._renderSection('suggestions')}
|
{this._renderSection('suggestions')}
|
||||||
</div>
|
</div>
|
||||||
|
{consultSection}
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,7 +18,7 @@ import React, {PureComponent} from 'react';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import {MatrixEvent} from "matrix-js-sdk";
|
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
||||||
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
import {MatrixClientPeg} from "../../../MatrixClientPeg";
|
||||||
import SdkConfig from '../../../SdkConfig';
|
import SdkConfig from '../../../SdkConfig';
|
||||||
import Markdown from '../../../Markdown';
|
import Markdown from '../../../Markdown';
|
||||||
|
|
54
src/components/views/dialogs/SeshatResetDialog.tsx
Normal file
54
src/components/views/dialogs/SeshatResetDialog.tsx
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import {_t} from "../../../languageHandler";
|
||||||
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
|
import BaseDialog from "./BaseDialog";
|
||||||
|
import DialogButtons from "../elements/DialogButtons";
|
||||||
|
|
||||||
|
import {IDialogProps} from "./IDialogProps";
|
||||||
|
|
||||||
|
@replaceableComponent("views.dialogs.SeshatResetDialog")
|
||||||
|
export default class SeshatResetDialog extends React.PureComponent<IDialogProps> {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<BaseDialog
|
||||||
|
hasCancel={true}
|
||||||
|
onFinished={this.props.onFinished.bind(null, false)}
|
||||||
|
title={_t("Reset event store?")}>
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
{_t("You most likely do not want to reset your event index store")}
|
||||||
|
<br />
|
||||||
|
{_t("If you do, please note that none of your messages will be deleted, " +
|
||||||
|
"but the search experience might be degraded for a few moments" +
|
||||||
|
"whilst the index is recreated",
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<DialogButtons
|
||||||
|
primaryButton={_t("Reset event store")}
|
||||||
|
onPrimaryButtonClick={this.props.onFinished.bind(null, true)}
|
||||||
|
primaryButtonClass="danger"
|
||||||
|
cancelButton={_t("Cancel")}
|
||||||
|
onCancel={this.props.onFinished.bind(null, false)}
|
||||||
|
/>
|
||||||
|
</BaseDialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,7 +28,6 @@ import {getTopic} from "../elements/RoomTopic";
|
||||||
import {avatarUrlForRoom} from "../../../Avatar";
|
import {avatarUrlForRoom} from "../../../Avatar";
|
||||||
import ToggleSwitch from "../elements/ToggleSwitch";
|
import ToggleSwitch from "../elements/ToggleSwitch";
|
||||||
import AccessibleButton from "../elements/AccessibleButton";
|
import AccessibleButton from "../elements/AccessibleButton";
|
||||||
import FormButton from "../elements/FormButton";
|
|
||||||
import Modal from "../../../Modal";
|
import Modal from "../../../Modal";
|
||||||
import defaultDispatcher from "../../../dispatcher/dispatcher";
|
import defaultDispatcher from "../../../dispatcher/dispatcher";
|
||||||
import {allSettled} from "../../../utils/promise";
|
import {allSettled} from "../../../utils/promise";
|
||||||
|
@ -127,23 +126,24 @@ const SpaceSettingsDialog: React.FC<IProps> = ({ matrixClient: cli, space, onFin
|
||||||
<div>
|
<div>
|
||||||
{ _t("Make this space private") }
|
{ _t("Make this space private") }
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
checked={joinRule === "private"}
|
checked={joinRule !== "public"}
|
||||||
onChange={checked => setJoinRule(checked ? "private" : "invite")}
|
onChange={checked => setJoinRule(checked ? "invite" : "public")}
|
||||||
disabled={!canSetJoinRule}
|
disabled={!canSetJoinRule}
|
||||||
aria-label={_t("Make this space private")}
|
aria-label={_t("Make this space private")}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FormButton
|
<AccessibleButton
|
||||||
kind="danger"
|
kind="danger"
|
||||||
label={_t("Leave Space")}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
defaultDispatcher.dispatch({
|
defaultDispatcher.dispatch({
|
||||||
action: "leave_room",
|
action: "leave_room",
|
||||||
room_id: space.roomId,
|
room_id: space.roomId,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
|
{ _t("Leave Space") }
|
||||||
|
</AccessibleButton>
|
||||||
|
|
||||||
<div className="mx_SpaceSettingsDialog_buttons">
|
<div className="mx_SpaceSettingsDialog_buttons">
|
||||||
<AccessibleButton onClick={() => Modal.createDialog(DevtoolsDialog, {roomId: space.roomId})}>
|
<AccessibleButton onClick={() => Modal.createDialog(DevtoolsDialog, {roomId: space.roomId})}>
|
||||||
|
@ -152,7 +152,9 @@ const SpaceSettingsDialog: React.FC<IProps> = ({ matrixClient: cli, space, onFin
|
||||||
<AccessibleButton onClick={onFinished} disabled={busy} kind="link">
|
<AccessibleButton onClick={onFinished} disabled={busy} kind="link">
|
||||||
{ _t("Cancel") }
|
{ _t("Cancel") }
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
<FormButton onClick={onSave} disabled={busy} label={busy ? _t("Saving...") : _t("Save Changes")} />
|
<AccessibleButton onClick={onSave} disabled={busy} kind="primary">
|
||||||
|
{ busy ? _t("Saving...") : _t("Save Changes") }
|
||||||
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</BaseDialog>;
|
</BaseDialog>;
|
||||||
|
|
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {IntegrationManagers} from "../../../integrations/IntegrationManagers";
|
import {IntegrationManagers} from "../../../integrations/IntegrationManagers";
|
||||||
import {Room} from "matrix-js-sdk";
|
import {Room} from "matrix-js-sdk/src/models/room";
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import {dialogTermsInteractionCallback, TermsNotSignedError} from "../../../Terms";
|
import {dialogTermsInteractionCallback, TermsNotSignedError} from "../../../Terms";
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
|
@ -20,8 +20,8 @@ import PropTypes from 'prop-types';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import { _t, pickBestLanguage } from '../../../languageHandler';
|
import { _t, pickBestLanguage } from '../../../languageHandler';
|
||||||
|
|
||||||
import Matrix from 'matrix-js-sdk';
|
|
||||||
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
import {replaceableComponent} from "../../../utils/replaceableComponent";
|
||||||
|
import {SERVICE_TYPES} from "matrix-js-sdk/src/service-types";
|
||||||
|
|
||||||
class TermsCheckbox extends React.PureComponent {
|
class TermsCheckbox extends React.PureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -85,22 +85,22 @@ export default class TermsDialog extends React.PureComponent {
|
||||||
|
|
||||||
_nameForServiceType(serviceType, host) {
|
_nameForServiceType(serviceType, host) {
|
||||||
switch (serviceType) {
|
switch (serviceType) {
|
||||||
case Matrix.SERVICE_TYPES.IS:
|
case SERVICE_TYPES.IS:
|
||||||
return <div>{_t("Identity Server")}<br />({host})</div>;
|
return <div>{_t("Identity Server")}<br />({host})</div>;
|
||||||
case Matrix.SERVICE_TYPES.IM:
|
case SERVICE_TYPES.IM:
|
||||||
return <div>{_t("Integration Manager")}<br />({host})</div>;
|
return <div>{_t("Integration Manager")}<br />({host})</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_summaryForServiceType(serviceType) {
|
_summaryForServiceType(serviceType) {
|
||||||
switch (serviceType) {
|
switch (serviceType) {
|
||||||
case Matrix.SERVICE_TYPES.IS:
|
case SERVICE_TYPES.IS:
|
||||||
return <div>
|
return <div>
|
||||||
{_t("Find others by phone or email")}
|
{_t("Find others by phone or email")}
|
||||||
<br />
|
<br />
|
||||||
{_t("Be found by phone or email")}
|
{_t("Be found by phone or email")}
|
||||||
</div>;
|
</div>;
|
||||||
case Matrix.SERVICE_TYPES.IM:
|
case SERVICE_TYPES.IM:
|
||||||
return <div>
|
return <div>
|
||||||
{_t("Use bots, bridges, widgets and sticker packs")}
|
{_t("Use bots, bridges, widgets and sticker packs")}
|
||||||
</div>;
|
</div>;
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default class VerificationRequestDialog extends React.Component {
|
||||||
const member = this.props.member ||
|
const member = this.props.member ||
|
||||||
otherUserId && MatrixClientPeg.get().getUser(otherUserId);
|
otherUserId && MatrixClientPeg.get().getUser(otherUserId);
|
||||||
const title = request && request.isSelfVerification ?
|
const title = request && request.isSelfVerification ?
|
||||||
_t("Verify other session") : _t("Verification Request");
|
_t("Verify other login") : _t("Verification Request");
|
||||||
|
|
||||||
return <BaseDialog className="mx_InfoDialog" onFinished={this.props.onFinished}
|
return <BaseDialog className="mx_InfoDialog" onFinished={this.props.onFinished}
|
||||||
contentId="mx_Dialog_content"
|
contentId="mx_Dialog_content"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2018, 2019 New Vector Ltd
|
Copyright 2018-2021 The Matrix.org Foundation C.I.C.
|
||||||
Copyright 2019, 2020 The Matrix.org Foundation C.I.C.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -17,14 +16,15 @@ limitations under the License.
|
||||||
|
|
||||||
import {debounce} from "lodash";
|
import {debounce} from "lodash";
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React from 'react';
|
import React, {ChangeEvent, FormEvent} from 'react';
|
||||||
import PropTypes from "prop-types";
|
import {ISecretStorageKeyInfo} from "matrix-js-sdk/src";
|
||||||
|
|
||||||
import * as sdk from '../../../../index';
|
import * as sdk from '../../../../index';
|
||||||
import {MatrixClientPeg} from '../../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../../MatrixClientPeg';
|
||||||
import Field from '../../elements/Field';
|
import Field from '../../elements/Field';
|
||||||
import AccessibleButton from '../../elements/AccessibleButton';
|
import AccessibleButton from '../../elements/AccessibleButton';
|
||||||
|
import {_t} from '../../../../languageHandler';
|
||||||
import { _t } from '../../../../languageHandler';
|
import {IDialogProps} from "../IDialogProps";
|
||||||
|
|
||||||
// Maximum acceptable size of a key file. It's 59 characters including the spaces we encode,
|
// Maximum acceptable size of a key file. It's 59 characters including the spaces we encode,
|
||||||
// so this should be plenty and allow for people putting extra whitespace in the file because
|
// so this should be plenty and allow for people putting extra whitespace in the file because
|
||||||
|
@ -34,22 +34,30 @@ const KEY_FILE_MAX_SIZE = 128;
|
||||||
// Don't shout at the user that their key is invalid every time they type a key: wait a short time
|
// Don't shout at the user that their key is invalid every time they type a key: wait a short time
|
||||||
const VALIDATION_THROTTLE_MS = 200;
|
const VALIDATION_THROTTLE_MS = 200;
|
||||||
|
|
||||||
|
interface IProps extends IDialogProps {
|
||||||
|
keyInfo: ISecretStorageKeyInfo;
|
||||||
|
checkPrivateKey: (k: {passphrase?: string, recoveryKey?: string}) => boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IState {
|
||||||
|
recoveryKey: string;
|
||||||
|
recoveryKeyValid: boolean | null;
|
||||||
|
recoveryKeyCorrect: boolean | null;
|
||||||
|
recoveryKeyFileError: boolean | null;
|
||||||
|
forceRecoveryKey: boolean;
|
||||||
|
passPhrase: string;
|
||||||
|
keyMatches: boolean | null;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Access Secure Secret Storage by requesting the user's passphrase.
|
* Access Secure Secret Storage by requesting the user's passphrase.
|
||||||
*/
|
*/
|
||||||
export default class AccessSecretStorageDialog extends React.PureComponent {
|
export default class AccessSecretStorageDialog extends React.PureComponent<IProps, IState> {
|
||||||
static propTypes = {
|
private fileUpload = React.createRef<HTMLInputElement>();
|
||||||
// { passphrase, pubkey }
|
|
||||||
keyInfo: PropTypes.object.isRequired,
|
|
||||||
// Function from one of { passphrase, recoveryKey } -> boolean
|
|
||||||
checkPrivateKey: PropTypes.func.isRequired,
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this._fileUpload = React.createRef();
|
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
recoveryKey: "",
|
recoveryKey: "",
|
||||||
recoveryKeyValid: null,
|
recoveryKeyValid: null,
|
||||||
|
@ -61,21 +69,21 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
_onCancel = () => {
|
private onCancel = () => {
|
||||||
this.props.onFinished(false);
|
this.props.onFinished(false);
|
||||||
}
|
};
|
||||||
|
|
||||||
_onUseRecoveryKeyClick = () => {
|
private onUseRecoveryKeyClick = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
forceRecoveryKey: true,
|
forceRecoveryKey: true,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
_validateRecoveryKeyOnChange = debounce(() => {
|
private validateRecoveryKeyOnChange = debounce(async () => {
|
||||||
this._validateRecoveryKey();
|
await this.validateRecoveryKey();
|
||||||
}, VALIDATION_THROTTLE_MS);
|
}, VALIDATION_THROTTLE_MS);
|
||||||
|
|
||||||
async _validateRecoveryKey() {
|
private async validateRecoveryKey() {
|
||||||
if (this.state.recoveryKey === '') {
|
if (this.state.recoveryKey === '') {
|
||||||
this.setState({
|
this.setState({
|
||||||
recoveryKeyValid: null,
|
recoveryKeyValid: null,
|
||||||
|
@ -102,27 +110,27 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_onRecoveryKeyChange = (e) => {
|
private onRecoveryKeyChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
recoveryKey: e.target.value,
|
recoveryKey: ev.target.value,
|
||||||
recoveryKeyFileError: null,
|
recoveryKeyFileError: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
// also clear the file upload control so that the user can upload the same file
|
// also clear the file upload control so that the user can upload the same file
|
||||||
// the did before (otherwise the onchange wouldn't fire)
|
// the did before (otherwise the onchange wouldn't fire)
|
||||||
if (this._fileUpload.current) this._fileUpload.current.value = null;
|
if (this.fileUpload.current) this.fileUpload.current.value = null;
|
||||||
|
|
||||||
// We don't use Field's validation here because a) we want it in a separate place rather
|
// We don't use Field's validation here because a) we want it in a separate place rather
|
||||||
// than in a tooltip and b) we want it to display feedback based on the uploaded file
|
// than in a tooltip and b) we want it to display feedback based on the uploaded file
|
||||||
// as well as the text box. Ideally we would refactor Field's validation logic so we could
|
// as well as the text box. Ideally we would refactor Field's validation logic so we could
|
||||||
// re-use some of it.
|
// re-use some of it.
|
||||||
this._validateRecoveryKeyOnChange();
|
this.validateRecoveryKeyOnChange();
|
||||||
}
|
};
|
||||||
|
|
||||||
_onRecoveryKeyFileChange = async e => {
|
private onRecoveryKeyFileChange = async (ev: ChangeEvent<HTMLInputElement>) => {
|
||||||
if (e.target.files.length === 0) return;
|
if (ev.target.files.length === 0) return;
|
||||||
|
|
||||||
const f = e.target.files[0];
|
const f = ev.target.files[0];
|
||||||
|
|
||||||
if (f.size > KEY_FILE_MAX_SIZE) {
|
if (f.size > KEY_FILE_MAX_SIZE) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -140,7 +148,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
recoveryKeyFileError: null,
|
recoveryKeyFileError: null,
|
||||||
recoveryKey: contents.trim(),
|
recoveryKey: contents.trim(),
|
||||||
});
|
});
|
||||||
this._validateRecoveryKey();
|
await this.validateRecoveryKey();
|
||||||
} else {
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
recoveryKeyFileError: true,
|
recoveryKeyFileError: true,
|
||||||
|
@ -150,14 +158,14 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private onRecoveryKeyFileUploadClick = () => {
|
||||||
|
this.fileUpload.current.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
_onRecoveryKeyFileUploadClick = () => {
|
private onPassPhraseNext = async (ev: FormEvent<HTMLFormElement>) => {
|
||||||
this._fileUpload.current.click();
|
ev.preventDefault();
|
||||||
}
|
|
||||||
|
|
||||||
_onPassPhraseNext = async (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
if (this.state.passPhrase.length <= 0) return;
|
if (this.state.passPhrase.length <= 0) return;
|
||||||
|
|
||||||
|
@ -169,10 +177,10 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
} else {
|
} else {
|
||||||
this.setState({ keyMatches });
|
this.setState({ keyMatches });
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
_onRecoveryKeyNext = async (e) => {
|
private onRecoveryKeyNext = async (ev: FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
if (!this.state.recoveryKeyValid) return;
|
if (!this.state.recoveryKeyValid) return;
|
||||||
|
|
||||||
|
@ -184,16 +192,16 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
} else {
|
} else {
|
||||||
this.setState({ keyMatches });
|
this.setState({ keyMatches });
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
_onPassPhraseChange = (e) => {
|
private onPassPhraseChange = (ev: ChangeEvent<HTMLInputElement>) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
passPhrase: e.target.value,
|
passPhrase: ev.target.value,
|
||||||
keyMatches: null,
|
keyMatches: null,
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
getKeyValidationText() {
|
private getKeyValidationText(): string {
|
||||||
if (this.state.recoveryKeyFileError) {
|
if (this.state.recoveryKeyFileError) {
|
||||||
return _t("Wrong file type");
|
return _t("Wrong file type");
|
||||||
} else if (this.state.recoveryKeyCorrect) {
|
} else if (this.state.recoveryKeyCorrect) {
|
||||||
|
@ -208,7 +216,8 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog');
|
// Caution: Making this an import will break tests.
|
||||||
|
const BaseDialog = sdk.getComponent("views.dialogs.BaseDialog");
|
||||||
|
|
||||||
const hasPassphrase = (
|
const hasPassphrase = (
|
||||||
this.props.keyInfo &&
|
this.props.keyInfo &&
|
||||||
|
@ -244,18 +253,18 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
{
|
{
|
||||||
button: s => <AccessibleButton className="mx_linkButton"
|
button: s => <AccessibleButton className="mx_linkButton"
|
||||||
element="span"
|
element="span"
|
||||||
onClick={this._onUseRecoveryKeyClick}
|
onClick={this.onUseRecoveryKeyClick}
|
||||||
>
|
>
|
||||||
{s}
|
{s}
|
||||||
</AccessibleButton>,
|
</AccessibleButton>,
|
||||||
},
|
},
|
||||||
)}</p>
|
)}</p>
|
||||||
|
|
||||||
<form className="mx_AccessSecretStorageDialog_primaryContainer" onSubmit={this._onPassPhraseNext}>
|
<form className="mx_AccessSecretStorageDialog_primaryContainer" onSubmit={this.onPassPhraseNext}>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
className="mx_AccessSecretStorageDialog_passPhraseInput"
|
className="mx_AccessSecretStorageDialog_passPhraseInput"
|
||||||
onChange={this._onPassPhraseChange}
|
onChange={this.onPassPhraseChange}
|
||||||
value={this.state.passPhrase}
|
value={this.state.passPhrase}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
autoComplete="new-password"
|
autoComplete="new-password"
|
||||||
|
@ -264,9 +273,9 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
{keyStatus}
|
{keyStatus}
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
primaryButton={_t('Continue')}
|
primaryButton={_t('Continue')}
|
||||||
onPrimaryButtonClick={this._onPassPhraseNext}
|
onPrimaryButtonClick={this.onPassPhraseNext}
|
||||||
hasCancel={true}
|
hasCancel={true}
|
||||||
onCancel={this._onCancel}
|
onCancel={this.onCancel}
|
||||||
focus={false}
|
focus={false}
|
||||||
primaryDisabled={this.state.passPhrase.length === 0}
|
primaryDisabled={this.state.passPhrase.length === 0}
|
||||||
/>
|
/>
|
||||||
|
@ -291,7 +300,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
|
|
||||||
<form
|
<form
|
||||||
className="mx_AccessSecretStorageDialog_primaryContainer"
|
className="mx_AccessSecretStorageDialog_primaryContainer"
|
||||||
onSubmit={this._onRecoveryKeyNext}
|
onSubmit={this.onRecoveryKeyNext}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
>
|
>
|
||||||
|
@ -301,7 +310,7 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
type="password"
|
type="password"
|
||||||
label={_t('Security Key')}
|
label={_t('Security Key')}
|
||||||
value={this.state.recoveryKey}
|
value={this.state.recoveryKey}
|
||||||
onChange={this._onRecoveryKeyChange}
|
onChange={this.onRecoveryKeyChange}
|
||||||
forceValidity={this.state.recoveryKeyCorrect}
|
forceValidity={this.state.recoveryKeyCorrect}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
|
@ -312,10 +321,10 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
<div>
|
<div>
|
||||||
<input type="file"
|
<input type="file"
|
||||||
className="mx_AccessSecretStorageDialog_recoveryKeyEntry_fileInput"
|
className="mx_AccessSecretStorageDialog_recoveryKeyEntry_fileInput"
|
||||||
ref={this._fileUpload}
|
ref={this.fileUpload}
|
||||||
onChange={this._onRecoveryKeyFileChange}
|
onChange={this.onRecoveryKeyFileChange}
|
||||||
/>
|
/>
|
||||||
<AccessibleButton kind="primary" onClick={this._onRecoveryKeyFileUploadClick}>
|
<AccessibleButton kind="primary" onClick={this.onRecoveryKeyFileUploadClick}>
|
||||||
{_t("Upload")}
|
{_t("Upload")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -323,11 +332,11 @@ export default class AccessSecretStorageDialog extends React.PureComponent {
|
||||||
{recoveryKeyFeedback}
|
{recoveryKeyFeedback}
|
||||||
<DialogButtons
|
<DialogButtons
|
||||||
primaryButton={_t('Continue')}
|
primaryButton={_t('Continue')}
|
||||||
onPrimaryButtonClick={this._onRecoveryKeyNext}
|
onPrimaryButtonClick={this.onRecoveryKeyNext}
|
||||||
hasCancel={true}
|
hasCancel={true}
|
||||||
cancelButton={_t("Go Back")}
|
cancelButton={_t("Go Back")}
|
||||||
cancelButtonClass='danger'
|
cancelButtonClass='danger'
|
||||||
onCancel={this._onCancel}
|
onCancel={this.onCancel}
|
||||||
focus={false}
|
focus={false}
|
||||||
primaryDisabled={!this.state.recoveryKeyValid}
|
primaryDisabled={!this.state.recoveryKeyValid}
|
||||||
/>
|
/>
|
|
@ -19,7 +19,7 @@ import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import * as sdk from '../../../../index';
|
import * as sdk from '../../../../index';
|
||||||
import {MatrixClientPeg} from '../../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../../MatrixClientPeg';
|
||||||
import { MatrixClient } from 'matrix-js-sdk';
|
import { MatrixClient } from 'matrix-js-sdk/src/client';
|
||||||
import { _t } from '../../../../languageHandler';
|
import { _t } from '../../../../languageHandler';
|
||||||
import { accessSecretStorage } from '../../../../SecurityManager';
|
import { accessSecretStorage } from '../../../../SecurityManager';
|
||||||
|
|
||||||
|
|
66
src/components/views/elements/FacePile.tsx
Normal file
66
src/components/views/elements/FacePile.tsx
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React, { HTMLAttributes } from "react";
|
||||||
|
import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||||
|
import { sortBy } from "lodash";
|
||||||
|
|
||||||
|
import MemberAvatar from "../avatars/MemberAvatar";
|
||||||
|
import { _t } from "../../../languageHandler";
|
||||||
|
import DMRoomMap from "../../../utils/DMRoomMap";
|
||||||
|
import TextWithTooltip from "../elements/TextWithTooltip";
|
||||||
|
import { useRoomMembers } from "../../../hooks/useRoomMembers";
|
||||||
|
|
||||||
|
const DEFAULT_NUM_FACES = 5;
|
||||||
|
|
||||||
|
interface IProps extends HTMLAttributes<HTMLSpanElement> {
|
||||||
|
room: Room;
|
||||||
|
onlyKnownUsers?: boolean;
|
||||||
|
numShown?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isKnownMember = (member: RoomMember) => !!DMRoomMap.shared().getDMRoomsForUserId(member.userId)?.length;
|
||||||
|
|
||||||
|
const FacePile = ({ room, onlyKnownUsers = true, numShown = DEFAULT_NUM_FACES, ...props }: IProps) => {
|
||||||
|
let members = useRoomMembers(room);
|
||||||
|
|
||||||
|
// sort users with an explicit avatar first
|
||||||
|
const iteratees = [member => !!member.getMxcAvatarUrl()];
|
||||||
|
if (onlyKnownUsers) {
|
||||||
|
members = members.filter(isKnownMember);
|
||||||
|
} else {
|
||||||
|
// sort known users first
|
||||||
|
iteratees.unshift(member => isKnownMember(member));
|
||||||
|
}
|
||||||
|
if (members.length < 1) return null;
|
||||||
|
|
||||||
|
const shownMembers = sortBy(members, iteratees).slice(0, numShown);
|
||||||
|
return <div {...props} className="mx_FacePile">
|
||||||
|
<div className="mx_FacePile_faces">
|
||||||
|
{ shownMembers.map(member => {
|
||||||
|
return <TextWithTooltip key={member.userId} tooltip={member.name}>
|
||||||
|
<MemberAvatar member={member} width={28} height={28} />
|
||||||
|
</TextWithTooltip>;
|
||||||
|
}) }
|
||||||
|
</div>
|
||||||
|
{ onlyKnownUsers && <span>
|
||||||
|
{ _t("%(count)s people you know have already joined", { count: members.length }) }
|
||||||
|
</span> }
|
||||||
|
</div>
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FacePile;
|
|
@ -17,7 +17,8 @@ import React from 'react';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
import dis from '../../../dispatcher/dispatcher';
|
import dis from '../../../dispatcher/dispatcher';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Room, RoomMember } from 'matrix-js-sdk';
|
import { Room } from 'matrix-js-sdk/src/models/room';
|
||||||
|
import { RoomMember } from 'matrix-js-sdk/src/models/room-member';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
import {MatrixClientPeg} from '../../../MatrixClientPeg';
|
||||||
import FlairStore from "../../../stores/FlairStore";
|
import FlairStore from "../../../stores/FlairStore";
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {_t} from '../../../languageHandler';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import dis from '../../../dispatcher/dispatcher';
|
import dis from '../../../dispatcher/dispatcher';
|
||||||
import {wantsDateSeparator} from '../../../DateUtils';
|
import {wantsDateSeparator} from '../../../DateUtils';
|
||||||
import {MatrixEvent} from 'matrix-js-sdk';
|
import {MatrixEvent} from 'matrix-js-sdk/src/models/event';
|
||||||
import {makeUserPermalink, RoomPermalinkCreator} from "../../../utils/permalinks/Permalinks";
|
import {makeUserPermalink, RoomPermalinkCreator} from "../../../utils/permalinks/Permalinks";
|
||||||
import SettingsStore from "../../../settings/SettingsStore";
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import {LayoutPropType} from "../../../settings/Layout";
|
import {LayoutPropType} from "../../../settings/Layout";
|
||||||
|
|
|
@ -73,7 +73,7 @@ const SSOButton: React.FC<ISSOButtonProps> = ({
|
||||||
brandClass = `mx_SSOButton_brand_${brandName}`;
|
brandClass = `mx_SSOButton_brand_${brandName}`;
|
||||||
icon = <img src={brandIcon} height="24" width="24" alt={brandName} />;
|
icon = <img src={brandIcon} height="24" width="24" alt={brandName} />;
|
||||||
} else if (typeof idp?.icon === "string" && idp.icon.startsWith("mxc://")) {
|
} else if (typeof idp?.icon === "string" && idp.icon.startsWith("mxc://")) {
|
||||||
const src = mediaFromMxc(idp.icon).getSquareThumbnailHttp(24);
|
const src = mediaFromMxc(idp.icon, matrixClient).getSquareThumbnailHttp(24);
|
||||||
icon = <img src={src} height="24" width="24" alt={idp.name} />;
|
icon = <img src={src} height="24" width="24" alt={idp.name} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,14 @@ export default class TextWithTooltip extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
const Tooltip = sdk.getComponent("elements.Tooltip");
|
const Tooltip = sdk.getComponent("elements.Tooltip");
|
||||||
|
|
||||||
|
const {class: className, children, tooltip, tooltipClass, ...props} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave} className={this.props.class}>
|
<span {...props} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave} className={className}>
|
||||||
{this.props.children}
|
{children}
|
||||||
{this.state.hover && <Tooltip
|
{this.state.hover && <Tooltip
|
||||||
label={this.props.tooltip}
|
label={tooltip}
|
||||||
tooltipClassName={this.props.tooltipClass}
|
tooltipClassName={tooltipClass}
|
||||||
className={"mx_TextWithTooltip_tooltip"} /> }
|
className={"mx_TextWithTooltip_tooltip"} /> }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import PropTypes from 'prop-types';
|
||||||
import * as HtmlUtils from '../../../HtmlUtils';
|
import * as HtmlUtils from '../../../HtmlUtils';
|
||||||
import { editBodyDiffToHtml } from '../../../utils/MessageDiffUtils';
|
import { editBodyDiffToHtml } from '../../../utils/MessageDiffUtils';
|
||||||
import {formatTime} from '../../../DateUtils';
|
import {formatTime} from '../../../DateUtils';
|
||||||
import {MatrixEvent} from 'matrix-js-sdk';
|
import {MatrixEvent} from 'matrix-js-sdk/src/models/event';
|
||||||
import {pillifyLinks, unmountPills} from '../../../utils/pillify';
|
import {pillifyLinks, unmountPills} from '../../../utils/pillify';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
|
|
|
@ -18,7 +18,7 @@ limitations under the License.
|
||||||
|
|
||||||
import React, {useEffect} from 'react';
|
import React, {useEffect} from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { EventStatus } from 'matrix-js-sdk';
|
import { EventStatus } from 'matrix-js-sdk/src/models/event';
|
||||||
|
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import * as sdk from '../../../index';
|
import * as sdk from '../../../index';
|
||||||
|
|
|
@ -71,6 +71,10 @@ export default class MessageEvent extends React.Component {
|
||||||
'm.file': sdk.getComponent('messages.MFileBody'),
|
'm.file': sdk.getComponent('messages.MFileBody'),
|
||||||
'm.audio': sdk.getComponent('messages.MAudioBody'),
|
'm.audio': sdk.getComponent('messages.MAudioBody'),
|
||||||
'm.video': sdk.getComponent('messages.MVideoBody'),
|
'm.video': sdk.getComponent('messages.MVideoBody'),
|
||||||
|
|
||||||
|
// TODO: @@ TravisR: Use labs flag determination.
|
||||||
|
// MSC: https://github.com/matrix-org/matrix-doc/pull/2516
|
||||||
|
'org.matrix.msc2516.voice': sdk.getComponent('messages.MAudioBody'),
|
||||||
};
|
};
|
||||||
const evTypes = {
|
const evTypes = {
|
||||||
'm.sticker': sdk.getComponent('messages.MStickerBody'),
|
'm.sticker': sdk.getComponent('messages.MStickerBody'),
|
||||||
|
|
|
@ -216,12 +216,12 @@ export default class TextualBody extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_addLineNumbers(pre) {
|
_addLineNumbers(pre) {
|
||||||
|
// Calculate number of lines in pre
|
||||||
|
const number = pre.innerHTML.replace(/\n(<\/code>)?$/, "").split(/\n/).length;
|
||||||
pre.innerHTML = '<span class="mx_EventTile_lineNumbers"></span>' + pre.innerHTML + '<span></span>';
|
pre.innerHTML = '<span class="mx_EventTile_lineNumbers"></span>' + pre.innerHTML + '<span></span>';
|
||||||
const lineNumbers = pre.getElementsByClassName("mx_EventTile_lineNumbers")[0];
|
const lineNumbers = pre.getElementsByClassName("mx_EventTile_lineNumbers")[0];
|
||||||
// Calculate number of lines in pre
|
|
||||||
const number = pre.innerHTML.split(/\n/).length;
|
|
||||||
// Iterate through lines starting with 1 (number of the first line is 1)
|
// Iterate through lines starting with 1 (number of the first line is 1)
|
||||||
for (let i = 1; i < number; i++) {
|
for (let i = 1; i <= number; i++) {
|
||||||
lineNumbers.innerHTML += '<span class="mx_EventTile_lineNumber">' + i + '</span>';
|
lineNumbers.innerHTML += '<span class="mx_EventTile_lineNumber">' + i + '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ const EncryptionInfo: React.FC<IProps> = ({
|
||||||
let text: string;
|
let text: string;
|
||||||
if (waitingForOtherParty) {
|
if (waitingForOtherParty) {
|
||||||
if (isSelfVerification) {
|
if (isSelfVerification) {
|
||||||
text = _t("Waiting for you to accept on your other session…");
|
text = _t("Accept on your other login…");
|
||||||
} else {
|
} else {
|
||||||
text = _t("Waiting for %(displayName)s to accept…", {
|
text = _t("Waiting for %(displayName)s to accept…", {
|
||||||
displayName: member.displayName || member.name || member.userId,
|
displayName: member.displayName || member.name || member.userId,
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue