From 6c6f9765c5982347b36a38bce366dddadc497fe3 Mon Sep 17 00:00:00 2001 From: wlodekm Date: Sun, 10 Nov 2024 19:33:13 +0200 Subject: add home --- v2/screen/home.ts | 21 +++++++++++++++++---- v2/screen/login.ts | 9 +++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'v2/screen') diff --git a/v2/screen/home.ts b/v2/screen/home.ts index 6fb4f24..4c8a7cc 100644 --- a/v2/screen/home.ts +++ b/v2/screen/home.ts @@ -1,5 +1,6 @@ import { ElemType } from "../screenbuilder.ts"; import { Screen } from "../screen.ts"; +import type { Input } from "../elements.ts"; import * as client from "../client.ts" export default { @@ -7,21 +8,33 @@ export default { { type: ElemType.TextElem, id: 'home', - data: ["Username: \n"] + data: ["Loading home posts...\n"] + }, + { + type: ElemType.HR, + id: 'hr', + data: [] }, { type: ElemType.InputElem, id: 'msg-input', - data: [false, false] + data: [false, false, true] }, { type: ElemType.ButtonElem, id: 'done-btn', data: ["Send", async function (this: Screen) { - + const msgInput: Input = this.elements.get('msg-input') as Input + client.sendHome(msgInput.value); + msgInput.value = "" + this.render() }] } ], focus: "msg-input", - name: 'home' + name: 'home', + onload (screen: Screen) { + client.setScreen(screen) + client.loadHome(screen) + } } \ No newline at end of file diff --git a/v2/screen/login.ts b/v2/screen/login.ts index 525127b..bc39655 100644 --- a/v2/screen/login.ts +++ b/v2/screen/login.ts @@ -16,6 +16,10 @@ export default { id: 'username-input', data: [false] }, + { + type: ElemType.BR, + id: 'naoiuou' + }, { type: ElemType.TextElem, id: 'password-label', @@ -26,10 +30,15 @@ export default { id: 'password-input', data: [true] }, + { + type: ElemType.BR, + id: 'faij0ifsj' + }, { type: ElemType.ButtonElem, id: 'done-btn', data: ["Done", async function (this: Screen) { + client.setScreen(this) this.off() this.logs.push(`clicked button`) console.clear() -- cgit 1.4.1-2-gfad0