Make ForwardDialog more readable

Signed-off-by: Robin Townsend <robin@robin.town>
This commit is contained in:
Robin Townsend 2021-05-10 00:38:01 -04:00
parent 219c983d19
commit c96888c9cb

View file

@ -39,6 +39,7 @@ const AVATAR_SIZE = 30;
interface IProps extends IDialogProps { interface IProps extends IDialogProps {
cli: MatrixClient; cli: MatrixClient;
// The event to forward
event: MatrixEvent; event: MatrixEvent;
} }
@ -116,7 +117,7 @@ const ForwardDialog: React.FC<IProps> = ({ cli, event, onFinished }) => {
}); });
mockEvent.sender = { mockEvent.sender = {
name: profileInfo.displayname || userId, name: profileInfo.displayname || userId,
userId: userId, userId,
getAvatarUrl: (..._) => { getAvatarUrl: (..._) => {
return avatarUrlForUser( return avatarUrlForUser(
{ avatarUrl: profileInfo.avatar_url }, { avatarUrl: profileInfo.avatar_url },
@ -179,28 +180,28 @@ const ForwardDialog: React.FC<IProps> = ({ cli, event, onFinished }) => {
{ rooms.length > 0 ? ( { rooms.length > 0 ? (
<div className="mx_ForwardList_section"> <div className="mx_ForwardList_section">
<h3>{ _t("Rooms") }</h3> <h3>{ _t("Rooms") }</h3>
{ rooms.map(room => { { rooms.map(room =>
return <Entry <Entry
key={room.roomId} key={room.roomId}
room={room} room={room}
send={() => cli.sendEvent(room.roomId, event.getType(), event.getContent())} send={() => cli.sendEvent(room.roomId, event.getType(), event.getContent())}
/>; />,
}) } ) }
</div> </div>
) : undefined } ) : undefined }
{ dms.length > 0 ? ( { dms.length > 0 ? (
<div className="mx_ForwardList_section"> <div className="mx_ForwardList_section">
<h3>{ _t("Direct Messages") }</h3> <h3>{ _t("Direct Messages") }</h3>
{ dms.map(room => { { dms.map(room =>
return <Entry <Entry
key={room.roomId} key={room.roomId}
room={room} room={room}
send={() => cli.sendEvent(room.roomId, event.getType(), event.getContent())} send={() => cli.sendEvent(room.roomId, event.getType(), event.getContent())}
/>; />,
}) } ) }
</div> </div>
) : null } ) : undefined }
{ rooms.length + dms.length < 1 ? <span className="mx_ForwardList_noResults"> { rooms.length + dms.length < 1 ? <span className="mx_ForwardList_noResults">
{ _t("No results") } { _t("No results") }