A platform for community discussion. Free, open, simple.
UX: update heading style in review queue refresh (#36391)
Krisbed4079cdbac
diff --git a/app/assets/stylesheets/common/base/review.scss b/app/assets/stylesheets/common/base/review.scssindex d48aa3eebf3..ffa1dbaf32d 100644--- a/app/assets/stylesheets/common/base/review.scss+++ b/app/assets/stylesheets/common/base/review.scss@@ -1,14 +1,5 @@@use "lib/viewport";-:root {- --d-review-reason-spam-text: light-dark(#7c3aed, #a78bfa);- --d-review-reason-off-topic-text: light-dark(#059669, #6ee7b7);- --d-review-reason-illegal-text: light-dark(#dc2626, #f87171);- --d-review-reason-inappropriate-text: light-dark(#ea580c, #fb923c);- --d-review-reason-other-text: light-dark(#4b5563, #9ca3af);- --d-review-reason-custom-text: light-dark(#c026d3, #e879f9);-}-.review-item {display: flex;flex-wrap: nowrap;@@ -37,7 +28,7 @@.reviewable-created-date {font-size: var(--font-down-1);- color: var(--primary-high);+ color: var(--secondary-high);white-space: nowrap;align-self: baseline;padding-block: var(--space-1);@@ -51,15 +42,17 @@align-self: center;.post-action-feedback-alert {- top: -1.25rem;- left: 60%;+ top: -0.95rem;+ left: 0;}.d-icon {+ color: var(--secondary-high);margin-right: 0;}.post-action-feedback-svg {+ fill: var(--success-medium);right: unset;left: -0.5em;top: 0.05em;@@ -111,8 +104,9 @@grid-template-columns: 1fr auto auto auto;gap: var(--space-2);align-items: start;- background-color: var(--primary-very-low);- padding: var(--space-5) var(--space-4);+ background-color: var(--primary);+ padding: var(--space-3) var(--space-4);+ color: var(--secondary);}&__label-badges {@@ -342,16 +336,23 @@align-items: center;justify-content: center;border-radius: 999px;- padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);+ padding: var(--space-1) var(--space-2);font-size: var(--font-down-1);line-height: 1;- background: var(--primary-low);+ background-color: var(--secondary-high);+ color: var(--primary);&.--pending {- background-color: var(--primary-very-high);+ background: var(--secondary-low);+ color: var(--primary-low);+ }++ &.--rejected {+ background-color: var(--danger);color: var(--secondary);}+ &.--approved,&.--resolved {background-color: var(--success);color: var(--secondary);@@ -362,31 +363,6 @@display: inline-flex;align-items: center;line-height: 1;-- &.--spam {- color: var(--d-review-reason-spam-text);- }-- &.--off-topic {- color: var(--d-review-reason-off-topic-text);- }-- &.--illegal {- color: var(--d-review-reason-illegal-text);- }-- &.--inappropriate {- color: var(--d-review-reason-inappropriate-text);- }-- &.--other,- &.--needs-approval {- color: var(--d-review-reason-other-text);- }-- &.--custom {- color: var(--d-review-reason-custom-text);- }}.review-item__flag-count {diff --git a/frontend/discourse/app/components/reviewable-refresh/flag-reason.gjs b/frontend/discourse/app/components/reviewable-refresh/flag-reason.gjsindex d21b50daaa0..a2c9b7ab08e 100644--- a/frontend/discourse/app/components/reviewable-refresh/flag-reason.gjs+++ b/frontend/discourse/app/components/reviewable-refresh/flag-reason.gjs@@ -1,14 +1,5 @@-import Component from "@glimmer/component";import { gt } from "discourse/truth-helpers";-const SCORE_TYPE_TO_CSS_CLASS_MAP = {- illegal: "illegal",- inappropriate: "inappropriate",- needs_approval: "needs-approval",- off_topic: "off-topic",- spam: "spam",-};-/*** Displays a reason for a reviewable flag in the review process.* Renders the flag type, title, and the number of times this flag has been raised.@@ -25,25 +16,15 @@ const SCORE_TYPE_TO_CSS_CLASS_MAP = {* @param {String} score.title - The display title for the flag reason* @param {Number} [score.count] - The number of times this flag has been raised*/-export default class ReviewableFlagReason extends Component {- /**- * Determines the CSS class to apply based on the score type.- * Maps known flag types to their corresponding CSS classes, defaults to "other" for unknown types.- *- * @returns {String} The CSS class modifier (e.g., "spam", "illegal", "other")- */- get scoreCSSClass() {- return SCORE_TYPE_TO_CSS_CLASS_MAP[this.args.score.type] || "other";- }+const ReviewableFlagReason = <template>+ <span class="review-item__flag-reason">+ {{@score.title}}+ {{#if (gt @score.count 1)}}+ <span class="review-item__flag-count">+ x{{@score.count}}+ </span>+ {{/if}}+ </span>+</template>;- <template>- <span class="review-item__flag-reason --{{this.scoreCSSClass}}">- {{@score.title}}- {{#if (gt @score.count 1)}}- <span class="review-item__flag-count --{{this.scoreCSSClass}}">- x{{@score.count}}- </span>- {{/if}}- </span>- </template>-}+export default ReviewableFlagReason;diff --git a/frontend/discourse/tests/integration/components/reviewable-refresh/flag-reason-test.gjs b/frontend/discourse/tests/integration/components/reviewable-refresh/flag-reason-test.gjsindex 1b93e7add04..fb938914f70 100644--- a/frontend/discourse/tests/integration/components/reviewable-refresh/flag-reason-test.gjs+++ b/frontend/discourse/tests/integration/components/reviewable-refresh/flag-reason-test.gjs@@ -18,9 +18,6 @@ module(assert.dom(".review-item__flag-reason").exists("renders the flag reason container");- assert- .dom(".review-item__flag-reason")- .hasClass("--spam", "applies correct CSS class for spam type");assert.dom(".review-item__flag-reason").containsText("This is spam", "displays the title");@@ -64,40 +61,6 @@ module(}});- test("applies correct CSS class for each flag type", async function (assert) {- const flagTypes = [- { type: "illegal", expectedClass: "--illegal" },- { type: "inappropriate", expectedClass: "--inappropriate" },- { type: "needs_approval", expectedClass: "--needs-approval" },- { type: "off_topic", expectedClass: "--off-topic" },- { type: "spam", expectedClass: "--spam" },- { type: "unknown_type", expectedClass: "--other" },- { type: undefined, expectedClass: "--other" },- ];-- for (const { type, expectedClass } of flagTypes) {- const typeDescription = type || "undefined";- const score = { type, title: "Test content", count: 2 };-- await render(- <template><ReviewableFlagReason @score={{score}} /></template>- );-- assert- .dom(".review-item__flag-reason")- .hasClass(- expectedClass,- `applies ${expectedClass} CSS class for ${typeDescription} type`- );- assert- .dom(".review-item__flag-count")- .hasClass(- expectedClass,- `applies ${expectedClass} CSS class to count for ${typeDescription} type`- );- }- });-test("renders title even when empty string", async function (assert) {const score = { type: "spam", title: "", count: 2 };diff --git a/spec/system/page_objects/components/review/flag_reason.rb b/spec/system/page_objects/components/review/flag_reason.rbindex ab39ee46278..49b551cc610 100644--- a/spec/system/page_objects/components/review/flag_reason.rb+++ b/spec/system/page_objects/components/review/flag_reason.rb@@ -5,28 +5,28 @@ module PageObjectsmodule Reviewclass FlagReason < PageObjects::Components::Basedef has_spam_flag_reason?(reviewable, count: 1)- has_flag_reason?(reviewable, css_class: "spam", type: :spam, count:)+ has_flag_reason?(reviewable, type: :spam, count:)enddef has_off_topic_flag_reason?(reviewable, count: 1)- has_flag_reason?(reviewable, css_class: "off-topic", type: :off_topic, count:)+ has_flag_reason?(reviewable, type: :off_topic, count:)enddef has_illegal_flag_reason?(reviewable, count: 1)- has_flag_reason?(reviewable, css_class: "illegal", type: :illegal, count:)+ has_flag_reason?(reviewable, type: :illegal, count:)enddef has_inappropriate_flag_reason?(reviewable, count: 1)- has_flag_reason?(reviewable, css_class: "inappropriate", type: :inappropriate, count:)+ has_flag_reason?(reviewable, type: :inappropriate, count:)enddef has_needs_approval_flag_reason?(reviewable, count: 1)- has_flag_reason?(reviewable, css_class: "needs-approval", type: :needs_approval, count:)+ has_flag_reason?(reviewable, type: :needs_approval, count:)endprivate- def has_flag_reason?(reviewable, css_class:, type:, count: 1)+ def has_flag_reason?(reviewable, type:, count: 1)within_reviewable_item(reviewable) doexpected_text =if count > 1@@ -36,14 +36,14 @@ module PageObjectsendwithin(".review-item__header") do- expect(find(".review-item__flag-reason.--#{css_class}").text.gsub(/\s+/, " ")).to eq(- expected_text,- )+ flag_reason_element =+ find(".review-item__flag-reason", text: ReviewableScore.type_title(type))+ expect(flag_reason_element.text.gsub(/\s+/, " ")).to eq(expected_text)if count > 1- expect(page).to have_css(".review-item__flag-count.--#{css_class}")+ expect(flag_reason_element).to have_css(".review-item__flag-count")else- expect(page).to have_no_css(".review-item__flag-count.--#{css_class}")+ expect(flag_reason_element).to have_no_css(".review-item__flag-count")endendend