diff src/chat.html.luan @ 10:f9e6a4cc4f7d

add Post
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 30 Oct 2024 23:18:45 -0600
parents b8b12fd8be22
children 8b8905f63d80
line wrap: on
line diff
--- a/src/chat.html.luan	Wed Oct 30 10:18:13 2024 -0600
+++ b/src/chat.html.luan	Wed Oct 30 23:18:45 2024 -0600
@@ -2,6 +2,7 @@
 local error = Luan.error
 local ipairs = Luan.ipairs or error()
 local pairs = Luan.pairs or error()
+local range = Luan.range or error()
 local Table = require "luan:Table.luan"
 local concat = Table.concat or error()
 local is_empty = Table.is_empty or error()
@@ -11,6 +12,7 @@
 local Shared = require "site:/lib/Shared.luan"
 local head = Shared.head or error()
 local header = Shared.header or error()
+local started = Shared.started or error()
 local User = require "site:/lib/User.luan"
 local current_user = User.current or error()
 local get_user_by_email = User.get_by_email or error()
@@ -82,54 +84,9 @@
 	<head>
 <%		head() %>
 		<style>
-			body {
-				height: 100vh;
-				display: flex;
-				flex-direction: column;
-			}
-			div[content] {
-				margin-bottom: 0;
-				display: flex;
-				height: 100%;
-				margin-left: calc(3% - 8px);
-			}
-			div[chats] {
-				width: 250px;
-				padding-right: 8px;
-			}
-			div[chats] > div {
-				margin-top: 2px;
-				margin-bottom: 2px;
-				padding-top: 16px;
-				padding-bottom: 16px;
-				padding-left: 8px;
-				padding-right: 8px;
-				border-radius: 4px;
-			}
-			div[chats] > div:hover,
-			div[chats] > div[selected] {
-				background-color: LightBlue;
-			}
-			div[posts] {
-				padding-left: 8px;
-				border-left: 1px solid;
-			}
+			@import "chat.css?s=<%=started%>";
 		</style>
-		<script>
-			'use strict';
-
-			let currentChatId = null;
-
-			function selectChat(div) {
-				let chatId = div.getAttribute('chat');
-				if( chatId === currentChatId )
-					return;
-				let selected = div.parentNode.querySelector('[selected]');
-				if( selected )  selected.removeAttribute('selected');
-				div.setAttribute('selected','');
-				ajax(`chat.js?chat=${chatId}`);
-			}
-		</script>
+		<script src="chat.js?s=<%=started%>"></script>
 	</head>
 	<body>
 <%		header() %>