From 19b50f3bce07e40afce5999be2937a8226077817 Mon Sep 17 00:00:00 2001 From: retoor Date: Fri, 26 Dec 2025 01:05:06 +0000 Subject: [PATCH] feat: add channel management dialogs for create, settings, delete, invite, and leave operations Implement five new dialog interfaces (create, settings, delete, invite, leave) with corresponding CSS styling, JavaScript classes, and RPC integration. Add sidebar add-button styling, update help dialog with new slash commands, and bump version to 1.14.0. --- CHANGELOG.md | 8 + pyproject.toml | 2 +- src/snek/static/base.css | 127 +++++++++++ .../templates/dialog_channel_settings.html | 205 ++++++++++++++++++ src/snek/templates/dialog_create_channel.html | 91 ++++++++ src/snek/templates/dialog_help.html | 26 ++- src/snek/templates/dialog_invite.html | 116 ++++++++++ src/snek/templates/dialog_leave_channel.html | 65 ++++++ src/snek/templates/sidebar_channels.html | 2 +- src/snek/templates/web.html | 12 +- src/snek/view/rpc.py | 157 ++++++++++++++ 11 files changed, 803 insertions(+), 8 deletions(-) create mode 100644 src/snek/templates/dialog_channel_settings.html create mode 100644 src/snek/templates/dialog_create_channel.html create mode 100644 src/snek/templates/dialog_invite.html create mode 100644 src/snek/templates/dialog_leave_channel.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a742d5..38c14504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,14 @@ + +## Version 1.14.0 - 2025-12-26 + +Users can now create, configure settings for, and delete channels through dedicated dialog interfaces. Developers access new RPC methods to support these channel management operations. + +**Changes:** 9 files, 801 lines +**Languages:** CSS (127 lines), HTML (517 lines), Python (157 lines) + ## Version 1.13.0 - 2025-12-24 Improves performance in the balancer, socket service, and cache by removing async locks. Adds database connection injection for testing in the app and updates pytest configuration. diff --git a/pyproject.toml b/pyproject.toml index ba01daa7..4341af7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "Snek" -version = "1.13.0" +version = "1.14.0" readme = "README.md" #license = { file = "LICENSE", content-type="text/markdown" } description = "Snek Chat Application by Molodetz" diff --git a/src/snek/static/base.css b/src/snek/static/base.css index de4c2f9a..cd91467b 100644 --- a/src/snek/static/base.css +++ b/src/snek/static/base.css @@ -429,6 +429,20 @@ a { margin-top: 0; } +.sidebar-add-btn { + color: #f05a28; + text-decoration: none; + font-size: 1.2em; + font-weight: bold; + margin-left: 8px; + opacity: 0.7; + transition: opacity 0.2s; +} + +.sidebar-add-btn:hover { + opacity: 1; +} + .sidebar ul { list-style: none; margin-bottom: 15px; @@ -657,6 +671,119 @@ dialog .dialog-button:disabled:focus { outline: none; } +dialog .dialog-form { + display: flex; + flex-direction: column; + gap: 12px; +} + +dialog .dialog-input { + width: 100%; + padding: 10px 12px; + border: 1px solid #333; + border-radius: 4px; + background-color: #0f0f0f; + color: #e6e6e6; + font-family: 'Courier New', monospace; + font-size: 14px; + transition: border-color 0.2s ease, box-shadow 0.2s ease; + box-sizing: border-box; +} + +dialog .dialog-input:focus { + outline: none; + border-color: #f05a28; + box-shadow: 0 0 0 2px rgba(240, 90, 40, 0.2); +} + +dialog .dialog-input::placeholder { + color: #555; +} + +dialog .dialog-input.error { + border-color: #8b0000; + box-shadow: 0 0 0 2px rgba(139, 0, 0, 0.2); +} + +dialog .dialog-checkbox-label { + display: flex; + align-items: center; + gap: 8px; + color: #e6e6e6; + font-size: 14px; + cursor: pointer; +} + +dialog .dialog-checkbox-label input[type="checkbox"] { + width: 16px; + height: 16px; + accent-color: #f05a28; +} + +dialog .dialog-suggestions { + max-height: 150px; + overflow-y: auto; +} + +dialog .dialog-suggestion-item { + padding: 8px 12px; + cursor: pointer; + border-radius: 4px; + transition: background-color 0.2s; +} + +dialog .dialog-suggestion-item:hover { + background-color: #1a1a1a; +} + +dialog .dialog-box-wide { + max-width: 500px; +} + +dialog .dialog-label { + display: block; + font-size: 12px; + color: #888; + margin-bottom: 4px; + text-transform: uppercase; + letter-spacing: 0.5px; +} + +dialog .dialog-label-danger { + color: #8b0000; +} + +dialog .dialog-divider { + height: 1px; + background-color: #333; + margin: 16px 0; +} + +dialog .dialog-danger-zone { + padding: 12px; + border: 1px solid #8b0000; + border-radius: 4px; + background-color: rgba(139, 0, 0, 0.1); +} + +dialog .dialog-button.danger { + background-color: #8b0000; + border-color: #8b0000; + color: #fff; +} + +dialog .dialog-button.danger:hover { + background-color: #a00000; + border-color: #a00000; +} + +dialog .dialog-button.danger:disabled { + background-color: #0a0a0a; + border-color: #222; + color: #555; + cursor: not-allowed; +} + .embed-url-link { display: flex; flex-direction: column; diff --git a/src/snek/templates/dialog_channel_settings.html b/src/snek/templates/dialog_channel_settings.html new file mode 100644 index 00000000..3796d988 --- /dev/null +++ b/src/snek/templates/dialog_channel_settings.html @@ -0,0 +1,205 @@ + + +
+
+

Channel Settings

+
+
+ + + + + + + + +
+ +
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+

Delete Channel

+
+

This action cannot be undone. Type the channel name to confirm:

+
+ +
+
+
+ + +
+
+
+
+ + diff --git a/src/snek/templates/dialog_create_channel.html b/src/snek/templates/dialog_create_channel.html new file mode 100644 index 00000000..b15bbfa6 --- /dev/null +++ b/src/snek/templates/dialog_create_channel.html @@ -0,0 +1,91 @@ + + +
+
+

Create Channel

+
+
+ + + +
+
+
+ + +
+
+
+
+ + diff --git a/src/snek/templates/dialog_help.html b/src/snek/templates/dialog_help.html index eb726625..f0547390 100644 --- a/src/snek/templates/dialog_help.html +++ b/src/snek/templates/dialog_help.html @@ -32,10 +32,30 @@ command: "/img-gen", description: "Generate an image" }, - { + { command: "/live", - description: "Toggle live typing mode" - } + description: "Toggle live typing mode" + }, + { + command: "/create", + description: "Create a new channel" + }, + { + command: "/invite", + description: "Invite a user to this channel" + }, + { + command: "/leave", + description: "Leave this channel" + }, + { + command: "/settings", + description: "Channel settings (moderators)" + }, + { + command: "/container", + description: "Manage channel container" + } ]; constructor() { diff --git a/src/snek/templates/dialog_invite.html b/src/snek/templates/dialog_invite.html new file mode 100644 index 00000000..e12d5e5e --- /dev/null +++ b/src/snek/templates/dialog_invite.html @@ -0,0 +1,116 @@ + + +
+
+

Invite User

+
+
+ +
+
+
+
+ + +
+
+
+
+ + diff --git a/src/snek/templates/dialog_leave_channel.html b/src/snek/templates/dialog_leave_channel.html new file mode 100644 index 00000000..65a52c5f --- /dev/null +++ b/src/snek/templates/dialog_leave_channel.html @@ -0,0 +1,65 @@ + + +
+
+

Leave Channel

+
+

Are you sure you want to leave this channel?

+
+
+ + +
+
+
+
+ + diff --git a/src/snek/templates/sidebar_channels.html b/src/snek/templates/sidebar_channels.html index 56126968..64a6f4f4 100644 --- a/src/snek/templates/sidebar_channels.html +++ b/src/snek/templates/sidebar_channels.html @@ -11,7 +11,7 @@ {% if channels %} -

Channels

+

Channels +