From 6e527502db9c7e1f4298cae16b41f814361b6bc0 Mon Sep 17 00:00:00 2001 From: DPN MW Date: Sun, 8 Mar 2026 12:58:09 -0400 Subject: [PATCH] Major overhaul v2 --- .../community-landing-admin-tabs.js | 347 +++++++++++++----- .../stylesheets/community_landing/admin.css | 183 +++++---- .../stylesheets/community_landing/landing.css | 48 ++- config/settings.yml | 15 + lib/community_landing/data_fetcher.rb | 2 +- lib/community_landing/page_builder.rb | 26 +- lib/community_landing/style_builder.rb | 20 + plugin.rb | 36 +- 8 files changed, 485 insertions(+), 192 deletions(-) diff --git a/assets/javascripts/discourse/initializers/community-landing-admin-tabs.js b/assets/javascripts/discourse/initializers/community-landing-admin-tabs.js index 361f250..fe666e8 100644 --- a/assets/javascripts/discourse/initializers/community-landing-admin-tabs.js +++ b/assets/javascripts/discourse/initializers/community-landing-admin-tabs.js @@ -1,4 +1,4 @@ -// community-landing-admin-tabs v2.4.0 +// community-landing-admin-tabs v2.5.0 import { withPluginApi } from "discourse/lib/plugin-api"; // Setting descriptions — injected into the admin DOM since the newer @@ -120,7 +120,7 @@ const DESCRIPTIONS = { participation_title_enabled: "Show heading above participation cards.", participation_title: "Heading text above participation cards.", participation_bio_max_length: "Max characters from each user's bio (50–500). Longer bios are truncated.", - participation_icon_color: "Color for the decorative quote icon on cards. Leave blank for accent color.", + participation_icon_color: "Color for the decorative quote icon and avatar border. Leave blank for accent color.", participation_card_bg_dark: "Participation card background for dark mode.", participation_card_bg_light: "Participation card background for light mode.", participation_bg_dark: "Section background for dark mode. Leave blank for default.", @@ -128,6 +128,11 @@ const DESCRIPTIONS = { participation_min_height: "Minimum section height in pixels. 0 = auto.", participation_border_style: "Border style at the bottom of the section.", participation_title_size: "Section title font size in pixels. 0 = use default.", + participation_stat_color: "Color for stat numbers (Topics, Posts, Likes). Leave blank for default text color.", + participation_stat_label_color: "Color for stat labels below the numbers. Leave blank for muted text.", + participation_bio_color: "Color for the bio excerpt text. Leave blank for default text color.", + participation_name_color: "Color for the @username. Leave blank for default strong text color.", + participation_meta_color: "Color for the join date and location line. Leave blank for accent color.", // ── Stats ── stats_enabled: "Show the stats section with live community counters.", @@ -304,7 +309,10 @@ const TABS = [ "participation_icon_color", "participation_card_bg_dark", "participation_card_bg_light", "participation_bg_dark", "participation_bg_light", - "participation_min_height", "participation_border_style" + "participation_min_height", "participation_border_style", + "participation_stat_color", "participation_stat_label_color", + "participation_bio_color", "participation_name_color", + "participation_meta_color" ]) }, { @@ -333,7 +341,7 @@ const TABS = [ }, { id: "topics", - label: "Trending", + label: "Topics", settings: new Set([ "topics_enabled", "topics_title_enabled", "topics_title", "topics_title_size", "topics_count", @@ -343,7 +351,7 @@ const TABS = [ }, { id: "groups", - label: "Spaces", + label: "Groups", settings: new Set([ "groups_enabled", "groups_title_enabled", "groups_title", "groups_title_size", "groups_count", "groups_selected", @@ -386,43 +394,6 @@ const TABS = [ } ]; -// Dark/light color pairs — light row gets merged into dark row (same-row display) -const BG_PAIRS = [ - // Navbar - ["navbar_signin_color_dark", "navbar_signin_color_light"], - ["navbar_join_color_dark", "navbar_join_color_light"], - // Hero - ["hero_primary_btn_color_dark", "hero_primary_btn_color_light"], - ["hero_secondary_btn_color_dark", "hero_secondary_btn_color_light"], - ["hero_bg_dark", "hero_bg_light"], - ["hero_card_bg_dark", "hero_card_bg_light"], - ["contributors_pill_bg_dark", "contributors_pill_bg_light"], - // Participation - ["participation_card_bg_dark", "participation_card_bg_light"], - ["participation_bg_dark", "participation_bg_light"], - // Stats - ["stat_card_bg_dark", "stat_card_bg_light"], - ["stats_bg_dark", "stats_bg_light"], - // About - ["about_card_color_dark", "about_card_color_light"], - ["about_bg_dark", "about_bg_light"], - // Trending - ["topics_card_bg_dark", "topics_card_bg_light"], - ["topics_bg_dark", "topics_bg_light"], - // Spaces - ["groups_card_bg_dark", "groups_card_bg_light"], - ["groups_bg_dark", "groups_bg_light"], - // FAQ - ["faq_card_bg_dark", "faq_card_bg_light"], - // App CTA - ["app_cta_gradient_start_dark", "app_cta_gradient_start_light"], - ["app_cta_gradient_mid_dark", "app_cta_gradient_mid_light"], - ["app_cta_gradient_end_dark", "app_cta_gradient_end_light"], - ["app_cta_bg_dark", "app_cta_bg_light"], - // Footer - ["footer_bg_dark", "footer_bg_light"], -]; - // Tabs that depend on a section-enable toggle. // When the toggle is OFF the tab shows a notice instead of the full settings list. const TAB_ENABLE_SETTINGS = { @@ -436,12 +407,29 @@ const TAB_ENABLE_SETTINGS = { participation: { setting: "participation_enabled", label: "Participation" }, stats: { setting: "stats_enabled", label: "Stats" }, about: { setting: "about_enabled", label: "About" }, - topics: { setting: "topics_enabled", label: "Trending" }, - groups: { setting: "groups_enabled", label: "Spaces" }, + topics: { setting: "topics_enabled", label: "Topics" }, + groups: { setting: "groups_enabled", label: "Groups" }, faq: { setting: "faq_enabled", label: "FAQ" }, appcta: { setting: "show_app_ctas", label: "App CTA" }, }; +// Image URL settings that get upload buttons injected in the admin panel. +// "multi: true" means pipe-separated list (appends rather than replaces). +const IMAGE_UPLOAD_SETTINGS = { + og_image_url: { label: "Upload Image", multi: false }, + favicon_url: { label: "Upload Favicon", multi: false }, + logo_dark_url: { label: "Upload Logo", multi: false }, + logo_light_url: { label: "Upload Logo", multi: false }, + footer_logo_url: { label: "Upload Logo", multi: false }, + hero_background_image_url: { label: "Upload Image", multi: false }, + hero_image_urls: { label: "Add Image", multi: true }, + about_image_url: { label: "Upload Image", multi: false }, + about_background_image_url: { label: "Upload Image", multi: false }, + ios_app_badge_image_url: { label: "Upload Badge", multi: false }, + android_app_badge_image_url: { label: "Upload Badge", multi: false }, + app_cta_image_url: { label: "Upload Image", multi: false }, +}; + let currentTab = "settings"; let filterActive = false; let isActive = false; @@ -487,9 +475,14 @@ function updateActiveStates(activeId) { }); // Native nav: the original Settings
  • + // Discourse's router keeps aria-current="true" on the native , so we + // must also add a class to suppress its active styling when another tab + // is selected. const nativeItem = document.querySelector(".cl-native-settings-item"); if (nativeItem) { - nativeItem.classList.toggle("active", activeId === "settings"); + const isSettings = activeId === "settings"; + nativeItem.classList.toggle("active", isSettings); + nativeItem.classList.toggle("cl-tab-inactive", !isSettings); } // Standalone fallback: