diff default/static/chat.css @ 85:05b500bd6235

chat: chat implementation, first draft: this chat use the new dynamic pages feature. Updates are pushed directly by server. Identities are used to retrieve avatar, and first letter of nickname is used to generate an avatar is none is found (temporary, a more elaborate avatar generation should follow in the future). Scroll is done automatically when new messages arrive, except if scroll is not at the end, as it probably means that user is checking history. User can resize text area and use [shift] + [enter] to enter multi-line messages. History will then scroll to bottom after message has been sent.
author Goffi <goffi@goffi.org>
date Wed, 03 Jan 2018 01:12:16 +0100
parents
children 0a0d9a953d98
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/default/static/chat.css	Wed Jan 03 01:12:16 2018 +0100
@@ -0,0 +1,99 @@
+:root {
+  --message_input-height: 2rem;
+}
+
+#main_area {
+    overflow: hidden;
+}
+
+.chat_widget {
+	position: absolute;
+    height: 100%;
+    width: 100%;
+    box-sizing: border-box;
+    display: flex;
+    flex-direction: column;
+}
+
+#messages {
+    height: 100%;
+    min-height: 150px;
+    overflow: auto;
+    box-sizing: border-box;
+    resize: vertical;
+    transition: height 0.6s;
+}
+
+#subject {
+	padding: 1em;
+	text-align: center;
+	background: #eee;
+	font-style: italic;
+}
+
+#messages > p {
+    margin: 0;
+    padding: 0.5em 0 0 0.5em;
+}
+
+#messages .msg_body {
+    white-space: pre-wrap;
+}
+
+#message_input {
+    width: 100%;
+    height: 100%;
+    padding-top: 0.5rem;
+    margin: 0;
+    box-sizing: border-box;
+    resize: none;
+}
+
+.message_box {
+    flex: 1 1 calc(var(--message_input-height));
+    position: relative;
+    min-height: 1rem;
+    box-sizing: border-box;
+}
+
+
+#messages > p.msg_info {
+    white-space: pre-wrap;
+    font-family: monospace;
+    color: #049282;
+}
+
+.avatar {
+	height: 2rem;
+	width: 2rem;
+	float: left;
+	background: #ccc;
+	border-radius: 0.2rem;
+	margin-right: 0.3rem;
+	margin-top: 0.3rem;
+}
+
+.generated {
+    font-size: 1.5rem;
+    text-align: center;
+    background:  #43d2f6;
+}
+
+.msg_header {
+	display: block;
+	font-size: 0.9em;
+}
+
+.author {
+    font-weight: bold;
+}
+
+.date {
+	color: #777;
+}
+
+@media (min-width: 800px) {
+    #messages > p {
+        padding-left: 1.5em;
+    }
+}