From 6f1ef206df8c95e82f45b55c52cb7d0cb5c0e0d3 Mon Sep 17 00:00:00 2001 From: jude Date: Sun, 17 Sep 2023 18:33:01 +0100 Subject: [PATCH] Correctly highlight options on mobile --- web/src/routes/dashboard/mod.rs | 5 ++++- web/static/css/style.css | 12 ++++++++++++ web/static/js/main.js | 20 ++++++++++++++------ web/templates/dashboard.html.tera | 3 ++- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/web/src/routes/dashboard/mod.rs b/web/src/routes/dashboard/mod.rs index 2ffe7af..054ab7f 100644 --- a/web/src/routes/dashboard/mod.rs +++ b/web/src/routes/dashboard/mod.rs @@ -124,6 +124,7 @@ pub struct ReminderCreate { attachment: Option>, attachment_name: Option, avatar: Option, + #[serde(with = "string")] channel: u64, content: String, embed_author: String, @@ -565,7 +566,9 @@ pub async fn create_reminder( tts, username, `utc_time` - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + ) VALUES (?, ?, ?, ?, + (SELECT id FROM guilds WHERE guild = ?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + ?, ?, ?, ?, ?)", new_uid, attachment_data, reminder.attachment_name, diff --git a/web/static/css/style.css b/web/static/css/style.css index 060e5bc..7420bdc 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -15,6 +15,18 @@ div.reminderContent.is-collapsed .column.settings { display: none; } +div.reminderContent.is-collapsed .button-row { + display: none; +} + +div.reminderContent.is-collapsed .button-row-edit { + display: none; +} + +div.reminderContent.is-collapsed .reminder-topbar { + padding-bottom: 0; +} + div.reminderContent.is-collapsed .invert-collapses { display: inline-flex; } diff --git a/web/static/js/main.js b/web/static/js/main.js index 9aec630..0aa3d92 100644 --- a/web/static/js/main.js +++ b/web/static/js/main.js @@ -454,19 +454,27 @@ document.addEventListener("guildSwitched", async (e) => { .querySelectorAll(".patreon-only") .forEach((el) => el.classList.add("is-locked")); - let $li = document.querySelector(`li[data-guild="${e.detail.guild_id}"]`); + let $li = document.querySelectorAll(`li[data-guild="${e.detail.guild_id}"]`); - if ($li === null) { + if ($li.length === 0) { switch_pane("user-error"); return; } switch_pane(e.detail.pane); reset_guild_pane(); - $li.querySelector("li > a").classList.add("is-active"); - $li.querySelectorAll(`*[data-pane="${e.detail.pane}"]`).forEach((el) => { - el.classList.add("is-active"); - }); + document + .querySelectorAll(`li[data-guild="${e.detail.guild_id}"] > a`) + .forEach((el) => { + el.classList.add("is-active"); + }); + document + .querySelectorAll( + `li[data-guild="${e.detail.guild_id}"] *[data-pane="${e.detail.pane}"]` + ) + .forEach((el) => { + el.classList.add("is-active"); + }); if (globalPatreon || (await fetch_patreon(e.detail.guild_id))) { document diff --git a/web/templates/dashboard.html.tera b/web/templates/dashboard.html.tera index 1e12718..b9ac671 100644 --- a/web/templates/dashboard.html.tera +++ b/web/templates/dashboard.html.tera @@ -40,7 +40,7 @@