This commit is contained in:
retoor 2025-04-02 14:55:18 +02:00
parent b365afc910
commit 99b2beeab0
9 changed files with 70 additions and 15 deletions

View File

@ -2,7 +2,7 @@ import asyncio
import logging
import pathlib
import time
import uuid
from snek.view.threads import ThreadsView
logging.basicConfig(level=logging.DEBUG)
@ -189,6 +189,8 @@ class Application(BaseApplication):
channels = []
if not context:
context = {}
context['rid'] = str(uuid.uuid4())
if request.session.get("uid"):
async for subscribed_channel in self.services.channel_member.find(
user_uid=request.session.get("uid"), deleted_at=None, is_banned=False

View File

@ -42,6 +42,7 @@ header {
padding-top: 10px;
padding-left: 20px;
padding-right: 20px;
padding-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
@ -79,6 +80,17 @@ a {
margin-bottom: 3px;
}
h1 {
font-size: 2em;
color: #f05a28;
}
h2 {
font-size: 1.4em;
color: #f05a28;
}
.chat-area {
flex: 1;
display: flex;
@ -354,7 +366,31 @@ a {
color: #fff;
}
@media only screen and (max-width: 600px) {
@media only screen and (max-width: 768px) {
header{
position:fixed;
top: 0;
left: 0;
text-overflow: ellipsis;
*{
font-size: 12px !important;
}
.logo {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
h2 {
font-size: 12px;
}
}
}
/*
body {
justify-content: flex-start;
}
header{
position: sticky;
display: block;
@ -364,5 +400,5 @@ a {
}
.chat-input {
position:sticky;
}
}*/
}

View File

@ -34,11 +34,11 @@ generic-form {
text-align: center;
}
.generic-form-container h1 {
font-size: 2em;
color: #f05a28;
margin-bottom: 20px;
}
input {

View File

@ -266,9 +266,9 @@ class GenericForm extends HTMLElement {
}
div {
min-width:350px;
border-radius: 10px;
padding: 30px;
width: 400px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
text-align: center;
}

View File

@ -56,3 +56,9 @@ div {
text-align: left;
}
@media screen and (max-width: 500px) {
body {
justify-content: flex-start;
}

View File

@ -21,11 +21,12 @@
<script defer src="https://umami.molodetz.nl/script.js" data-website-id="d127c3e4-dc70-4041-a1c8-bcc32c2492ea"></script>
</head>
<body>
<header>
<div class="no-select logo" style="display:none">Snek</div>
<div class="logo">{% block header_text %}{% endblock %}</div>
<nav class="no-select">
<div class="logo no-select">{% block header_text %}{% endblock %}</div>
<nav class="no-select" style="float:right;overflow:hidden;scroll-behavior:smooth">
<a class="no-select" href="/web.html">🏠</a>
<a class="no-select" href="/search-user.html">🔍</a>
<a class="no-select" style="display:none" id="install-button" href="#">📥</a>
@ -39,6 +40,7 @@
{% block sidebar %}
{% include "sidebar_channels.html" %}
{% endblock %}
{% block main %}
<chat-window class="chat-area"></chat-window>
{% endblock %}

View File

@ -16,10 +16,10 @@
<script src="/app.js" type="module"></script>
<script src="/message-list.js" type="module"></script>
<style>{{ highlight_styles }}</style>
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/style.css?rid={{ rid }}">
<script src="/fancy-button.js" type="module"></script>
<script src="/html-frame.js" type="module"></script>
<script src="/generic-form.js" type="module"></script>
<script src="/generic-form.js?rid={{ rid }}" type="module"></script>
<link rel="stylesheet" href="/html-frame.css">
<script defer src="https://umami.molodetz.nl/script.js" data-website-id="d127c3e4-dc70-4041-a1c8-bcc32c2492ea"></script>
{% block head %}

View File

@ -4,10 +4,12 @@
}
</style>
<aside class="sidebar" id="channelSidebar">
{#
<h2 class="no-select">Terminals</h2>
<ul>
<li><a class="no-select" href="/terminal.html">Ubuntu</a></li>
</ul>
#}
{% if channels %}
<h2 class="no-select">Channels</h2>
<ul>

View File

@ -1,9 +1,14 @@
{% extends "app.html" %}
{% block header_text %}<h2>{{ name }}</h2>{% endblock %}
{% block header_text %}<h2 style="color:#fff">{{ name }}</h2>{% endblock %}
{% block main %}
<section class="chat-area" id="chat">
<section class="chat-area">
<div class="chat-messages">
{% for message in messages %}
{% autoescape false %}
@ -11,10 +16,10 @@
{% endautoescape %}
{% endfor %}
</div>
<footer class="chat-input">
<div class="chat-input">
<textarea placeholder="Type a message..." rows="2"></textarea>
<upload-button channel="{{ channel.uid.value }}"></upload-button>
</footer>
</div>
</section>
<script type="module">
@ -137,6 +142,8 @@
lastMessage = messagesContainer.querySelector(".message:last-child");
if (doScrollDown) {
lastMessage?.scrollIntoView({ block: "end", inline: "nearest" });
const inputBox = document.querySelector(".chat-input");
inputBox.scrollIntoView({ block: "end", inline: "nearest" });
}
}