From d28d8333ebe71e2937660b13d9afb1d516cf14f0 Mon Sep 17 00:00:00 2001 From: wlodekm Date: Fri, 15 Nov 2024 09:46:47 +0200 Subject: v1.0.2 --- v2/screen/home.ts | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 v2/screen/home.ts (limited to 'v2/screen/home.ts') diff --git a/v2/screen/home.ts b/v2/screen/home.ts deleted file mode 100644 index 0be3ef9..0000000 --- a/v2/screen/home.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ElemType } from "../screenbuilder.ts"; -import { Screen } from "../screen.ts"; -import type { Input, Element, Text } from "../elements.ts"; -import * as client from "../client.ts" - -export default { - elements: [ - { - type: ElemType.TextElem, - id: 'home', - data: ["Loading home posts...\n", function (this: Text, text: string) { - const msgInput: Input = this.screen.elements.get("msg-input") as Input; - const inputValueHeight = msgInput.value.split("\n").length + 1; - const termHeight = process.stdout.rows; - const termWidth = process.stdout.columns; - - let splitText = this.text.split("\n"); - splitText = splitText.map(t => t.replace(new RegExp(`([^]){${termWidth}}`, "g"),"$1\n")); - splitText = splitText.join("\n").split("\n") - - splitText = splitText.slice(-(termHeight - inputValueHeight)); - - return splitText.join("\n") - }] - }, - { - type: ElemType.HR, - id: 'hr', - data: [] - }, - { - type: ElemType.InputElem, - id: 'msg-input', - 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', - onload (screen: Screen) { - client.setScreen(screen) - client.loadHome(screen) - } -} \ No newline at end of file -- cgit 1.4.1-2-gfad0