Skip to content
Snippets Groups Projects
Commit cecab016 authored by Midhun Suresh's avatar Midhun Suresh
Browse files

Fix typescript errors

parent 6038b67d
No related branches found
No related tags found
No related merge requests found
import { TemplateView, LoadingView } from "hydrogen-view-sdk";
import { Builder } from "hydrogen-view-sdk/types/platform/web/ui/general/TemplateView";
import { AccountSetupViewModel } from "../../viewmodels/AccountSetupViewModel";
export class AccountSetupView extends TemplateView<AccountSetupViewModel> {
render(t: Builder<AccountSetupViewModel>, vm: AccountSetupViewModel) {
constructor(value) {
super(value);
}
render(t, vm: AccountSetupViewModel) {
return t.div(
{ className: "AccountSetupView" },
t.mapView( (vm) => vm.privacyPolicyLink, (link) => link ? new PolicyAgreementView(vm) : new LoadingView())
......@@ -12,7 +15,11 @@ export class AccountSetupView extends TemplateView<AccountSetupViewModel> {
}
class PolicyAgreementView extends TemplateView<AccountSetupViewModel> {
render(t: Builder<AccountSetupViewModel>, vm: AccountSetupViewModel) {
constructor(value) {
super(value);
}
render(t, vm: AccountSetupViewModel) {
return t.div({ className: "PolicyAgreementView" }, [
t.div({ className: "PolicyAgreementView-text"},
[
......
import { TemplateView, TimelineView, LoadingView, AvatarView, RoomViewModel } from "hydrogen-view-sdk";
import { Builder } from "hydrogen-view-sdk/types/platform/web/ui/general/TemplateView";
import { TemplateView, TimelineView, LoadingView, AvatarView } from "hydrogen-view-sdk";
import { MessageComposer } from "hydrogen-view-sdk";
import { ChatterboxViewModel } from "../../viewmodels/ChatterboxViewModel";
export class ChatterboxView extends TemplateView<ChatterboxViewModel> {
render(t: Builder<ChatterboxViewModel>) {
return t.div({className: "ChatterboxView"}, [
t.mapView(vm => vm.roomViewModel? vm: null, vm => vm ? new RoomHeaderView(vm) : null),
t.mapView(vm => vm.timelineViewModel, vm => vm ? new TimelineView(vm) : new LoadingView()),
t.mapView(vm => vm.messageComposerViewModel, vm => vm ? new MessageComposer(vm) : null),
t.div({className: "ChatterboxView_footer"}, ["Powered by", t.img({src:"./src/ui/res/matrix-logo.svg"})]),
constructor(value) {
super(value);
}
render(t) {
return t.div({ className: "ChatterboxView" }, [
t.mapView(
(vm) => (vm.roomViewModel ? vm : null),
(vm) => (vm ? new RoomHeaderView(vm) : null)
),
t.mapView(
(vm) => vm.timelineViewModel,
(vm) => (vm ? new TimelineView(vm) : new LoadingView())
),
t.mapView(
(vm) => vm.messageComposerViewModel,
(vm) => (vm ? new MessageComposer(vm) : null)
),
t.div({ className: "ChatterboxView_footer" }, [
"Powered by",
t.img({ src: "./src/ui/res/matrix-logo.svg" }),
]),
]);
}
}
class RoomHeaderView extends TemplateView<ChatterboxViewModel> {
render(t: Builder<ChatterboxViewModel>, vm) {
constructor(value) {
super(value);
}
render(t, vm: ChatterboxViewModel) {
return t.div({ className: "RoomHeaderView" }, [
t.view(new AvatarView(vm.roomViewModel, 30)),
t.div({ className: "RoomHeaderView_name" }, vm => vm.roomViewModel.name),
......
import { TemplateView } from "hydrogen-view-sdk";
import { Builder } from "hydrogen-view-sdk/types/platform/web/ui/general/TemplateView";
import { RootViewModel } from "../../viewmodels/RootViewModel";
import { AccountSetupView } from "./AccountSetupView";
import { ChatterboxView } from "./ChatterboxView";
export class RootView extends TemplateView<RootViewModel> {
render(t: Builder<RootViewModel>, vm: RootViewModel) {
constructor(value) {
super(value);
}
render(t, vm: RootViewModel) {
return t.mapView(vm => vm.activeSection, section => {
switch(section) {
case "start":
......@@ -22,7 +25,7 @@ export class RootView extends TemplateView<RootViewModel> {
class StartView extends TemplateView<RootViewModel> {
render(t: Builder<RootViewModel>, vm: RootViewModel) {
render(t, vm: RootViewModel) {
return t.button({ className: "StartChat", onClick: () => vm.start() });
}
}
......@@ -6,7 +6,7 @@ import "hydrogen-view-sdk/style.css";
export class AccountSetupViewModel extends ViewModel {
private _config: IChatterboxConfig;
private _client: Client;
private _client: typeof Client;
private _termsStage?: any;
private _password: string;
......
import { RoomViewModel, ViewModel, ComposerViewModel} from "hydrogen-view-sdk";
export class ChatterboxViewModel extends ViewModel {
private _messageComposerViewModel?: ComposerViewModel;
private _roomViewModel?: RoomViewModel;
private _messageComposerViewModel?: typeof ComposerViewModel;
private _roomViewModel?: typeof RoomViewModel;
private _loginPromise: Promise<void>;
constructor(options) {
......
import { ViewModel, Client, Navigation, createRouter, Platform } from "hydrogen-view-sdk";
import { ViewModel, Client, Navigation, createRouter, Platform } from "hydrogen-view-sdk";
import { IChatterboxConfig } from "../types/IChatterboxConfig";
import { ChatterboxViewModel } from "./ChatterboxViewModel";
import "hydrogen-view-sdk/style.css";
import { AccountSetupViewModel } from "./AccountSetupViewModel";
type Options = { platform: Platform, navigation: ReturnType<Navigation>, urlCreator: ReturnType<createRouter> };
type Options = { platform: typeof Platform, navigation: typeof Navigation, urlCreator: ReturnType<typeof createRouter> };
export class RootViewModel extends ViewModel {
private _config: IChatterboxConfig;
private _client: Client;
private _client: typeof Client;
private _chatterBoxViewModel?: ChatterboxViewModel;
private _accountSetupViewModel?: AccountSetupViewModel;
private _activeSection: string = "start";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment