Convert link to button

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-20 23:16:03 +05:30
parent d47e126370
commit 04806a1425
2 changed files with 13 additions and 3 deletions

View file

@ -49,11 +49,15 @@ export class LoginViewModel extends ViewModel {
get homeserver() { return this._homeserver; }
get errorMessage() { return this._errorMessage; }
get showHomeserver() { return !this._hideHomeserver; }
get cancelUrl() { return this.urlCreator.urlForSegment("session"); }
get loadViewModel() {return this._loadViewModel; }
get isBusy() { return this._isBusy; }
get isFetchingLoginOptions() { return this._isFetchingLoginOptions; }
goBack() {
const path = this.navigation.pathFrom([this.navigation.segment("session")]);
this.navigation.applyPath(path);
}
async _createViewModels(homeserver) {
if (this._loginToken) {
this._hideHomeserver = true;

View file

@ -23,8 +23,14 @@ import {spinner} from "../common.js";
export class LoginView extends TemplateView {
render(t, vm) {
const disabled = vm => vm.isBusy;
return t.div({className: "PreSessionScreen"}, [
t.a({className: "button-utility LoginView_back", href: vm.cancelUrl}),
t.button({
className: "button-utility LoginView_back",
onClick: () => vm.goBack(),
disabled
}),
t.div({className: "logo"}),
t.h1([vm.i18n`Sign In`]),
t.mapView(vm => vm.completeSSOLoginViewModel, vm => vm ? new CompleteSSOView(vm) : null),
@ -37,7 +43,7 @@ export class LoginView extends TemplateView {
type: "text",
placeholder: vm.i18n`Your matrix homeserver`,
value: vm.homeserver,
disabled: vm => vm.isBusy,
disabled,
onChange: event => vm.updateHomeServer(event.target.value),
})
]