Merge pull request #2860 from matrix-org/travis/breadcrumbs/parted
Apply 50% opacity to left breadcrumbs
This commit is contained in:
commit
c3d3dd1fd7
2 changed files with 27 additions and 7 deletions
|
@ -47,6 +47,9 @@ limitations under the License.
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_RoomBreadcrumbs_left {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
// Note: we have to manually control the gradient and stuff, but the IndicatorScrollbar
|
// Note: we have to manually control the gradient and stuff, but the IndicatorScrollbar
|
||||||
// will deal with left/right positioning for us. Normally we'd use position:sticky on
|
// will deal with left/right positioning for us. Normally we'd use position:sticky on
|
||||||
|
|
|
@ -52,10 +52,15 @@ export default class RoomBreadcrumbs extends React.Component {
|
||||||
console.error("Failed to parse breadcrumbs:", e);
|
console.error("Failed to parse breadcrumbs:", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MatrixClientPeg.get().on("Room.myMembership", this.onMyMembership);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
dis.unregister(this._dispatcherRef);
|
dis.unregister(this._dispatcherRef);
|
||||||
|
|
||||||
|
const client = MatrixClientPeg.get();
|
||||||
|
if (client) client.removeListener("Room.myMembership", this.onMyMembership);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
@ -81,6 +86,17 @@ export default class RoomBreadcrumbs extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMyMembership = (room, membership) => {
|
||||||
|
if (membership === "leave" || membership === "ban") {
|
||||||
|
const rooms = this.state.rooms.slice();
|
||||||
|
const roomState = rooms.find((r) => r.room.roomId === room.roomId);
|
||||||
|
if (roomState) {
|
||||||
|
roomState.left = true;
|
||||||
|
this.setState({rooms});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
_appendRoomId(roomId) {
|
_appendRoomId(roomId) {
|
||||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||||
if (!room) {
|
if (!room) {
|
||||||
|
@ -130,23 +146,24 @@ export default class RoomBreadcrumbs extends React.Component {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const rooms = this.state.rooms;
|
const rooms = this.state.rooms;
|
||||||
const avatars = rooms.map(({room, animated, hover}, i) => {
|
const avatars = rooms.map((r, i) => {
|
||||||
const isFirst = i === 0;
|
const isFirst = i === 0;
|
||||||
const classes = classNames({
|
const classes = classNames({
|
||||||
"mx_RoomBreadcrumbs_crumb": true,
|
"mx_RoomBreadcrumbs_crumb": true,
|
||||||
"mx_RoomBreadcrumbs_preAnimate": isFirst && !animated,
|
"mx_RoomBreadcrumbs_preAnimate": isFirst && !r.animated,
|
||||||
"mx_RoomBreadcrumbs_animate": isFirst,
|
"mx_RoomBreadcrumbs_animate": isFirst,
|
||||||
|
"mx_RoomBreadcrumbs_left": r.left,
|
||||||
});
|
});
|
||||||
|
|
||||||
let tooltip = null;
|
let tooltip = null;
|
||||||
if (hover) {
|
if (r.hover) {
|
||||||
tooltip = <Tooltip label={room.name} />;
|
tooltip = <Tooltip label={r.room.name} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AccessibleButton className={classes} key={room.roomId} onClick={() => this._viewRoom(room)}
|
<AccessibleButton className={classes} key={r.room.roomId} onClick={() => this._viewRoom(r.room)}
|
||||||
onMouseEnter={() => this._onMouseEnter(room)} onMouseLeave={() => this._onMouseLeave(room)}>
|
onMouseEnter={() => this._onMouseEnter(r.room)} onMouseLeave={() => this._onMouseLeave(r.room)}>
|
||||||
<RoomAvatar room={room} width={32} height={32} />
|
<RoomAvatar room={r.room} width={32} height={32} />
|
||||||
{tooltip}
|
{tooltip}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue