Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to member-panel from avatar #447

Merged
merged 2 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/domain/session/room/timeline/tiles/BaseMessageTile.js
Expand Up @@ -41,6 +41,10 @@ export class BaseMessageTile extends SimpleTile {
return this._entry.sender;
}

get memberPanelLink() {
return `${this.urlCreator.urlUntilSegment("room")}/member/${this.sender}`;
}

// Avatar view model contract
get avatarColorNumber() {
return getIdentifierColorNumber(this._entry.sender);
Expand Down
1 change: 1 addition & 0 deletions src/platform/web/ui/css/themes/element/timeline.css
Expand Up @@ -64,6 +64,7 @@ limitations under the License.

.Timeline_messageAvatar {
grid-area: avatar;
text-decoration: none;
}

.Timeline_messageSender {
Expand Down
3 changes: 2 additions & 1 deletion src/platform/web/ui/session/room/timeline/BaseMessageView.js
Expand Up @@ -42,6 +42,7 @@ export class BaseMessageView extends TemplateView {
// should be after body as it is overlayed on top
t.button({className: "Timeline_messageOptions"}, "⋯"),
]);
const avatar = t.a({href: vm.memberPanelLink, className: "Timeline_messageAvatar"}, [renderStaticAvatar(vm, 30)]);
// given that there can be many tiles, we don't add
// unneeded DOM nodes in case of a continuation, and we add it
// with a side-effect binding to not have to create sub views,
Expand All @@ -52,7 +53,7 @@ export class BaseMessageView extends TemplateView {
li.removeChild(li.querySelector(".Timeline_messageAvatar"));
li.removeChild(li.querySelector(".Timeline_messageSender"));
} else if (!isContinuation) {
li.insertBefore(renderStaticAvatar(vm, 30, "Timeline_messageAvatar"), li.firstChild);
li.insertBefore(avatar, li.firstChild);
li.insertBefore(tag.div({className: `Timeline_messageSender usercolor${vm.avatarColorNumber}`}, vm.displayName), li.firstChild);
}
});
Expand Down