Apply suggestions from review

This commit is contained in:
Jaiwanth 2021-07-26 23:40:27 +05:30
parent 41bc2b6481
commit b91309be82
13 changed files with 169 additions and 61 deletions

View file

@ -18,7 +18,6 @@ limitations under the License.
import React from 'react';
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
import { ResizeMethod } from 'matrix-js-sdk/src/@types/partials';
import { omit } from "lodash";
import dis from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
@ -91,11 +90,10 @@ export default class MemberAvatar extends React.Component<IProps, IState> {
}
render() {
let { member, fallbackUserId, onClick, viewUserOnClick, ...otherProps } = this.props;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let { member, fallbackUserId, onClick, viewUserOnClick, forExport, ...otherProps } = this.props;
const userId = member ? member.userId : fallbackUserId;
otherProps = omit(otherProps, "forExport");
if (viewUserOnClick) {
onClick = () => {
dis.dispatch({

View file

@ -1,3 +1,19 @@
/*
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, { useRef, useState } from "react";
import { Room } from "matrix-js-sdk/src";
import { _t } from "../../../languageHandler";
@ -19,6 +35,7 @@ import JSONExporter from "../../../utils/exportUtils/JSONExport";
import PlainTextExporter from "../../../utils/exportUtils/PlainTextExport";
import { useStateCallback } from "../../../hooks/useStateCallback";
import Exporter from "../../../utils/exportUtils/Exporter";
import Spinner from "../elements/Spinner";
interface IProps extends IDialogProps {
room: Room;
@ -352,16 +369,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
</div>
{ isExporting ? (
<div className="mx_ExportDialog_progress">
<svg className="mx_ExportDialog_spinner" viewBox="0 0 50 50">
<circle
className="mx_ExportDialog_spinner_path"
cx="25"
cy="25"
r="20"
fill="none"
stroke-width="5"
/>
</svg>
<Spinner w={24} h={24} />
<p ref={exportProgressRef}>
{ _t("Processing...") }
</p>

View file

@ -76,8 +76,8 @@ const EventListSummary: React.FC<IProps> = ({
{ children }
</React.Fragment>;
} else {
const avatars = summaryMembers.map((m, idx) =>
<MemberAvatar key={m.userId} member={m} width={14} height={14} />);
const avatars = summaryMembers.map((m) => <MemberAvatar key={m.userId} member={m} width={14} height={14} />);
body = (
<div className="mx_EventTile_line">
<div className="mx_EventTile_info">

View file

@ -354,8 +354,14 @@ export default class ReplyThread extends React.Component<IProps, IState> {
</blockquote>;
} else if (this.props.forExport) {
const eventId = ReplyThread.getParentEventId(this.props.parentEv);
header = <p style={{ marginTop: -5, marginBottom: 5 }}>
In reply to <a className="mx_reply_anchor" href={`#${eventId}`} scroll-to={eventId}>this message</a>
header = <p className="mx_ReplyThread_Export">
{ _t("In reply to <messageLink/>",
{},
{ messageLink: () => (
<a className="mx_reply_anchor" href={`#${eventId}`} scroll-to={eventId}> { _t("this message") } </a>
),
})
}
</p>;
} else if (this.state.loading) {
header = <Spinner w={16} h={16} />;

View file

@ -39,7 +39,7 @@ const RedactedBody = React.forwardRef<any, IBodyProps>(({ mxEvent, forExport },
return (
<span className="mx_RedactedBody" ref={ref} title={titleText}>
{ forExport ? <img alt="Redacted" className="mx_export_trash_icon" src="icons/trash.svg" /> : null }
{ forExport ? <img alt={_t("Redacted")} className="mx_export_trash_icon" src="icons/trash.svg" /> : null }
{ text }
</span>
);