A platform for community discussion. Free, open, simple.
UX: various visual fixes to rewind plugin (#36535)
Krisf0cb5f91adb4
diff --git a/plugins/discourse-rewind/app/services/discourse_rewind/action/reactions.rb b/plugins/discourse-rewind/app/services/discourse_rewind/action/reactions.rbindex cddd003fc84..a83ee909daa 100644--- a/plugins/discourse-rewind/app/services/discourse_rewind/action/reactions.rb+++ b/plugins/discourse-rewind/app/services/discourse_rewind/action/reactions.rb@@ -86,7 +86,7 @@ module DiscourseRewindenddef sort_and_limit(reactions)- reactions.sort_by { |_, value| -value }.take(5).reverse.to_h+ reactions.sort_by { |_, value| -value }.take(5).to_hendendenddiff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/ai-usage.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/ai-usage.gjsindex b45967dab6e..0a8143a0d62 100644--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/ai-usage.gjs+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/ai-usage.gjs@@ -47,6 +47,14 @@ export default class AiUsage extends Component {@actionsetupMatrix(element) {+ const prefersReducedMotion = window.matchMedia(+ "(prefers-reduced-motion: reduce)"+ ).matches;++ if (prefersReducedMotion) {+ return;+ }+const canvas = element;const ctx = canvas.getContext("2d");diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjsindex da962c0fe03..6f54a3efe80 100644--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/reactions.gjs@@ -1,5 +1,5 @@import Component from "@glimmer/component";-import { concat } from "@ember/helper";+import { concat, get } from "@ember/helper";import { action } from "@ember/object";import { htmlSafe } from "@ember/template";import replaceEmoji from "discourse/helpers/replace-emoji";@@ -16,6 +16,11 @@ export default class Reactions extends Component {return this.args.report.data.post_received_reactions ?? {};}+ get sortedUsedReactions() {+ const reactions = this.args.report.data.post_used_reactions ?? {};+ return Object.entries(reactions).sort((a, b) => b[1] - a[1]);+ }+@actioncleanEmoji(emojiName) {return emojiName.replaceAll(/_/g, " ");@@ -54,19 +59,21 @@ export default class Reactions extends Component {</h2><div class="rewind-card"><div class="rewind-reactions-chart">- {{#each-in @report.data.post_used_reactions as |emojiName count|}}+ {{#each this.sortedUsedReactions as |reaction|}}<div class="rewind-reactions-row"><span class="emoji">- {{replaceEmoji (concat ":" emojiName ":")}}+ {{replaceEmoji (concat ":" (get reaction "0") ":")}}</span>- <span class="percentage">{{this.computePercentage count}}</span>+ <span class="percentage">{{this.computePercentage+ (get reaction "1")+ }}</span><divclass="rewind-reactions-bar"- style={{this.computePercentageStyle count}}- title={{count}}+ style={{this.computePercentageStyle (get reaction "1")}}+ title={{get reaction "1"}}></div></div>- {{/each-in}}+ {{/each}}<span class="rewind-total-reactions">{{i18ndiff --git a/plugins/discourse-rewind/assets/stylesheets/common/ai-usage.scss b/plugins/discourse-rewind/assets/stylesheets/common/ai-usage.scssindex 311f847742c..483a8bdd765 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/ai-usage.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/ai-usage.scss@@ -22,6 +22,10 @@width: 100%;height: 100%;opacity: 0.3;++ @media (prefers-reduced-motion: reduce) {+ display: none;+ }}.matrix-content {diff --git a/plugins/discourse-rewind/assets/stylesheets/common/best-posts.scss b/plugins/discourse-rewind/assets/stylesheets/common/best-posts.scssindex bcdecdad95a..9577326b025 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/best-posts.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/best-posts.scss@@ -81,10 +81,6 @@.best-posts__post {width: 100%;-- @media screen and (width <= 475px) {- max-height: 300px;- }}.best-posts__post p {diff --git a/plugins/discourse-rewind/assets/stylesheets/common/invites.scss b/plugins/discourse-rewind/assets/stylesheets/common/invites.scssindex 4b8f135f2b1..11f650ec5e0 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/invites.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/invites.scss@@ -45,7 +45,10 @@-1px 1px 0 #000,1px 1px 0 #000;font-weight: bold;- animation: rainbow-text 3s linear infinite;++ @media (prefers-reduced-motion: no-preference) {+ animation: rainbow-text 3s linear infinite;+ }}@keyframes rainbow-text {@@ -176,7 +179,10 @@&:hover {background: #ff9;- animation: blink 0.5s infinite;++ @media (prefers-reduced-motion: no-preference) {+ animation: blink 0.5s infinite;+ }}.avatar {diff --git a/plugins/discourse-rewind/assets/stylesheets/common/new-user-interactions.scss b/plugins/discourse-rewind/assets/stylesheets/common/new-user-interactions.scssindex cf563cd052b..1485827608a 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/new-user-interactions.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/new-user-interactions.scss@@ -60,7 +60,10 @@13px 13px 0 #001,14px 14px 0 #001,15px 15px 20px rgb(0 0 0 / 0.5);- animation: wordart-wave 3s ease-in-out infinite;++ @media (prefers-reduced-motion: no-preference) {+ animation: wordart-wave 3s ease-in-out infinite;+ }}// Wave pattern using nth-childdiff --git a/plugins/discourse-rewind/assets/stylesheets/common/post-used-reactions.scss b/plugins/discourse-rewind/assets/stylesheets/common/post-used-reactions.scssindex d29ae3995dd..9d4511cc86d 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/post-used-reactions.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/post-used-reactions.scss@@ -78,7 +78,10 @@);border: 4px solid var(--rewind-black);box-shadow: 0 0 0 4px var(--rewind-white);- animation: anim 5s linear infinite;++ @media (prefers-reduced-motion: no-preference) {+ animation: anim 5s linear infinite;+ }}@keyframes anim {diff --git a/plugins/discourse-rewind/assets/stylesheets/common/rewind-header.scss b/plugins/discourse-rewind/assets/stylesheets/common/rewind-header.scssindex 81f892fb0ec..d7784e4d201 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/rewind-header.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/rewind-header.scss@@ -76,24 +76,28 @@}}-.rewind-notification-active #toggle-current-user::after {- width: 48px;- height: 48px;- position: absolute;- left: -4px;- top: -4px;- content: "";- background-image: absolute-image-url(- "/plugins/discourse-rewind/images/rewind-avatar-shimmer.gif"- );- display: block;- background-size: cover;-- @media (prefers-reduced-motion) {- .rewind-notification-active #toggle-current-user::after {+.rewind-notification-active {+ #toggle-current-user::after {+ width: 48px;+ height: 48px;+ position: absolute;+ left: -4px;+ top: -4px;+ content: "";+ background-image: absolute-image-url(+ "/plugins/discourse-rewind/images/rewind-avatar-shimmer.gif"+ );+ display: block;+ background-size: cover;++ @media (prefers-reduced-motion: reduce) {background-image: absolute-image-url("/plugins/discourse-rewind/images/rewind-avatar-static.png");}}++ .d-header-icons .badge-notification {+ z-index: 1; // put badges above the avatar shimmer gif+ }}diff --git a/plugins/discourse-rewind/assets/stylesheets/common/rewind.scss b/plugins/discourse-rewind/assets/stylesheets/common/rewind.scssindex f67b17811f6..755e27ccbab 100644--- a/plugins/discourse-rewind/assets/stylesheets/common/rewind.scss+++ b/plugins/discourse-rewind/assets/stylesheets/common/rewind.scss@@ -70,7 +70,10 @@z-index: 3;background: rgb(0 0 0 / 0.3);opacity: 0.75;- animation: scanline 6s linear infinite;++ @media (prefers-reduced-motion: no-preference) {+ animation: scanline 6s linear infinite;+ }}&::after {@@ -85,7 +88,10 @@rgb(0 0 0 / 0.1) 51%);background-size: 100% 4px;- animation: scanlines 1s steps(60) infinite;++ @media (prefers-reduced-motion: no-preference) {+ animation: scanlines 1s steps(60) infinite;+ }}}@@ -132,16 +138,14 @@font-size: var(--font-down-1);.d-icon {- color: #333;+ color: var(+ --rewind-black+ ) !important; // override very specific core selector}.discourse-no-touch & {&:hover {filter: brightness(0.95);-- .d-icon {- color: var(--rewind-grey);- }}&:active {diff --git a/plugins/discourse-rewind/public/images/rewind-avatar-2-shimmer.gif b/plugins/discourse-rewind/public/images/rewind-avatar-2-shimmer.gifdeleted file mode 100644index b6da4f83464..00000000000Binary files a/plugins/discourse-rewind/public/images/rewind-avatar-2-shimmer.gif and /dev/null differ