A platform for community discussion. Free, open, simple.
DEV: Horizon sync for 2025-06-23 (#33304)
Martin Brennan1b4d8843038f
diff --git a/themes/horizon/common/common.scss b/themes/horizon/common/common.scssindex 67e56337b57..5eec6defaaa 100644--- a/themes/horizon/common/common.scss+++ b/themes/horizon/common/common.scss@@ -1,6 +1,7 @@@import "box-view";@import "buttons";@import "chat";+@import "categories-view";@import "color-choice";@import "composer";@import "composer-peek-mode";diff --git a/themes/horizon/javascripts/discourse/components/card/topic-activity-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-activity-column.gjsindex 7c7207aedbd..7eb20d7b6d8 100644--- a/themes/horizon/javascripts/discourse/components/card/topic-activity-column.gjs+++ b/themes/horizon/javascripts/discourse/components/card/topic-activity-column.gjs@@ -1,6 +1,5 @@import Component from "@glimmer/component";import concatClass from "discourse/helpers/concat-class";-import icon from "discourse/helpers/d-icon";import formatDate from "discourse/helpers/format-date";export default class TopicActivityColumn extends Component {diff --git a/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjsindex b168a63b718..e5e79be1b35 100644--- a/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjs+++ b/themes/horizon/javascripts/discourse/components/card/topic-replies-column.gjs@@ -1,9 +1,12 @@import { gt } from "truth-helpers";import icon from "discourse/helpers/d-icon";+import number from "discourse/helpers/number";const TopicRepliesColumn = <template>{{#if (gt @topic.replyCount 1)}}- <span class="topic-replies">{{icon "reply"}}{{@topic.posts_count}}</span>+ <span class="topic-replies">{{icon "reply"}}{{number+ @topic.posts_count+ }}</span>{{/if}}</template>;diff --git a/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjsindex d81b3f50e2d..d9c5ed344f8 100644--- a/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs+++ b/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs@@ -30,7 +30,9 @@ export default class TopicStatusColumn extends Component {{{#if this.badge}}<span class="topic-status-card {{this.badge.className}}">{{iconthis.badge.icon- }}<p class="topic-status-card__name">{{i18n (themePrefix this.badge.text)}}</p></span>+ }}<p class="topic-status-card__name">{{i18n+ (themePrefix this.badge.text)+ }}</p></span>{{/if}}</template>}diff --git a/themes/horizon/scss/categories-view.scss b/themes/horizon/scss/categories-view.scssnew file mode 100644index 00000000000..6945dfecdfe--- /dev/null+++ b/themes/horizon/scss/categories-view.scss@@ -0,0 +1,357 @@+@use "lib/viewport";++.categories-and-latest {+ .category-list {+ border-collapse: separate;++ th.topics {+ display: none;+ }++ thead tr th {+ font-size: var(--font-up-1-rem);+ font-weight: bold;+ }++ tbody {+ display: flex;+ flex-direction: column;+ gap: 1em;+ padding-top: 1em;+ border: 0;+ }++ tbody tr {+ display: grid;+ grid-template-areas:+ "title topics"+ "category category"+ "subcategory subcategory";+ row-gap: 1em;+ border: 1px solid var(--primary-300);+ border-radius: var(--d-border-radius-large);+ box-shadow: 0 0 12px 1px var(--topic-card-shadow);+ }++ td.category {+ display: contents;+ border-top-left-radius: var(--d-border-radius-large);+ border-bottom-left-radius: var(--d-border-radius-large);+ border-width: 2px;+ padding: 1em 1.5rem;+ }++ tbody h3 {+ grid-area: title;+ padding: 1em 0 0 1.5rem;+ font-size: var(--font-up-1-rem);++ .category-name {+ display: flex;+ align-self: center;+ }++ .badge-category {+ gap: 0.25em;+ align-items: center;+ font-size: var(--font-up-1-rem);++ .d-icon:first-of-type:not(.d-icon-lock),+ &.--style-square::before,+ &.--style-emoji .emoji {+ width: 1.25em;+ height: 1.25em;+ margin-right: 0.25em;+ }++ &.--style-square::before {+ border-radius: 6px;+ }+ }++ .d-icon.d-icon-lock {+ order: 1;+ }+ }++ .topics {+ width: auto;+ padding: 1em 1.5rem 0 0;+ display: flex;+ align-items: center;+ justify-content: end;+ }++ .category-description {+ grid-area: category;+ padding: 0 1.5rem;+ margin: 0;+ font-size: var(--font-down-1-rem);+ }++ .subcategories {+ grid-area: subcategory;+ gap: 0.25em 0.5em;+ padding: 0 1.5rem 1em;+ margin: 0;++ .badge-category__wrapper {+ background-color: light-dark(+ oklch(from var(--category-badge-color) 98% calc(c * 0.2) h),+ oklch(from var(--category-badge-color) 45% calc(c * 0.5) h)+ );+ padding: 0.25em 0.5rem;+ border-radius: var(--d-border-radius);+ }++ .badge-category__name {+ color: light-dark(+ oklch(from var(--category-badge-color) 20% calc(c * 1) h),+ oklch(from var(--category-badge-color) 100% calc(c * 0.9) h)+ );+ }++ .badge-category.--style-square::before {+ border-radius: 3px;+ }+ }+ }++ .latest-topic-list {+ .table-heading {+ border: 0;+ font-size: var(--font-up-1-rem);+ font-weight: bold;+ }++ &-item {+ display: grid;+ grid-template-columns: min-content min-content auto min-content;+ grid-template-areas:+ "creator title title status"+ ". category activity activity";+ grid-column-gap: 0.75rem;+ grid-row-gap: 0.5rem;+ background: var(--d-content-background);+ box-shadow: 0 0 12px 1px var(--topic-card-shadow);+ text-overflow: ellipsis;+ padding: 0.75em 1rem;+ border: 1px solid var(--primary-300);+ border-radius: var(--d-border-radius-large);+ margin-top: 1em;+ }++ .main-link,+ .topic-stats {+ display: contents;+ }++ .top-row {+ grid-area: title;+ }++ .bottom-row {+ grid-area: category;++ .discourse-tags {+ display: none;+ }+ }++ .badge-category__wrapper {+ border-radius: var(--d-border-radius);+ padding: 0.25em 0.5rem;+ background-color: light-dark(+ oklch(from var(--category-badge-color) 97% calc(c * 0.3) h),+ oklch(from var(--category-badge-color) 45% calc(c * 0.5) h)+ );++ @include viewport.until(md) {+ padding: 0.25em 0.5rem;+ font-size: var(--font-down-2);+ }++ .badge-category__name {+ color: light-dark(+ oklch(from var(--category-badge-color) 20% calc(c * 1) h),+ oklch(from var(--category-badge-color) 100% calc(c * 0.9) h)+ );+ }+ }++ .topic-list-data {+ grid-area: likes-replies;+ }++ .num.posts-map {+ display: none;+ }++ .topic-last-activity {+ grid-area: activity;+ display: flex;+ align-items: center;+ text-align: left;+ font-size: var(--font-down-1-rem);++ &::before {+ content: "";+ display: inline-block;+ width: 0.25em;+ height: 0.25em;+ background-color: var(--primary-500);+ border-radius: 100%;+ margin-right: 0.5em;+ }+ }++ .topic-poster {+ grid-area: creator;+ width: auto;+ align-self: flex-start;++ .avatar {+ height: 24px;+ width: 24px;+ border-radius: var(--d-border-radius-small);+ }+ }+ }+}++@include viewport.until(sm) {+ .category-list.with-topics {+ margin-inline: 1rem;++ .num.posts,+ .category-topics-count {+ display: none;+ }++ .category-list {+ &-item {+ padding-top: 0;+ padding-bottom: 0;+ border-top: 0 !important;+ border-bottom: 0 !important;+ }+ }++ tbody {+ display: flex;+ flex-direction: column;++ tr:first-of-type {+ order: -2;+ }++ tr.subcategories-list {+ order: -1;+ }++ tr:nth-last-of-type(2) {+ border-bottom: 0;+ }+ }++ th.main-link {+ padding-top: 0;+ }+ }+}++.category-boxes.with-subcategories {+ @include viewport.from(sm) {+ margin-top: 0;+ }++ @include viewport.until(md) {+ padding-inline: 1rem;+ box-sizing: border-box;+ }++ .category {+ border: 0;++ &-box-inner {+ border-radius: var(--d-border-radius-large);+ border: 1px solid var(--primary-300);+ background: var(--d-content-background);+ box-shadow: 0 0 12px 1px var(--topic-card-shadow);++ &:hover {+ .discourse-no-touch & {+ border-color: var(--accent-color);+ background: var(--d-content-background);+ }+ }++ &.selected {+ box-shadow:+ 0 0 0 2px var(--accent-color),+ 0 0 12px 1px var(--topic-card-shadow);+ }+ }++ &-details {+ display: flex;+ flex-direction: column;+ gap: 1rem;+ height: 100%;+ }++ &-box-heading {+ h3 {+ text-align: left;+ }++ .badge-category {+ display: flex;+ flex-wrap: wrap;+ align-items: flex-start;+ gap: 1em;+ justify-content: space-between;+ width: 100%;++ &__wrapper {+ display: flex;+ }++ &.--style-square::before {+ aspect-ratio: 1 / 1;+ height: auto;+ width: 13%;+ border-radius: var(--d-border-radius);+ }++ &__name {+ flex-basis: 100%;+ font-size: var(--font-up-1-rem);+ }++ .d-icon:not(.d-icon-lock),+ img.emoji {+ aspect-ratio: 1 / 1;+ height: auto;+ width: 13%;+ }+ }+ }++ .description {+ text-align: left;+ margin: 0;+ font-size: var(--font-down-1-rem);+ }++ .subcategories {+ margin-top: auto;+ row-gap: 0.5em;++ .subcategory {+ margin-bottom: 0;+ font-size: var(--font-down-1);+ }+ }+ }+}diff --git a/themes/horizon/scss/hiddenstuff.scss b/themes/horizon/scss/hiddenstuff.scssindex a29df8c0b98..d4e5538fa3b 100644--- a/themes/horizon/scss/hiddenstuff.scss+++ b/themes/horizon/scss/hiddenstuff.scss@@ -2,8 +2,6 @@.list-controls #create-topic,.notifications-button-footer .reason .text,.pinned-button .reason .text,-.more-topics__browse-more,-// footer-message might cause issues, not sure what possible stuff can be in there, but the general idea is to hide it bcs having an ugly H3 (what?) CTA at the bottom is just… ugly imo-.footer-message {+.more-topics__browse-more {display: none;}diff --git a/themes/horizon/scss/main.scss b/themes/horizon/scss/main.scssindex 919945a052d..9ff34f4e168 100644--- a/themes/horizon/scss/main.scss+++ b/themes/horizon/scss/main.scss@@ -98,6 +98,10 @@ body:not(.has-full-page-chat, .wizard) {}}+.welcome-banner {+ display: none;+}+#list-area {.show-more.has-topics {@include viewport.from(lg) {diff --git a/themes/horizon/scss/topic-cards.scss b/themes/horizon/scss/topic-cards.scssindex f9755973968..56b1141293b 100644--- a/themes/horizon/scss/topic-cards.scss+++ b/themes/horizon/scss/topic-cards.scss@@ -16,18 +16,55 @@}}+.topic-list,+.category-boxes .subcategories {+ .badge-category__wrapper {+ border-radius: var(--d-border-radius);+ padding: 3px 6px;+ background-color: light-dark(+ oklch(from var(--category-badge-color) 97% calc(c * 0.3) h),+ oklch(from var(--category-badge-color) 45% calc(c * 0.5) h)+ );++ @include viewport.until(md) {+ padding: 2px 6px;+ font-size: var(--font-down-2);+ }++ .badge-category__name {+ color: light-dark(+ oklch(from var(--category-badge-color) 20% calc(c * 1) h),+ oklch(from var(--category-badge-color) 100% calc(c * 0.9) h)+ );+ }+ }+}++// undo all the above for the few instances that arent styled like traditional badges+.category-text-title {+ .badge-category__wrapper {+ border-radius: 0;+ padding: 0;+ background-color: transparent;++ .badge-category__name {+ color: var(--primary);+ }+ }+}+.topic-list-body {border: none;display: flex;flex-direction: column;gap: 1.25em;- @include breakpoint(medium) {+ @include viewport.until(lg) {gap: 0.5em;padding: 0 0.5em;}- @include breakpoint(mobile-extra-large) {+ @include viewport.until(sm) {gap: 0;padding: 0;}@@ -90,6 +127,12 @@grid-template-areas:"bulk-select creator title title title status""bulk-select category category activity likes-replies likes-replies";++ @include viewport.until(sm) {+ grid-template-areas:+ "bulk-select creator title title title status"+ "bulk-select . category likes-replies activity . ";+ }}@include viewport.until(sm) {@@ -98,14 +141,6 @@"bulk-select creator title title title status""bulk-select . category activity activity . ";}-- &.has-replies {- @include viewport.until(sm) {- grid-template-areas:- "bulk-select creator title title title status"- "bulk-select . category likes-replies activity . ";- }- }}&:hover {@@ -204,7 +239,7 @@oklch(from var(--category-badge-color) 45% calc(c * 0.5) h));- @include breakpoint(tablet) {+ @include viewport.until(md) {padding: 0.25em 0.5rem;font-size: var(--font-down-2);}@@ -308,6 +343,7 @@align-items: center;padding: 0.2em 0.5rem;font-size: var(--font-down-2);+@include viewport.from(lg) {font-size: var(--font-down-3);}@@ -340,6 +376,7 @@svg {color: var(--status-color);+@include viewport.from(lg) {font-size: var(--font-down-1);}@@ -461,7 +498,6 @@.topic-status-data {display: none;}-grid-template-areas:"creator title title title dropdown"". category activity activity .";@@ -529,6 +565,7 @@grid-template-areas:"creator title title title dropdown""category category activity metadata . ";+@include viewport.until(sm) {grid-template-areas:"metadata metadata metadata metadata dropdown"@@ -631,6 +668,12 @@}}+// bulk-select overrule for j/k nav+.topic-list tr.selected td:first-of-type,+.topic-list-item.selected td:first-of-type {+ box-shadow: none;+}+// User Messagesbody.user-messages-page {.topic-list-body {@@ -653,6 +696,10 @@ body.user-messages-page {grid-template-columns: auto auto;grid-template-rows: auto auto;+ &.has-replies {+ grid-template-areas: "title activity" "posters .";+ }+&:hover {.discourse-no-touch & {background-color: var(--primary-low);diff --git a/themes/horizon/spec/system/horizon_high_level_spec.rb b/themes/horizon/spec/system/horizon_high_level_spec.rbindex 5592295bfe2..6b0a96ac4c8 100644--- a/themes/horizon/spec/system/horizon_high_level_spec.rb+++ b/themes/horizon/spec/system/horizon_high_level_spec.rb@@ -36,9 +36,7 @@ describe "Horizon theme | High level", type: :system doexpect(topic_item.all("td").map { |el| el["class"] }).to eq(["main-link topic-list-data",- "topic-status-data","topic-category-data",- "topic-likes-replies-data","topic-creator-data","topic-activity-data",],@@ -50,7 +48,7 @@ describe "Horizon theme | High level", type: :system do# Can change site colors from the sidebar palette, which are remembered# across page reloads.- marigold_palette = ColorScheme.find_by(name: "Marigold")+ marigold_palette = theme.color_schemes.find_by(name: "Marigold")palette_selector.open_palette_menupalette_selector.click_palette_menu_item(marigold_palette.name)expect(palette_selector).to have_no_palette_menudiff --git a/themes/horizon/spec/system/page_objects/components/user_color_palette_selector.rb b/themes/horizon/spec/system/page_objects/components/user_color_palette_selector.rbindex 7d569c58471..6d96bb4c113 100644--- a/themes/horizon/spec/system/page_objects/components/user_color_palette_selector.rb+++ b/themes/horizon/spec/system/page_objects/components/user_color_palette_selector.rb@@ -26,7 +26,9 @@ module PageObjectsenddef has_selected_palette?(palette)- has_css?(".user-color-palette-selector[data-selected-color-palette-id='#{palette.id}']")+ has_css?(+ ".user-color-palette-selector-trigger[data-selected-color-palette-id=\"#{palette.id}\"]",+ )enddef has_loaded_css?diff --git a/themes/horizon/spec/system/user_color_palette_selector_spec.rb b/themes/horizon/spec/system/user_color_palette_selector_spec.rbindex 2731034c788..5cceaa17a0f 100644--- a/themes/horizon/spec/system/user_color_palette_selector_spec.rb+++ b/themes/horizon/spec/system/user_color_palette_selector_spec.rb@@ -6,7 +6,7 @@ describe "Horizon theme | User color palette selector", type: :system dolet(:set_theme_as_default) { true }let!(:theme) dohorizon_theme = upload_theme(set_theme_as_default: set_theme_as_default)- ColorScheme.where(theme_id: horizon_theme.id).update_all(user_selectable: true)+ horizon_theme.color_schemes.update_all(user_selectable: true)horizon_themeendfab!(:current_user) { Fabricate(:user) }@@ -16,8 +16,8 @@ describe "Horizon theme | User color palette selector", type: :system dolet(:interface_color_selector) doPageObjects::Components::InterfaceColorSelector.new(".sidebar-footer-actions")end- let(:marigold_palette) { ColorScheme.find_by(name: "Marigold") }- let(:marigold_palette_dark) { ColorScheme.find_by(name: "Marigold Dark") }+ let(:marigold_palette) { theme.color_schemes.find_by(name: "Marigold") }+ let(:marigold_palette_dark) { theme.color_schemes.find_by(name: "Marigold Dark") }before { SiteSetting.interface_color_selector = "sidebar_footer" }