Skip to content

A platform for community discussion. Free, open, simple.

DEV: Refactor Horizon topic cards to use listContext instead of route checks (#37355)

Régis Hanolf068c56c1b46
diff --git a/frontend/discourse/app/components/basic-topic-list.gjs b/frontend/discourse/app/components/basic-topic-list.gjs
index 05ce1df88b1..b93714a918d 100644
--- a/frontend/discourse/app/components/basic-topic-list.gjs
+++ b/frontend/discourse/app/components/basic-topic-list.gjs
@@ -105,6 +105,7 @@ export default class BasicTopicList extends Component {
@order={{this.order}}
@ascending={{this.ascending}}
@focusLastVisitedTopic={{this.focusLastVisitedTopic}}
+ @listContext={{this.listContext}}
/>
{{else}}
{{#unless this.loadingMore}}
diff --git a/frontend/discourse/app/components/discovery/topics.gjs b/frontend/discourse/app/components/discovery/topics.gjs
index 071a18ff2d9..672ff83f7b9 100644
--- a/frontend/discourse/app/components/discovery/topics.gjs
+++ b/frontend/discourse/app/components/discovery/topics.gjs
@@ -195,6 +195,7 @@ export default class DiscoveryTopics extends Component {
@category={{@category}}
@topics={{@model.sharedDrafts}}
@discoveryList={{true}}
+ @listContext="discovery"
class="shared-drafts"
/>
{{/if}}
@@ -273,6 +274,7 @@ export default class DiscoveryTopics extends Component {
@topics={{@model.topics}}
@discoveryList={{true}}
@focusLastVisitedTopic={{true}}
+ @listContext="discovery"
/>
<LoadMore @action={{this.loadMore}} />
diff --git a/frontend/discourse/app/components/related-messages.gjs b/frontend/discourse/app/components/related-messages.gjs
index e603d2fd58a..37949d9915c 100644
--- a/frontend/discourse/app/components/related-messages.gjs
+++ b/frontend/discourse/app/components/related-messages.gjs
@@ -53,6 +53,7 @@ export default class RelatedMessages extends Component {
@topics={{@topic.relatedMessages}}
@hideCategory={{true}}
@showPosters={{true}}
+ @listContext="related"
/>
</div>
diff --git a/frontend/discourse/app/components/suggested-topics.gjs b/frontend/discourse/app/components/suggested-topics.gjs
index 4d0fdc8b84b..300792b0bfd 100644
--- a/frontend/discourse/app/components/suggested-topics.gjs
+++ b/frontend/discourse/app/components/suggested-topics.gjs
@@ -41,9 +41,13 @@ export default class SuggestedTopics extends Component {
@topics={{@topic.suggestedTopics}}
@hideCategory={{true}}
@showPosters={{true}}
+ @listContext="suggested"
/>
{{else}}
- <BasicTopicList @topics={{@topic.suggestedTopics}} />
+ <BasicTopicList
+ @topics={{@topic.suggestedTopics}}
+ @listContext="suggested"
+ />
{{/if}}
</div>
</div>
diff --git a/frontend/discourse/app/components/topic-list/item.gjs b/frontend/discourse/app/components/topic-list/item.gjs
index ba9865e1b18..5b027dfa0a4 100644
--- a/frontend/discourse/app/components/topic-list/item.gjs
+++ b/frontend/discourse/app/components/topic-list/item.gjs
@@ -216,6 +216,7 @@ export default class Item extends Component {
{
event,
topic: this.args.topic,
+ listContext: this.args.listContext,
navigateToTopic: this.navigateToTopic,
}
);
@@ -235,7 +236,7 @@ export default class Item extends Component {
return applyValueTransformer(
"topic-list-item-mobile-layout",
this.site.mobileView,
- { topic: this.args.topic }
+ { topic: this.args.topic, listContext: this.args.listContext }
);
}
@@ -243,6 +244,7 @@ export default class Item extends Component {
return applyValueTransformer("topic-list-item-class", [], {
topic: this.args.topic,
index: this.args.index,
+ listContext: this.args.listContext,
});
}
@@ -250,6 +252,7 @@ export default class Item extends Component {
const parts = applyValueTransformer("topic-list-item-style", [], {
topic: this.args.topic,
index: this.args.index,
+ listContext: this.args.listContext,
});
const safeParts = parts.filter(Boolean).filter((part) => {
diff --git a/frontend/discourse/app/components/topic-list/list.gjs b/frontend/discourse/app/components/topic-list/list.gjs
index 1f37a9d7363..f78f4abd8b7 100644
--- a/frontend/discourse/app/components/topic-list/list.gjs
+++ b/frontend/discourse/app/components/topic-list/list.gjs
@@ -93,6 +93,10 @@ export default class TopicList extends Component {
const self = this;
const context = {
+ get listContext() {
+ return self.args.listContext;
+ },
+
get category() {
return self.topicTrackingState.get("filterCategory");
},
@@ -178,6 +182,7 @@ export default class TopicList extends Component {
get additionalClasses() {
return applyValueTransformer("topic-list-class", [], {
topics: this.args.topics,
+ listContext: this.args.listContext,
});
}
@@ -239,6 +244,7 @@ export default class TopicList extends Component {
@tagsForUser={{@tagsForUser}}
@focusLastVisitedTopic={{@focusLastVisitedTopic}}
@index={{index}}
+ @listContext={{@listContext}}
/>
{{#if (eq topic this.lastVisitedTopic)}}
diff --git a/frontend/discourse/app/controllers/user-topics-list.js b/frontend/discourse/app/controllers/user-topics-list.js
index 684975b3c3a..a6710a88675 100644
--- a/frontend/discourse/app/controllers/user-topics-list.js
+++ b/frontend/discourse/app/controllers/user-topics-list.js
@@ -18,6 +18,7 @@ import { QUERY_PARAMS } from "discourse/routes/user-topic-list";
// Lists of topics on a user's page.
export default class UserTopicsListController extends Controller {
@tracked model;
+ @tracked listContext = "user-activity";
hideCategory = false;
showPosters = false;
diff --git a/frontend/discourse/app/routes/build-private-messages-route.js b/frontend/discourse/app/routes/build-private-messages-route.js
index 9a92402a441..aa763a12ccb 100644
--- a/frontend/discourse/app/routes/build-private-messages-route.js
+++ b/frontend/discourse/app/routes/build-private-messages-route.js
@@ -66,6 +66,7 @@ export default (inboxType, path, filter) => {
filter,
group: null,
inbox: inboxType,
+ listContext: "messages",
});
let ascending = userTopicsListController.ascending;
diff --git a/frontend/discourse/app/routes/user-topic-list.js b/frontend/discourse/app/routes/user-topic-list.js
index 47d8083c2f9..61d1d2394b7 100644
--- a/frontend/discourse/app/routes/user-topic-list.js
+++ b/frontend/discourse/app/routes/user-topic-list.js
@@ -20,6 +20,7 @@ export default class UserTopicsListRoute extends DiscourseRoute {
controller.setProperties({
model,
hideCategory: false,
+ listContext: "user-activity",
});
}
}
diff --git a/frontend/discourse/app/templates/group/activity/topics.gjs b/frontend/discourse/app/templates/group/activity/topics.gjs
index d742d5e7766..b269e112b02 100644
--- a/frontend/discourse/app/templates/group/activity/topics.gjs
+++ b/frontend/discourse/app/templates/group/activity/topics.gjs
@@ -4,7 +4,11 @@ import LoadMore from "discourse/components/load-more";
export default <template>
<LoadMore @action={{@controller.loadMore}} class="paginated-topics-list">
- <BasicTopicList @topicList={{@controller.model}} @showPosters={{true}} />
+ <BasicTopicList
+ @topicList={{@controller.model}}
+ @showPosters={{true}}
+ @listContext="group-activity"
+ />
<ConditionalLoadingSpinner @condition={{@controller.model.loadingMore}} />
</LoadMore>
</template>
diff --git a/frontend/discourse/app/templates/user-topics-list.gjs b/frontend/discourse/app/templates/user-topics-list.gjs
index 779386130b9..ef7b3e0caf3 100644
--- a/frontend/discourse/app/templates/user-topics-list.gjs
+++ b/frontend/discourse/app/templates/user-topics-list.gjs
@@ -69,6 +69,7 @@ export default <template>
@order={{@controller.order}}
@ascending={{@controller.ascending}}
@focusLastVisitedTopic={{true}}
+ @listContext={{@controller.listContext}}
/>
<TopicDismissButtons
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/initializers/related-topics.gjs b/plugins/discourse-ai/assets/javascripts/discourse/initializers/related-topics.gjs
index 5f8572e9ede..0dcce5772f8 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/initializers/related-topics.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/initializers/related-topics.gjs
@@ -15,7 +15,7 @@ const RelatedTopics = <template>
{{icon "discourse-sparkles"}}{{i18n "discourse_ai.related_topics.title"}}
</h3>
<div class="topics">
- <BasicTopicList @topics={{@topic.relatedTopics}} />
+ <BasicTopicList @topics={{@topic.relatedTopics}} @listContext="related" />
</div>
</div>
</template>;
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/templates/group/assigned/show.gjs b/plugins/discourse-assign/assets/javascripts/discourse/templates/group/assigned/show.gjs
index 932119b4a27..6a8a88f8c10 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/templates/group/assigned/show.gjs
+++ b/plugins/discourse-assign/assets/javascripts/discourse/templates/group/assigned/show.gjs
@@ -44,6 +44,7 @@ export default <template>
@reassign={{@controller.reassign}}
@onScroll={{@controller.saveScrollPosition}}
@scrollOnLoad={{true}}
+ @listContext="assigned"
/>
<ConditionalLoadingSpinner @condition={{@controller.model.loadingMore}} />
diff --git a/plugins/discourse-assign/assets/javascripts/discourse/templates/user-activity/assigned.gjs b/plugins/discourse-assign/assets/javascripts/discourse/templates/user-activity/assigned.gjs
index 4080c589e91..70e8f361c45 100644
--- a/plugins/discourse-assign/assets/javascripts/discourse/templates/user-activity/assigned.gjs
+++ b/plugins/discourse-assign/assets/javascripts/discourse/templates/user-activity/assigned.gjs
@@ -47,6 +47,7 @@ export default <template>
@reassign={{@controller.reassign}}
@onScroll={{@controller.saveScrollPosition}}
@scrollOnLoad={{true}}
+ @listContext="assigned"
/>
<ConditionalLoadingSpinner @condition={{@controller.model.loadingMore}} />
diff --git a/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs b/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs
index 9e9b21b7e38..f95f357f4ff 100644
--- a/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs
+++ b/themes/horizon/javascripts/discourse/components/card/high-context-topic-card.gjs
@@ -20,6 +20,7 @@ import topicFeaturedLink from "discourse/helpers/topic-featured-link";
import { shortDateNoYear } from "discourse/lib/formatter";
import { or } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
+import { getTopicStatusBadge } from "../../lib/topic-status-badge";
export default class HighContextTopicCard extends Component {
@service capabilities;
@@ -69,7 +70,7 @@ export default class HighContextTopicCard extends Component {
}
get hasReplies() {
- return this.args.topic.posts_count > 1;
+ return this.args.topic.replyCount > 0;
}
get hasLikes() {
@@ -93,21 +94,7 @@ export default class HighContextTopicCard extends Component {
}
get statusBadge() {
- if (this.args.topic.is_hot) {
- return {
- icon: "fire",
- text: "topic_statuses.hot.title",
- className: "--hot",
- };
- }
- if (this.args.topic.pinned || this.args.topic.pinned_globally) {
- return {
- icon: "thumbtack",
- text: "topic_statuses.pinned.title",
- className: "--pinned",
- };
- }
- return null;
+ return getTopicStatusBadge(this.args.topic);
}
get topicCreator() {
@@ -136,8 +123,16 @@ export default class HighContextTopicCard extends Component {
}
<template>
+ {{#if @bulkSelectEnabled}}
+ <BulkSelectCheckbox
+ @topic={{@topic}}
+ @isSelected={{@isSelected}}
+ @onToggle={{@onBulkSelectToggle}}
+ class="hc-topic-card__bulk-select"
+ />
+ {{/if}}
+
<td class="hc-topic-card">
- {{! ROW 1: Creator info + Category + Status }}
<div class="hc-topic-card__header">
<div class="hc-topic-card__op">
<div class="hc-topic-card__avatar">
@@ -185,17 +180,8 @@ export default class HighContextTopicCard extends Component {
</div>
</div>
- {{! ROW 2: Title + Excerpt }}
<div class="hc-topic-card__content">
<div class="hc-topic-card__title">
- {{#if @bulkSelectEnabled}}
- <BulkSelectCheckbox
- @topic={{@topic}}
- @isSelected={{@isSelected}}
- @onToggle={{@onBulkSelectToggle}}
- class="hc-topic-card__bulk-select"
- />
- {{/if}}
<TopicStatus @topic={{@topic}} @context="topic-list" />
<TopicLink
{{on "focus" this.onTitleFocus}}
@@ -219,8 +205,6 @@ export default class HighContextTopicCard extends Component {
{{/if}}
</div>
- {{! ROW 3: Last Reply + Assigned }}
-
{{#if (or this.hasReplies this.hasAssigned)}}
<div class="hc-topic-card__context">
{{#if this.hasReplies}}
@@ -259,7 +243,6 @@ export default class HighContextTopicCard extends Component {
</div>
{{/if}}
- {{! ROW 4: Stats + Last Reply }}
<div class="hc-topic-card__footer">
<div class="hc-topic-card__category-tags">
{{#unless @hideCategory}}
diff --git a/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs b/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs
index 38e50184d21..b229413bd81 100644
--- a/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs
+++ b/themes/horizon/javascripts/discourse/components/card/topic-status-column.gjs
@@ -1,26 +1,11 @@
import Component from "@glimmer/component";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
+import { getTopicStatusBadge } from "../../lib/topic-status-badge";
export default class TopicStatusColumn extends Component {
get badge() {
- if (this.args.topic.is_hot) {
- return {
- icon: "fire",
- text: "topic_statuses.hot.title",
- className: "--hot",
- };
- }
-
- if (this.args.topic.pinned) {
- return {
- icon: "thumbtack",
- text: "topic_statuses.pinned.title",
- className: "--pinned",
- };
- }
-
- return null;
+ return getTopicStatusBadge(this.args.topic);
}
<template>
diff --git a/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs b/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs
index 6744d28d8ab..4036ac604db 100644
--- a/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs
+++ b/themes/horizon/javascripts/discourse/initializers/topic-list-columns.gjs
@@ -1,4 +1,5 @@
import { settings } from "virtual:theme";
+import HeaderTopicCell from "discourse/components/topic-list/header/topic-cell";
import { withPluginApi } from "discourse/lib/plugin-api";
import HighContextTopicCard from "../components/card/high-context-topic-card";
import TopicActivityColumn from "../components/card/topic-activity-column";
@@ -7,6 +8,22 @@ import TopicCreatorColumn from "../components/card/topic-creator-column";
import TopicRepliesColumn from "../components/card/topic-replies-column";
import TopicStatusColumn from "../components/card/topic-status-column";
+const TOPIC_CARD_CONTEXTS = [
+ "discovery",
+ "suggested",
+ "related",
+ "group-activity",
+ "user-activity",
+];
+
+const SIMPLE_CARD_CONTEXTS = ["suggested", "related"];
+
+const isTopicCardContext = (listContext) =>
+ TOPIC_CARD_CONTEXTS.includes(listContext);
+
+const isSimpleCardContext = (listContext) =>
+ SIMPLE_CARD_CONTEXTS.includes(listContext);
+
const TopicActivity = <template>
<td class="topic-activity-data">
<TopicActivityColumn @topic={{@topic}} />
@@ -37,25 +54,6 @@ const TopicCreator = <template>
</td>
</template>;
-function isHighContextRoute(routeName) {
- if (!routeName) {
- return false;
- }
-
- // Only show high context cards on public topic list routes
- // Discovery routes: /latest, /new, /unread, /top, /hot, /c/:category
- if (routeName.startsWith("discovery")) {
- return true;
- }
-
- // Tag routes: /tag/:tag_name
- if (routeName.startsWith("tag")) {
- return true;
- }
-
- return false;
-}
-
const HighContextCard = <template>
<HighContextTopicCard
@topic={{@topic}}
@@ -69,9 +67,8 @@ const HighContextCard = <template>
export default {
name: "topic-list-customizations",
- initialize(container) {
+ initialize() {
const isHighContext = settings.topic_card_high_context;
- const router = container.lookup("service:router");
function applySimpleLayout(columns) {
columns.add("topic-status", {
@@ -94,37 +91,48 @@ export default {
columns.delete("views");
columns.delete("replies");
- if (!router.currentRouteName.includes("userPrivateMessages")) {
- columns.add("topic-activity", {
- item: TopicActivity,
- after: "title",
- });
- columns.delete("posters");
- columns.delete("activity");
- }
+ columns.add("topic-activity", {
+ item: TopicActivity,
+ after: "title",
+ });
+ columns.delete("posters");
+ columns.delete("activity");
}
function applyHighContextLayout(columns) {
- columns.delete("bulk-select");
columns.delete("topic");
columns.delete("posters");
columns.delete("replies");
columns.delete("views");
columns.delete("activity");
columns.add("high-context-card", {
+ header: HeaderTopicCell,
item: HighContextCard,
});
}
withPluginApi((api) => {
+ api.registerValueTransformer(
+ "topic-list-class",
+ ({ value: classes, context }) => {
+ if (isTopicCardContext(context.listContext)) {
+ classes.push("--d-topic-cards");
+ }
+ return classes;
+ }
+ );
+
api.registerValueTransformer(
"topic-list-columns",
- ({ value: columns }) => {
- if (isHighContext && isHighContextRoute(router.currentRouteName)) {
- applyHighContextLayout(columns);
- } else {
- applySimpleLayout(columns);
+ ({ value: columns, context }) => {
+ if (!isTopicCardContext(context.listContext)) {
+ return columns;
}
+
+ isHighContext && !isSimpleCardContext(context.listContext)
+ ? applyHighContextLayout(columns)
+ : applySimpleLayout(columns);
+
return columns;
}
);
@@ -132,20 +140,18 @@ export default {
api.registerValueTransformer(
"topic-list-item-class",
({ value: classes, context }) => {
- // has-replies is needed for grid layout on all routes (including PMs)
- if (context.topic.replyCount > 1) {
- classes.push("has-replies");
- }
-
- // The rest only applies to public topic list routes
- if (!isHighContextRoute(router.currentRouteName)) {
+ if (!isTopicCardContext(context.listContext)) {
return classes;
}
- if (isHighContext) {
+ if (isHighContext && !isSimpleCardContext(context.listContext)) {
classes.push("--high-context");
}
+ if (context.topic.replyCount > 1) {
+ classes.push("--has-replies");
+ }
+
if (
context.topic.is_hot ||
context.topic.pinned ||
@@ -158,19 +164,22 @@ export default {
}
);
- // Force desktop layout on public topic lists for Horizon card styling.
- // Return undefined on other routes to preserve default mobile/desktop behavior.
- api.registerValueTransformer("topic-list-item-mobile-layout", () => {
- if (isHighContextRoute(router.currentRouteName)) {
- return false;
+ // Disable mobile layout for topic card contexts
+ api.registerValueTransformer(
+ "topic-list-item-mobile-layout",
+ ({ value, context }) => {
+ if (isTopicCardContext(context.listContext)) {
+ return false;
+ }
+ return value;
}
- });
+ );
api.registerBehaviorTransformer(
"topic-list-item-click",
- ({ context: { event }, next }) => {
- if (!isHighContextRoute(router.currentRouteName)) {
- return next(); // Use default behavior on non-public routes
+ ({ context: { event, listContext }, next }) => {
+ if (!isTopicCardContext(listContext)) {
+ return next();
}
if (event.target.closest("a, button, input")) {
diff --git a/themes/horizon/javascripts/discourse/lib/topic-status-badge.js b/themes/horizon/javascripts/discourse/lib/topic-status-badge.js
new file mode 100644
index 00000000000..48fbc4f270e
--- /dev/null
+++ b/themes/horizon/javascripts/discourse/lib/topic-status-badge.js
@@ -0,0 +1,19 @@
+export function getTopicStatusBadge(topic) {
+ if (topic.is_hot) {
+ return {
+ icon: "fire",
+ text: "topic_statuses.hot.title",
+ className: "--hot",
+ };
+ }
+
+ if (topic.pinned || topic.pinned_globally) {
+ return {
+ icon: "thumbtack",
+ text: "topic_statuses.pinned.title",
+ className: "--pinned",
+ };
+ }
+
+ return null;
+}
diff --git a/themes/horizon/scss/categories-view.scss b/themes/horizon/scss/categories-view.scss
index c5ba0d40f07..71db5cff773 100644
--- a/themes/horizon/scss/categories-view.scss
+++ b/themes/horizon/scss/categories-view.scss
@@ -97,19 +97,13 @@
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)
- );
+ background-color: var(--badge-category-bg);
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)
- );
+ color: var(--badge-category-text);
}
.badge-category.--style-square::before {
@@ -162,10 +156,7 @@
.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)
- );
+ background-color: var(--badge-category-bg);
@include viewport.until(md) {
padding: 0.25em 0.5rem;
@@ -173,10 +164,7 @@
}
.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)
- );
+ color: var(--badge-category-text);
}
}
diff --git a/themes/horizon/scss/chat.scss b/themes/horizon/scss/chat.scss
index dbac1c0b71e..66abfdd2a4f 100644
--- a/themes/horizon/scss/chat.scss
+++ b/themes/horizon/scss/chat.scss
@@ -33,7 +33,7 @@ body.has-full-page-chat {
}
.c-navbar__title {
- padding-left: 0.33em; // visual alignment for chat index, which does not havea a backarrow
+ padding-left: 0.33em; // visual alignment for chat index, which does not have a back arrow
}
}
diff --git a/themes/horizon/scss/color-exploration.scss b/themes/horizon/scss/color-exploration.scss
deleted file mode 100644
index f9ee730c03b..00000000000
--- a/themes/horizon/scss/color-exploration.scss
+++ /dev/null
@@ -1,26 +0,0 @@
-:root {
- --d-sidebar-highlight-hover-icon: var(--d-sidebar-link-color);
- --d-sidebar-highlight-hover-background: var(--d-selected);
- --d-sidebar-link-icon-color: var(--d-sidebar-link-color);
- --d-sidebar-header-color: var(--d-sidebar-link-color);
- --d-sidebar-header-icon-color: var(--d-sidebar-link-color);
- --d-sidebar-active-suffix-color: var(--d-sidebar-suffix-color);
- --d-sidebar-background: var(--background-color);
- --d-sidebar-footer-fade: rgb(var(--tertiary-50-rgb), 1);
- --d-sidebar-prefix-background: var(--d-selected);
- --d-sidebar-active-prefix-background: light-dark(
- oklch(from var(--d-selected) calc(l * 0.85) c h),
- oklch(from var(--d-selected) calc(l * 0.7) c h)
- );
- --d-sidebar-highlight-prefix-background: light-dark(
- oklch(from var(--d-selected) calc(l * 0.85) c h),
- oklch(from var(--d-selected) calc(l * 0.7) c h)
- );
- --d-sidebar-highlight-suffix-color: var(--d-sidebar-active-suffix-color);
- --d-sidebar-highlight-color: var(--primary);
- --d-sidebar-highlight-background: var(--d-selected);
- --d-sidebar-section-link-icon-size: 1em;
- --d-hover: oklch(from var(--d-selected) l c h / 0.75);
- --d-input-bg-color: var(--d-content-background);
- --d-sidebar-active-color: var(--primary) !important;
-}
diff --git a/themes/horizon/scss/desktop-horizon-fixes.scss b/themes/horizon/scss/desktop-horizon-fixes.scss
index 40c3afbe223..12496bd0329 100644
--- a/themes/horizon/scss/desktop-horizon-fixes.scss
+++ b/themes/horizon/scss/desktop-horizon-fixes.scss
@@ -4,67 +4,72 @@
// Fixing bulk select (only needed for desktop)
.bulk-select-enabled {
- .topic-list-header {
- position: sticky;
- top: 8em;
- height: 0;
- }
+ body:not(.user-messages-page) & {
+ .topic-list-header {
+ position: sticky;
+ top: 8em;
+ height: 0;
+ z-index: 1;
+ }
- .topic-author-avatar-data {
- display: none;
- }
+ .topic-author-avatar-data {
+ display: none;
+ }
- .bulk-select.topic-list-data {
- grid-area: bulk-select;
- margin-left: -0.5em;
+ .bulk-select.topic-list-data {
+ grid-area: bulk-select;
+ margin-left: -0.5em;
- @media screen and (width <= 576px) {
- margin-top: 0;
+ @media screen and (width <= 576px) {
+ margin-top: 0;
- label {
- padding-block: 0.345em;
+ label {
+ padding-block: 0.345em;
+ }
}
- }
- input {
- transform: scale(1.5);
+ input {
+ transform: scale(1.5);
+ }
}
}
}
.topic-list-header {
- tr {
- border: none;
- }
-
- .topic-list-data {
- padding: 0;
-
- &:not(.default) {
- display: none;
+ body:not(.user-messages-page) & {
+ tr {
+ border: none;
}
- &.default {
- .bulk-select,
- span:not(.bulk-select-topics, .d-button-label) {
+ .topic-list-data {
+ padding: 0;
+
+ &:not(.default) {
display: none;
}
- }
- }
- .bulk-select-topics {
- position: absolute;
- right: 0;
- background: var(--secondary);
- border-radius: var(--d-border-radius);
- display: flex;
- gap: 0.5rem;
- margin: var(--space-4) 0;
- padding: var(--space-1);
+ &.default {
+ .bulk-select,
+ span:not(.bulk-select-topics, .d-button-label) {
+ display: none;
+ }
+ }
+
+ .bulk-select-topics {
+ position: absolute;
+ right: 0;
+ background: var(--secondary);
+ border-radius: var(--d-border-radius);
+ display: flex;
+ gap: 0.5rem;
+ margin: var(--space-4) 0;
+ padding: var(--space-1);
- button {
- white-space: nowrap;
- margin: 0;
+ button {
+ white-space: nowrap;
+ margin: 0;
+ }
+ }
}
}
}
diff --git a/themes/horizon/scss/high-context-cards.scss b/themes/horizon/scss/high-context-cards.scss
index 72ced6353da..927ab4a5f1a 100644
--- a/themes/horizon/scss/high-context-cards.scss
+++ b/themes/horizon/scss/high-context-cards.scss
@@ -20,6 +20,10 @@ $padding-pills-small: var(--space-half) var(--space-2);
opacity: 0.9;
}
+ &.bulk-selecting {
+ display: flex;
+ }
+
&.bulk-selected {
background: var(--tertiary-low);
border-color: var(--tertiary);
@@ -39,10 +43,6 @@ $padding-pills-small: var(--space-half) var(--space-2);
}
.bulk-select-enabled & {
- &.bulk-selected {
- background: var(--secondary);
- }
-
> .bulk-select {
display: none;
}
@@ -167,8 +167,13 @@ $padding-pills-small: var(--space-half) var(--space-2);
&__bulk-select {
display: inline-flex;
align-items: center;
- margin-right: var(--space-2);
+ justify-content: center;
+ padding-inline: var(--space-3) 0;
cursor: pointer;
+
+ input {
+ margin: 0;
+ }
}
&__title {
@@ -204,6 +209,7 @@ $padding-pills-small: var(--space-half) var(--space-2);
-webkit-box-orient: vertical;
overflow: hidden;
font-size: var(--font-0);
+ width: 100%;
}
}
diff --git a/themes/horizon/scss/main.scss b/themes/horizon/scss/main.scss
index e96ced45b08..9b1efc22070 100644
--- a/themes/horizon/scss/main.scss
+++ b/themes/horizon/scss/main.scss
@@ -21,8 +21,9 @@ body {
}
#main-outlet-wrapper {
- gap: var(--main-grid-gap);
- padding-right: var(--main-grid-gap);
+ @include viewport.from(lg) {
+ gap: var(--main-grid-gap);
+ }
}
body.has-sidebar-page.has-full-page-chat #main-outlet-wrapper {
@@ -62,14 +63,6 @@ body:not(.has-full-page-chat, .wizard) {
}
#main-outlet-wrapper {
- @include viewport.until(lg) {
- --main-grid-gap: 0em;
- }
-
- @media screen and (width >= 768px) {
- gap: var(--main-grid-gap);
- }
-
#main-outlet {
width: 100%;
max-width: unset;
diff --git a/themes/horizon/scss/mobile-stuff.scss b/themes/horizon/scss/mobile-stuff.scss
index 369f6c188cb..f698a2e8b81 100644
--- a/themes/horizon/scss/mobile-stuff.scss
+++ b/themes/horizon/scss/mobile-stuff.scss
@@ -111,27 +111,16 @@
order: -1;
}
- // make mixin of this
.badge-category__wrapper {
font-size: var(--font-down-2-rem);
border-radius: var(--d-border-radius);
padding: var(--space-1) var(--space-2);
- 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)
- );
- border: 1px solid
- 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)
- );
+ background-color: var(--badge-category-bg);
+ border: 1px solid var(--badge-category-bg);
}
.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)
- );
+ color: var(--badge-category-text);
}
.discourse-tags {
diff --git a/themes/horizon/scss/topic-cards.scss b/themes/horizon/scss/topic-cards.scss
index af3a9152336..0c3fab13542 100644
--- a/themes/horizon/scss/topic-cards.scss
+++ b/themes/horizon/scss/topic-cards.scss
@@ -7,6 +7,21 @@
--topic-card-shadow: rgb(var(--tertiary-rgb), 0.1);
}
+.badge-category__wrapper {
+ --badge-category-bg: 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)
+ );
+ --badge-category-text: 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.--d-topic-cards .topic-list-header .topic-list-data {
+ max-width: unset;
+}
+
.topic-list .topic-list-item-separator {
display: none;
}
@@ -24,10 +39,7 @@
.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)
- );
+ background-color: var(--badge-category-bg);
@include viewport.until(md) {
padding: 2px 6px;
@@ -35,10 +47,7 @@
}
.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)
- );
+ color: var(--badge-category-text);
}
}
}
@@ -56,7 +65,7 @@
}
}
-.topic-list-body {
+.topic-list.--d-topic-cards .topic-list-body {
border: none;
display: flex;
flex-direction: column;
@@ -72,7 +81,9 @@
}
}
-.topic-list-body .topic-list-item {
+.topic-list.--d-topic-cards
+ .topic-list-body
+ .topic-list-item:not(.--high-context) {
position: relative;
text-overflow: ellipsis;
padding: var(--space-3);
@@ -86,13 +97,13 @@
border-radius: var(--d-border-radius);
cursor: pointer;
- &.has-replies {
+ &.--has-replies {
grid-template-areas:
"creator title title title status"
". category likes-replies activity .";
}
- &:not(.has-replies) {
+ &:not(.--has-replies) {
.topic-likes-replies-data {
display: none;
}
@@ -110,20 +121,20 @@
border-radius: 0;
padding: var(--space-4) var(--space-3);
- &.has-replies {
+ &.--has-replies {
grid-template-areas:
"creator title title title status"
". category likes-replies activity . ";
}
}
- .bulk-select-enabled & {
+ &.bulk-selecting {
grid-template-columns: min-content min-content min-content min-content auto min-content;
grid-template-areas:
"bulk-select creator title title title status"
"bulk-select category category activity activity .";
- &.has-replies {
+ &.--has-replies {
grid-template-areas:
"bulk-select creator title title title status"
"bulk-select category category activity likes-replies .";
@@ -153,40 +164,13 @@
&.selected {
border: 1px solid var(--accent-color);
box-shadow: 0 0 12px 1px var(--topic-card-shadow);
-
- .user-messages-page & {
- box-shadow: inset 0 0 0 2px var(--accent-color);
- }
}
- &.excerpt-expanded {
- @include viewport.until(sm) {
- .topic-excerpt,
- .link-bottom-line {
- display: none;
- }
- }
-
- @include viewport.from(sm) {
- grid-template-areas:
- "creator title title title status"
- ". category activity activity . "
- ". excerpt excerpt excerpt excerpt";
-
- &.has-replies {
- grid-template-areas:
- "creator title title title status"
- ". category likes-replies activity ."
- ". excerpt excerpt excerpt excerpt";
- }
-
- .bulk-select-enabled & {
- grid-template-areas:
- "bulk-select creator title title title status"
- "bulk-select category category activity likes-replies likes-replies "
- " bulk-select excerpt excerpt excerpt excerpt excerpt";
- }
- }
+ .bulk-select-enabled & {
+ grid-template-areas:
+ "bulk-select creator title title title status"
+ "bulk-select category category activity likes-replies likes-replies "
+ " bulk-select excerpt excerpt excerpt excerpt excerpt";
}
.link-top-line {
@@ -237,10 +221,7 @@
max-width: 125px;
}
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)
- );
+ background-color: var(--badge-category-bg);
@include viewport.until(md) {
padding: 0.25em 0.5rem;
@@ -252,10 +233,7 @@
.badge-category__name {
font-size: var(--font-down-1);
- 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)
- );
+ color: var(--badge-category-text);
min-width: 0;
overflow: hidden;
white-space: nowrap;
@@ -364,7 +342,7 @@
}
&.--hot {
- --status-color: #e45735;
+ --status-color: var(--danger);
}
@include viewport.from(lg) {
@@ -500,7 +478,7 @@
"creator title title title dropdown"
". category activity activity .";
- &.has-replies {
+ &.--has-replies {
grid-template-areas:
"creator title title title dropdown"
"category category likes-replies activity .";
@@ -545,20 +523,6 @@
}
}
- &.excerpt-expanded {
- grid-template-areas:
- "creator title title title dropdown"
- "category category activity . . "
- "excerpt excerpt excerpt excerpt excerpt";
-
- @include viewport.until(sm) {
- grid-template-areas:
- "title title title title dropdown"
- "category category activity activity . "
- "excerpt excerpt excerpt excerpt excerpt";
- }
- }
-
&.has-metadata {
grid-template-areas:
"creator title title title dropdown"
@@ -570,21 +534,6 @@
"title title title title ."
"category category activity activity . ";
}
-
- &.excerpt-expanded {
- grid-template-areas:
- "creator title title title dropdown"
- "category category activity metadata . "
- "excerpt excerpt excerpt excerpt excerpt";
-
- @include viewport.until(sm) {
- grid-template-areas:
- "metadata metadata metadata metadata dropdown"
- "title title title title ."
- "category category activity activity . "
- "excerpt excerpt excerpt excerpt excerpt";
- }
- }
}
td.author-avatar {
@@ -672,78 +621,6 @@
box-shadow: none;
}
-// User Messages
-body.user-messages-page {
- .topic-list-body {
- gap: 0;
- }
-
- .topic-list .topic-list-data.posters a:not(.latest) {
- display: block;
- }
-
- .topic-list-item {
- border-radius: 0;
- box-shadow: none;
- border-bottom: 1px solid var(--primary-200);
- border-top: none;
- border-right: none;
- border-left: none;
- display: grid;
- grid-template-areas: "title activity" "posters .";
- 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);
- border-color: var(--primary-200);
- }
- }
-
- td.topic-category-data,
- td.topic-likes-replies-data,
- td.topic-status-data,
- td.topic-creator-data {
- display: none;
- }
-
- .main-link .link-top-line {
- grid-area: title;
- }
-
- &.visited .main-link .link-top-line {
- font-weight: normal;
- }
-
- td.topic-activity-data {
- grid-area: activity;
- }
-
- td.topic-list-data.posters {
- grid-area: posters;
- display: flex;
- align-items: center;
- height: 100%;
-
- a {
- margin-right: 4px;
- }
-
- .avatar {
- width: 20px;
- height: 20px;
- border-radius: 4px;
- background-color: var(--primary-low);
- }
- }
- }
-}
-
.event-date-container {
display: inline-flex;
position: relative;
diff --git a/themes/horizon/scss/topic.scss b/themes/horizon/scss/topic.scss
index e47160a7096..1d581e84713 100644
--- a/themes/horizon/scss/topic.scss
+++ b/themes/horizon/scss/topic.scss
@@ -13,7 +13,7 @@
}
.timeline-container .topic-timeline {
- min-width: unset; // why we have this?
+ min-width: unset;
.timeline-scrollarea {
border-left: 1px solid var(--accent-color);