Add 'back' button to JoinRoomView

This commit is contained in:
Paulo Pinto 2022-12-13 17:40:36 +00:00
parent 11f04fbc14
commit df7774e8f4
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View File

@ -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;

View File

@ -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) {