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

Better positioning for unbubbled events in timeline #6477

Merged
merged 4 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 3 additions & 1 deletion res/css/views/messages/_ViewSourceEvent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ limitations under the License.
margin-bottom: 7px;
mask-image: url('$(res)/img/feather-customised/minimise.svg');
}
}

&:hover .mx_ViewSourceEvent_toggle {
.mx_EventTile:hover {
.mx_ViewSourceEvent_toggle {
visibility: visible;
}
}
12 changes: 11 additions & 1 deletion res/css/views/rooms/_EventBubbleTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,24 @@ limitations under the License.

display: flex;
align-items: center;
justify-content: center;
justify-content: start;
padding: 5px 0;

.mx_EventTile_avatar {
position: static;
order: -1;
margin-right: 5px;
}

.mx_EventTile_e2eIcon {
margin-left: 9px;
}

.mx_EventTile_line > a {
right: auto;
top: -15px;
left: -68px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this specific positioning here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Event that aren't within a bubble do not have the same height nor padding as other event.
Due to the specificity of the CSS elsewhere it forces me to override it here

}
}

& ~ .mx_EventListSummary {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ limitations under the License.
*/

import React from 'react';
import PropTypes from 'prop-types';
import { MatrixEvent } from 'matrix-js-sdk/src';
import classNames from 'classnames';
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { MatrixClientPeg } from "../../../MatrixClientPeg";

@replaceableComponent("views.messages.ViewSourceEvent")
export default class ViewSourceEvent extends React.PureComponent {
static propTypes = {
/* the MatrixEvent to show */
mxEvent: PropTypes.object.isRequired,
};
interface IProps {
mxEvent: MatrixEvent;
}

interface IState {
expanded: boolean;
}

@replaceableComponent("views.messages.ViewSourceEvent")
export default class ViewSourceEvent extends React.PureComponent<IProps, IState> {
constructor(props) {
super(props);

Expand All @@ -35,7 +38,7 @@ export default class ViewSourceEvent extends React.PureComponent {
};
}

componentDidMount() {
public componentDidMount(): void {
const { mxEvent } = this.props;

const client = MatrixClientPeg.get();
Expand All @@ -46,15 +49,15 @@ export default class ViewSourceEvent extends React.PureComponent {
}
}

onToggle = (ev) => {
private onToggle = (ev: React.MouseEvent) => {
ev.preventDefault();
const { expanded } = this.state;
this.setState({
expanded: !expanded,
});
}
};

render() {
public render(): React.ReactNode {
const { mxEvent } = this.props;
const { expanded } = this.state;

Expand Down