Skip to content

Commit 69fdd48

Browse files
committed
general faff to make the new edit button position interact properly with dave's 'click to show all read receipts'
1 parent bf3e90b commit 69fdd48

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/skins/vector/views/molecules/EventTile.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,11 @@ module.exports = React.createClass({
145145
var style = {
146146
left: left+'px',
147147
top: '0px',
148-
visibility: i < MAX_READ_AVATARS || this.state.allReadAvatars ? 'visible' : 'hidden'
148+
visibility: ((i < MAX_READ_AVATARS) || this.state.allReadAvatars) ? 'visible' : 'hidden'
149149
};
150150

151+
//console.log("i = " + i + ", MAX_READ_AVATARS = " + MAX_READ_AVATARS + ", allReadAvatars = " + this.state.allReadAvatars + " visibility = " + style.visibility);
152+
151153
// add to the start so the most recent is on the end (ie. ends up rightmost)
152154
avatars.unshift(
153155
<MemberAvatar key={member.userId} member={member}
@@ -161,28 +163,29 @@ module.exports = React.createClass({
161163
);
162164
// TODO: we keep the extra read avatars in the dom to make animation simpler
163165
// we could optimise this to reduce the dom size.
164-
if (i < MAX_READ_AVATARS - 1 || this.state.allReadAvatars) {
166+
if (i < MAX_READ_AVATARS - 1 || this.state.allReadAvatars) { // XXX: where does this -1 come from? is it to make the max'th avatar animate properly?
165167
left -= 15;
166168
}
167169
}
170+
var editButton;
168171
if (!this.state.allReadAvatars) {
169172
var remainder = receipts.length - MAX_READ_AVATARS;
170173
var remText;
171-
left -= 15;
174+
if (i >= MAX_READ_AVATARS - 1) left -= 15;
172175
if (remainder > 0) {
173176
remText = <span className="mx_EventTile_readAvatarRemainder"
174177
onClick={this.toggleAllReadAvatars}
175178
style={{ left: left }}>{ remainder }+
176179
</span>;
180+
left -= 15;
177181
}
182+
editButton = (
183+
<input style={{ left: left }}
184+
type="image" src="img/edit.png" alt="Edit" width="14" height="14"
185+
className="mx_EventTile_editButton" onClick={this.onEditClicked} />
186+
);
178187
}
179188

180-
var editButton = (
181-
<input style={{ left: left+15 }}
182-
type="image" src="img/edit.png" alt="Edit" width="14" height="14"
183-
className="mx_EventTile_editButton" onClick={this.onEditClicked} />
184-
);
185-
186189
return <span className="mx_EventTile_readAvatars" ref={this.collectReadAvatarNode}>
187190
{ editButton }
188191
{ remText }

0 commit comments

Comments
 (0)