From 22a2150eef88430f9d9d5491a002e23e7813ac0c Mon Sep 17 00:00:00 2001 From: wlodekm Date: Sat, 9 Nov 2024 16:37:43 +0200 Subject: v2 progress --- v2/screen/home.ts | 27 +++++++++++++++++++++++++++ v2/screen/login.ts | 15 ++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 v2/screen/home.ts (limited to 'v2/screen') diff --git a/v2/screen/home.ts b/v2/screen/home.ts new file mode 100644 index 0000000..6fb4f24 --- /dev/null +++ b/v2/screen/home.ts @@ -0,0 +1,27 @@ +import { ElemType } from "../screenbuilder.ts"; +import { Screen } from "../screen.ts"; +import * as client from "../client.ts" + +export default { + elements: [ + { + type: ElemType.TextElem, + id: 'home', + data: ["Username: \n"] + }, + { + type: ElemType.InputElem, + id: 'msg-input', + data: [false, false] + }, + { + type: ElemType.ButtonElem, + id: 'done-btn', + data: ["Send", async function (this: Screen) { + + }] + } + ], + focus: "msg-input", + name: 'home' +} \ No newline at end of file diff --git a/v2/screen/login.ts b/v2/screen/login.ts index c9e4fec..525127b 100644 --- a/v2/screen/login.ts +++ b/v2/screen/login.ts @@ -1,4 +1,8 @@ import { ElemType } from "../screenbuilder.ts"; +import { Screen } from "../screen.ts"; +import * as client from "../client.ts" +import { build } from "../screenbuilder.ts"; +import HomeScreen from "./home.ts"; export default { elements: [ @@ -25,7 +29,16 @@ export default { { type: ElemType.ButtonElem, id: 'done-btn', - data: ["Done"] + data: ["Done", async function (this: Screen) { + this.off() + this.logs.push(`clicked button`) + console.clear() + console.log("logging in...") + //@ts-ignore + await client.login(this.elements.get("username-input").value, this.elements.get("password-input").value) + build(HomeScreen); + client + }] } ], focus: "username-input", -- cgit 1.4.1-2-gfad0