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

add spaces to TileErrorBoundary #9012

Merged
merged 8 commits into from
Jul 11, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/views/messages/TileErrorBoundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export default class TileErrorBoundary extends React.Component<IProps, IState> {
}

let viewSourceButton;
let spaceViewSourceButton;
if (mxEvent && SettingsStore.getValue("developerMode")) {
spaceViewSourceButton = "&nbsp;";
viewSourceButton = <AccessibleButton onClick={this.onViewSource} kind="link">
{ _t("View Source") }
</AccessibleButton>;
Expand All @@ -92,8 +94,9 @@ export default class TileErrorBoundary extends React.Component<IProps, IState> {
<div className="mx_EventTile_line">
<span>
{ _t("Can't load this message") }
{ mxEvent && ` (${mxEvent.getType()})` }
{ mxEvent && ` (${mxEvent.getType()})&nbsp;` }
{ submitLogsButton }
{ spaceViewSourceButton }
{ viewSourceButton }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ _t("Can't load this message") }
{ mxEvent && ` (${mxEvent.getType()})` }
{ mxEvent && ` (${mxEvent.getType()})&nbsp;` }
{ submitLogsButton }
{ spaceViewSourceButton }
{ viewSourceButton }
{ _t("Can't load this message") } &nbsp;
{ mxEvent && `(${mxEvent.getType()})` } &nbsp;
{ submitLogsButton } &nbsp;
{ viewSourceButton }

I think this would probably be the clearest

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ submitLogsButton } &nbsp;

wouldn't this insert the space even if there is no viewSourceButton to follow up?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, true - could we move &nbsp; into to the if statement?

            if (mxEvent && SettingsStore.getValue("developerMode")) {
                viewSourceButton = <>
					&nbsp;
					<AccessibleButton onClick={this.onViewSource} kind="link">
                    	{ _t("View Source") }
              		</AccessibleButton>
				</>;
            }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I tried in my last change, without awareness of that empty tags syntax you're proposing. Will update and see what the CI says.

</span>
</div>
Expand Down