Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9299e80

Browse files
authored
Merge branch 'develop' into alunturner/add-bullet-list
2 parents 4fb8b70 + c94a4ab commit 9299e80

File tree

10 files changed

+332
-158
lines changed

10 files changed

+332
-158
lines changed

res/css/views/dialogs/_CompoundDialog.pcss

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ limitations under the License.
2727
}
2828

2929
.mx_CompoundDialog {
30+
.mx_Dialog {
31+
display: flex;
32+
flex-direction: column;
33+
}
34+
3035
.mx_CompoundDialog_header {
3136
padding: 32px 32px 16px 32px;
3237

@@ -49,6 +54,13 @@ limitations under the License.
4954
}
5055
}
5156

57+
.mx_CompoundDialog_form {
58+
display: flex;
59+
flex-direction: column;
60+
min-height: 0;
61+
max-height: 100%;
62+
}
63+
5264
.mx_CompoundDialog_content {
5365
overflow: auto;
5466
padding: 8px 32px;
@@ -57,10 +69,6 @@ limitations under the License.
5769
.mx_CompoundDialog_footer {
5870
padding: 20px 32px;
5971
text-align: right;
60-
position: absolute;
61-
bottom: 0;
62-
left: 0;
63-
right: 0;
6472

6573
.mx_AccessibleButton {
6674
margin-left: 24px;
@@ -69,14 +77,17 @@ limitations under the License.
6977
}
7078

7179
.mx_ScrollableBaseDialog {
80+
display: flex;
81+
flex-direction: column;
82+
7283
width: 544px; /* fixed */
7384
height: 516px; /* fixed */
74-
75-
.mx_CompoundDialog_content {
76-
height: 349px; /* dialogHeight - header - footer */
77-
}
85+
max-width: 100%;
86+
min-height: 0;
87+
max-height: 80%;
7888

7989
.mx_CompoundDialog_footer {
8090
box-shadow: 0px -4px 4px rgba(0, 0, 0, 0.05); /* hardcoded colour for both themes */
91+
z-index: 1; /* needed to make footer & shadow appear above dialog content */
8192
}
8293
}

res/img/element-icons/room/composer/plain_text.svg

Lines changed: 10 additions & 27 deletions
Loading
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2022 The Matrix.org Foundation C.I.C.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
import React from "react";
18+
19+
import { _t } from "../../../languageHandler";
20+
import Modal from "../../../Modal";
21+
import InfoDialog from "./InfoDialog";
22+
23+
export const createCantStartVoiceMessageBroadcastDialog = (): void => {
24+
Modal.createDialog(InfoDialog, {
25+
title: _t("Can't start voice message"),
26+
description: (
27+
<p>
28+
{_t(
29+
"You can't start a voice message as you are currently recording a live broadcast. " +
30+
"Please end your live broadcast in order to start recording a voice message.",
31+
)}
32+
</p>
33+
),
34+
hasCloseButton: true,
35+
});
36+
};

src/components/views/dialogs/ScrollableBaseModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default abstract class ScrollableBaseModal<
9696
aria-label={_t("Close dialog")}
9797
/>
9898
</div>
99-
<form onSubmit={this.onSubmit}>
99+
<form onSubmit={this.onSubmit} className="mx_CompoundDialog_form">
100100
<div className="mx_CompoundDialog_content">{this.renderContent()}</div>
101101
<div className="mx_CompoundDialog_footer">
102102
<AccessibleButton onClick={this.onCancel} kind="primary_outline">

src/components/views/rooms/MessageComposer.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ import { SendWysiwygComposer, sendMessage, getConversionFunctions } from "./wysi
5858
import { MatrixClientProps, withMatrixClientHOC } from "../../../contexts/MatrixClientContext";
5959
import { setUpVoiceBroadcastPreRecording } from "../../../voice-broadcast/utils/setUpVoiceBroadcastPreRecording";
6060
import { SdkContextClass } from "../../../contexts/SDKContext";
61+
import { VoiceBroadcastInfoState } from "../../../voice-broadcast";
62+
import { createCantStartVoiceMessageBroadcastDialog } from "../dialogs/CantStartVoiceMessageBroadcastDialog";
6163

6264
let instanceCount = 0;
6365

@@ -445,6 +447,20 @@ export class MessageComposer extends React.Component<IProps, IState> {
445447
}
446448
}
447449

450+
private onRecordStartEndClick = (): void => {
451+
const currentBroadcastRecording = SdkContextClass.instance.voiceBroadcastRecordingsStore.getCurrent();
452+
453+
if (currentBroadcastRecording && currentBroadcastRecording.getState() !== VoiceBroadcastInfoState.Stopped) {
454+
createCantStartVoiceMessageBroadcastDialog();
455+
} else {
456+
this.voiceRecordingButton.current?.onRecordStartEndClick();
457+
}
458+
459+
if (this.context.narrow) {
460+
this.toggleButtonMenu();
461+
}
462+
};
463+
448464
public render() {
449465
const hasE2EIcon = Boolean(!this.state.isWysiwygLabEnabled && this.props.e2eStatus);
450466
const e2eIcon = hasE2EIcon && (
@@ -588,12 +604,7 @@ export class MessageComposer extends React.Component<IProps, IState> {
588604
isStickerPickerOpen={this.state.isStickerPickerOpen}
589605
menuPosition={menuPosition}
590606
relation={this.props.relation}
591-
onRecordStartEndClick={() => {
592-
this.voiceRecordingButton.current?.onRecordStartEndClick();
593-
if (this.context.narrow) {
594-
this.toggleButtonMenu();
595-
}
596-
}}
607+
onRecordStartEndClick={this.onRecordStartEndClick}
597608
setStickerPickerOpen={this.setStickerPickerOpen}
598609
showLocationButton={!window.electron}
599610
showPollsButton={this.state.showPollsButton}

src/components/views/rooms/MessageComposerButtons.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ function ComposerModeButton({ isRichTextEnabled, onClick }: WysiwygToggleButtonP
376376
<CollapsibleButton
377377
className="mx_MessageComposer_button"
378378
iconClassName={classNames({
379-
mx_MessageComposer_plain_text: isRichTextEnabled,
380-
mx_MessageComposer_rich_text: !isRichTextEnabled,
379+
mx_MessageComposer_plain_text: !isRichTextEnabled,
380+
mx_MessageComposer_rich_text: isRichTextEnabled,
381381
})}
382382
onClick={onClick}
383383
title={title}

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,6 +2690,8 @@
26902690
"Uncheck if you also want to remove system messages on this user (e.g. membership change, profile change…)": "Uncheck if you also want to remove system messages on this user (e.g. membership change, profile change…)",
26912691
"Remove %(count)s messages|other": "Remove %(count)s messages",
26922692
"Remove %(count)s messages|one": "Remove 1 message",
2693+
"Can't start voice message": "Can't start voice message",
2694+
"You can't start a voice message as you are currently recording a live broadcast. Please end your live broadcast in order to start recording a voice message.": "You can't start a voice message as you are currently recording a live broadcast. Please end your live broadcast in order to start recording a voice message.",
26932695
"Unable to load commit detail: %(msg)s": "Unable to load commit detail: %(msg)s",
26942696
"Unavailable": "Unavailable",
26952697
"Changelog": "Changelog",

0 commit comments

Comments
 (0)