Fix alignment of avatars and status messages

also introduce the status message to the MemberInfo pane

Part of https://github.com/vector-im/riot-web/issues/1528
This commit is contained in:
Travis Ralston 2018-12-12 12:57:48 -07:00
parent ce7969e3d5
commit cd9ea2b2d7
6 changed files with 32 additions and 9 deletions

View file

@ -111,4 +111,12 @@ limitations under the License.
opacity: 0.25; opacity: 0.25;
} }
.mx_EntityTile_subtext {
font-size: 11px;
opacity: 0.5;
overflow: hidden;
white-space: nowrap;
text-overflow: clip;
}

View file

@ -110,3 +110,10 @@ limitations under the License.
margin-left: 8px; margin-left: 8px;
} }
.mx_MemberInfo_statusMessage {
font-size: 11px;
opacity: 0.5;
overflow: hidden;
white-space: nowrap;
text-overflow: clip;
}

View file

@ -41,7 +41,7 @@ limitations under the License.
.mx_RoomTile_subtext { .mx_RoomTile_subtext {
display: inline-block; display: inline-block;
font-size: 0.8em; font-size: 11px;
padding: 0 0 0 7px; padding: 0 0 0 7px;
margin: 0; margin: 0;
overflow: hidden; overflow: hidden;
@ -62,10 +62,14 @@ limitations under the License.
padding-left: 16px; padding-left: 16px;
padding-right: 6px; padding-right: 6px;
width: 24px; width: 24px;
height: 24px;
vertical-align: middle; vertical-align: middle;
} }
.mx_RoomTile_hasSubtext .mx_RoomTile_avatar {
padding-top: 0;
vertical-align: super;
}
.mx_RoomTile_dm { .mx_RoomTile_dm {
display: block; display: block;
position: absolute; position: absolute;
@ -89,10 +93,6 @@ limitations under the License.
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.mx_RoomTile_hasSubtext .mx_RoomTile_avatar {
padding-top: 0;
}
.mx_RoomTile_invite { .mx_RoomTile_invite {
/* color: rgba(69, 69, 69, 0.5); */ /* color: rgba(69, 69, 69, 0.5); */
} }

View file

@ -131,7 +131,7 @@ const EntityTile = React.createClass({
nameClasses += ' mx_EntityTile_name_hover'; nameClasses += ' mx_EntityTile_name_hover';
} }
if (this.props.subtextLabel) { if (this.props.subtextLabel) {
presenceLabel = <span className="mx_PresenceLabel">{this.props.subtextLabel}</span>; presenceLabel = <span className="mx_EntityTile_subtext">{this.props.subtextLabel}</span>;
} }
nameEl = ( nameEl = (
<div className="mx_EntityTile_details"> <div className="mx_EntityTile_details">
@ -148,7 +148,7 @@ const EntityTile = React.createClass({
<EmojiText element="div" className="mx_EntityTile_name" dir="auto"> <EmojiText element="div" className="mx_EntityTile_name" dir="auto">
{name} {name}
</EmojiText> </EmojiText>
<span className="mx_PresenceLabel">{this.props.subtextLabel}</span> <span className="mx_EntityTile_subtext">{this.props.subtextLabel}</span>
</div> </div>
); );
} else { } else {

View file

@ -889,11 +889,13 @@ module.exports = withMatrixClient(React.createClass({
let presenceState; let presenceState;
let presenceLastActiveAgo; let presenceLastActiveAgo;
let presenceCurrentlyActive; let presenceCurrentlyActive;
let statusMessage;
if (this.props.member.user) { if (this.props.member.user) {
presenceState = this.props.member.user.presence; presenceState = this.props.member.user.presence;
presenceLastActiveAgo = this.props.member.user.lastActiveAgo; presenceLastActiveAgo = this.props.member.user.lastActiveAgo;
presenceCurrentlyActive = this.props.member.user.currentlyActive; presenceCurrentlyActive = this.props.member.user.currentlyActive;
statusMessage = this.props.member.user.statusMessage;
} }
const room = this.props.matrixClient.getRoom(this.props.member.roomId); const room = this.props.matrixClient.getRoom(this.props.member.roomId);
@ -915,6 +917,11 @@ module.exports = withMatrixClient(React.createClass({
presenceState={presenceState} />; presenceState={presenceState} />;
} }
let statusLabel = null;
if (statusMessage) {
statusLabel = <span className="mx_MemberInfo_statusMessage">{ statusMessage }</span>;
}
let roomMemberDetails = null; let roomMemberDetails = null;
if (this.props.member.roomId) { // is in room if (this.props.member.roomId) { // is in room
const PowerSelector = sdk.getComponent('elements.PowerSelector'); const PowerSelector = sdk.getComponent('elements.PowerSelector');
@ -931,6 +938,7 @@ module.exports = withMatrixClient(React.createClass({
</div> </div>
<div className="mx_MemberInfo_profileField"> <div className="mx_MemberInfo_profileField">
{presenceLabel} {presenceLabel}
{statusLabel}
</div> </div>
</div>; </div>;
} }

View file

@ -272,7 +272,7 @@ module.exports = React.createClass({
'mx_RoomTile_menuDisplayed': this.state.menuDisplayed, 'mx_RoomTile_menuDisplayed': this.state.menuDisplayed,
'mx_RoomTile_noBadges': !badges, 'mx_RoomTile_noBadges': !badges,
'mx_RoomTile_transparent': this.props.transparent, 'mx_RoomTile_transparent': this.props.transparent,
'mx_RoomTile_hasSubtext': !!subtext && !this.props.isCollapsed, 'mx_RoomTile_hasSubtext': subtext && !this.props.collapsed,
}); });
const avatarClasses = classNames({ const avatarClasses = classNames({