summary refs log tree commit diff
path: root/v2/screen
diff options
context:
space:
mode:
Diffstat (limited to 'v2/screen')
-rw-r--r--v2/screen/home.ts27
-rw-r--r--v2/screen/login.ts15
2 files changed, 41 insertions, 1 deletions
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",