mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-10 20:17:32 +01:00
fix back button in room header not working
This commit is contained in:
parent
a9cab44314
commit
d96f8adcc7
@ -65,6 +65,10 @@ export class URLRouter {
|
|||||||
return this.urlForSegments([this._navigation.segment(type, value)]);
|
return this.urlForSegments([this._navigation.segment(type, value)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
urlUntilSegment(type) {
|
||||||
|
return this.urlForPath(this._navigation.path.until(type));
|
||||||
|
}
|
||||||
|
|
||||||
urlForPath(path) {
|
urlForPath(path) {
|
||||||
return this.history.pathAsUrl(this._stringifyPath(path));
|
return this.history.pathAsUrl(this._stringifyPath(path));
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import {ViewModel} from "../../ViewModel.js";
|
|||||||
export class RoomViewModel extends ViewModel {
|
export class RoomViewModel extends ViewModel {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
const {room, ownUserId, closeCallback} = options;
|
const {room, ownUserId} = options;
|
||||||
this._room = room;
|
this._room = room;
|
||||||
this._ownUserId = ownUserId;
|
this._ownUserId = ownUserId;
|
||||||
this._timeline = null;
|
this._timeline = null;
|
||||||
@ -30,9 +30,13 @@ export class RoomViewModel extends ViewModel {
|
|||||||
this._onRoomChange = this._onRoomChange.bind(this);
|
this._onRoomChange = this._onRoomChange.bind(this);
|
||||||
this._timelineError = null;
|
this._timelineError = null;
|
||||||
this._sendError = null;
|
this._sendError = null;
|
||||||
this._closeCallback = closeCallback;
|
|
||||||
this._composerVM = new ComposerViewModel(this);
|
this._composerVM = new ComposerViewModel(this);
|
||||||
this._clearUnreadTimout = null;
|
this._clearUnreadTimout = null;
|
||||||
|
this._closeUrl = this.urlRouter.urlUntilSegment("session");
|
||||||
|
}
|
||||||
|
|
||||||
|
get closeUrl() {
|
||||||
|
return this._closeUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
@ -54,7 +54,7 @@ html {
|
|||||||
/* mobile layout */
|
/* mobile layout */
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
/* show back button */
|
/* show back button */
|
||||||
.RoomHeader button.back { display: block; }
|
.RoomHeader .close-room { display: block !important; }
|
||||||
/* hide grid button */
|
/* hide grid button */
|
||||||
.LeftPanel button.grid { display: none; }
|
.LeftPanel button.grid { display: none; }
|
||||||
div.RoomView, div.room-placeholder, div.RoomGridView { display: none; }
|
div.RoomView, div.room-placeholder, div.RoomGridView { display: none; }
|
||||||
|
@ -27,7 +27,7 @@ limitations under the License.
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.RoomHeader .back {
|
.RoomHeader .close-room {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ a {
|
|||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.back::before {
|
.close-room::before {
|
||||||
content: "☰";
|
content: "☰";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,12 +397,12 @@ a {
|
|||||||
|
|
||||||
.RoomHeader > :not(:last-child) {
|
.RoomHeader > :not(:last-child) {
|
||||||
/* use margin-right because the first item,
|
/* use margin-right because the first item,
|
||||||
button.back might be hidden and then we don't
|
.close-room might be hidden and then we don't
|
||||||
want a margin-left on the second item*/
|
want a margin-left on the second item*/
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.back {
|
.close-room, .close-session {
|
||||||
background-image: url('icons/chevron-left.svg');
|
background-image: url('icons/chevron-left.svg');
|
||||||
background-position-x: 10px;
|
background-position-x: 10px;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ export class RoomView extends TemplateView {
|
|||||||
return t.div({className: "RoomView"}, [
|
return t.div({className: "RoomView"}, [
|
||||||
t.div({className: "TimelinePanel"}, [
|
t.div({className: "TimelinePanel"}, [
|
||||||
t.div({className: "RoomHeader"}, [
|
t.div({className: "RoomHeader"}, [
|
||||||
t.button({className: "utility back", onClick: () => vm.close()}),
|
t.a({className: "button-utility close-room", href: vm.closeUrl, title: vm.i18n`Close room`}),
|
||||||
renderAvatar(t, vm, 32),
|
renderAvatar(t, vm, 32),
|
||||||
t.div({className: "room-description"}, [
|
t.div({className: "room-description"}, [
|
||||||
t.h2(vm => vm.name),
|
t.h2(vm => vm.name),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user