mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Add 'back' button to JoinRoomView
This commit is contained in:
parent
11f04fbc14
commit
df7774e8f4
@ -27,12 +27,16 @@ export class JoinRoomViewModel extends ViewModel<SegmentType, Options> {
|
|||||||
private _session: Session;
|
private _session: Session;
|
||||||
private _joinInProgress: boolean = false;
|
private _joinInProgress: boolean = false;
|
||||||
private _error: Error | undefined;
|
private _error: Error | undefined;
|
||||||
|
private _closeUrl: string;
|
||||||
|
|
||||||
constructor(options: Readonly<Options>) {
|
constructor(options: Readonly<Options>) {
|
||||||
super(options);
|
super(options);
|
||||||
this._session = options.session;
|
this._session = options.session;
|
||||||
|
this._closeUrl = this.urlRouter.urlUntilSegment("session");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get closeUrl(): string { return this._closeUrl; }
|
||||||
|
|
||||||
async join(roomId: string): Promise<void> {
|
async join(roomId: string): Promise<void> {
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
this._joinInProgress = true;
|
this._joinInProgress = true;
|
||||||
|
@ -27,7 +27,10 @@ export class JoinRoomView extends TemplateView<JoinRoomViewModel> {
|
|||||||
placeholder: vm.i18n`Enter a room id or alias`,
|
placeholder: vm.i18n`Enter a room id or alias`,
|
||||||
disabled: vm => vm.joinInProgress,
|
disabled: vm => vm.joinInProgress,
|
||||||
});
|
});
|
||||||
return t.main({className: "JoinRoomView middle"},
|
return t.main({className: "JoinRoomView middle"}, [
|
||||||
|
t.div({className: "JoinRoomView_header middle-header"}, [
|
||||||
|
t.a({className: "button-utility close-middle", href: vm.closeUrl, title: vm.i18n`Cancel room join`}),
|
||||||
|
]),
|
||||||
t.div({className: "JoinRoomView_body centered-column"}, [
|
t.div({className: "JoinRoomView_body centered-column"}, [
|
||||||
t.h2("Join room"),
|
t.h2("Join room"),
|
||||||
t.form({className: "JoinRoomView_detailsForm form", onSubmit: evt => this.onSubmit(evt, input.value)}, [
|
t.form({className: "JoinRoomView_detailsForm form", onSubmit: evt => this.onSubmit(evt, input.value)}, [
|
||||||
@ -52,7 +55,7 @@ export class JoinRoomView extends TemplateView<JoinRoomViewModel> {
|
|||||||
})
|
})
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit(evt, id) {
|
onSubmit(evt, id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user