one bug left 🪲

This commit is contained in:
C0ffeeCode 2022-01-05 13:43:12 +01:00
parent 62b7074860
commit 2f94a5c546
6 changed files with 11 additions and 14 deletions

View file

@ -8,7 +8,7 @@
"node": ">=14.6.0"
},
"scripts": {
"start": "webpack serve --config ./webpack.dev.js",
"start": "webpack serve --config ./webpack.dev.js --open",
"build": "webpack --config ./webpack.prod.js"
},
"keywords": [],

View file

@ -80,9 +80,9 @@ function AttachmentFrame({
}
AttachmentFrame.propTypes = {
attachmentOrUi: PropTypes.node.isRequired,
attachmentOrUi: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
fileSetter: PropTypes.func.isRequired,
uploadProgressRef: PropTypes.node.isRequired,
uploadProgressRef: PropTypes.shape().isRequired,
cancelNeedle: PropTypes.func.isRequired,
};

View file

@ -45,6 +45,8 @@ function pauseRec() {
}
}
function startOrResumeRec() {
if (!_mediaRecorder) return;
if (_mediaRecorder.state === 'paused') {
_mediaRecorder.resume();
console.log('resume');
@ -58,9 +60,8 @@ function restartRec() {
if (_mediaRecorder.state !== 'inactive') _mediaRecorder.stop();
_mediaRecorder = null;
init();
startOrResumeRec();
init()
.then(startOrResumeRec());
}
// TODO: Handle turning off the recorder to remove the browser indicator
@ -106,7 +107,7 @@ function VoiceMailRecorder({ fnCancel, fnRequestResult, fnHowToSubmit }) {
<div className="room-attachment__preview">
<RawIcon src={VolumeFullIC} />
</div>
<div className="room-attachment__info">
<div className="room-attachment__info room-attachment-ui-recorder">
<div>
<Text variant="b1">
{state}
@ -117,7 +118,7 @@ function VoiceMailRecorder({ fnCancel, fnRequestResult, fnHowToSubmit }) {
? (<IconButton onClick={pauseRec} src={PauseIC}>Pause</IconButton>)
: (<IconButton onClick={startOrResumeRec} src={PlayIC}>Start</IconButton>)}
<IconButton onClick={restartRec} src={ArrowIC} tooltip="Start over">Reset</IconButton>
<IconButton onClick={() => stopAndSubmit()} src={ChevronBottomIC} type="Add as attachment">Submit</IconButton>
<IconButton onClick={() => stopAndSubmit()} src={ChevronBottomIC} tooltip="Add as attachment" type="submit">Submit</IconButton>
</div>
</div>
);

View file

@ -1,6 +1,5 @@
@use '../../../partials/flex';
.room-attachment__info {
.room-attachment-ui-recorder {
display: flex;
div {

View file

@ -328,7 +328,6 @@ function RoomViewInput({
<>
<div className={`room-input__option-container${attachmentOrUi === null ? '' : ' room-attachment__option'}`}>
<AttachmentTypeSelector
ref={uploadInputRef}
actOnAttaching={handleAttachmentTypeSelectorReturn}
alreadyHasAttachment={attachmentOrUi !== null}
/>

View file

@ -216,7 +216,6 @@ class RoomsInput extends EventEmitter {
}
setAttachment(roomId, file) {
console.log(file);
const input = this.getInput(roomId);
input.attachment = {
file,
@ -288,7 +287,6 @@ class RoomsInput extends EventEmitter {
async sendFile(roomId, file) {
const fileType = file.type.slice(0, file.type.indexOf('/'));
console.log(file.type);
const info = {
mimetype: file.type,
size: file.size,
@ -408,7 +406,7 @@ class RoomsInput extends EventEmitter {
// Apply formatting if relevant
const formattedBody = formatAndEmojifyText(
this.matrixClient.getRoom(roomId),
editedBody
editedBody,
);
if (formattedBody !== editedBody) {
content.formatted_body = ` * ${formattedBody}`;