A platform for community discussion. Free, open, simple.
UX: style reactions popup (#39404)
chapoi5ce491815ea1
diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scssindex 1089eaabba9..612e4e98c78 100644--- a/app/assets/stylesheets/common/base/topic-post.scss+++ b/app/assets/stylesheets/common/base/topic-post.scss@@ -415,15 +415,26 @@ nav.post-controls {gap: var(--space-1);}- .post-action-menu__like {- &.has-like .d-icon {- color: var(--love);+ .post-action-menu {+ &__like {+ &.has-like .d-icon {+ color: var(--love);+ }++ .discourse-no-touch & {+ &:not(.has-like):hover {+ --d-post-control-background--hover: var(--love-low);+ --d-button-flat-icon-color--hover: var(--love);+ }+ }}- .discourse-no-touch & {- &:not(.has-like):hover {- --d-post-control-background--hover: var(--love-low);- --d-button-flat-icon-color--hover: var(--love);+ &__like-count {+ color: var(--d-post-control-text-color) !important;+ gap: var(--space-2);++ &.has-liked .d-icon {+ color: var(--danger);}}}@@ -2169,195 +2180,6 @@ html.discourse-no-touch .fullscreen-table-wrapper:hover {}}-.post-action-menu__like-count {- color: var(--d-post-control-text-color) !important;- gap: var(--space-2);-- &.has-liked .d-icon {- color: var(--danger);- }-}--.post-users-popup {- width: 300px;- background: var(--secondary);- color: var(--primary);- line-height: normal;- border-radius: 10px;-- &__title {- padding: 0.25em 0.5em 0.75em;- text-align: center;- font-weight: 600;- border-bottom: 1px solid var(--primary-low);- }-- &__header {- display: flex;- align-items: center;- gap: 0.25em;- padding: 0.5em 0.65em;- border-bottom: 1px solid var(--primary-low);- border-radius: 10px 10px 0 0;- overflow-x: auto;- -webkit-overflow-scrolling: touch;-- &::-webkit-scrollbar {- display: none;- }- }-- &__filter {- display: inline-flex;- align-items: center;- gap: 0.3em;- padding: 0.3em 0.6em;- border: none;- border-radius: 6px;- background: transparent;- color: var(--primary-medium);- font-size: var(--font-down-1);- cursor: pointer;- white-space: nowrap;- transition: background 0.15s;-- .emoji {- width: 1.15em;- height: 1.15em;- }-- &:hover {- background: var(--primary-very-low);- }-- &.is-active {- background: var(--tertiary-low);- color: var(--primary);- font-weight: 600;- }- }-- &__body {- height: 320px;- overflow-y: auto;- overscroll-behavior: contain;- padding-top: 0.35em;- border-radius: 0 0 10px 10px;-- &:first-child {- border-radius: 10px;- }- }-- &__item {- display: flex;- align-items: center;- gap: 0.5em;- padding: 0.45em 0.75em;-- &:hover {- background: var(--primary-very-low);- }- }-- &__avatar-link {- flex-shrink: 0;- display: flex;-- .avatar {- border-radius: 50%;- background: var(--primary-very-low);- }- }-- &__user-info {- flex: 1;- min-width: 0;- display: flex;- flex-direction: column;- align-items: flex-start;- }-- &__name {- color: var(--primary) !important;- font-weight: 600;- font-size: var(--font-down-1);- text-decoration: none;- text-align: left;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- max-width: 100%;-- &:hover {- text-decoration: underline;- }- }-- &__username {- color: var(--primary-medium) !important;- font-size: var(--font-down-2);- text-decoration: none;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;-- &:hover {- text-decoration: underline;- }- }-- &__reaction {- color: var(--danger);- flex-shrink: 0;- margin-left: auto;-- .emoji {- width: 1.15em;- height: 1.15em;- }- }-- .loading-container {- display: flex;- justify-content: center;- padding: 0.75em;- }-}--.mobile-view {- .post-liked-users-menu-content,- .discourse-reactions-users-menu-content {- .d-modal__container {- height: min(80dvh, 560px);- }-- .d-modal__body {- flex: 1;- min-height: 0;- padding: 0;- }-- .post-users-popup {- width: 100%;- }-- .post-users-popup__sticky-header {- position: sticky;- top: 0;- z-index: 1;- padding-top: 0.75em;- background: var(--secondary);- }-- .post-users-popup__body {- height: auto;- overflow: visible;- overscroll-behavior: auto;- }- }-}-.time-gap + .topic-post .topic-body,.time-gap + .topic-post .topic-avatar {border-top: none;diff --git a/app/assets/stylesheets/common/modal/_index.scss b/app/assets/stylesheets/common/modal/_index.scssindex fef1f68dc99..d2dba276a2d 100644--- a/app/assets/stylesheets/common/modal/_index.scss+++ b/app/assets/stylesheets/common/modal/_index.scss@@ -1,2 +1,3 @@@import "modal-overrides";@import "user-status";+@import "discourse-reactions-popup";diff --git a/app/assets/stylesheets/common/modal/discourse-reactions-popup.scss b/app/assets/stylesheets/common/modal/discourse-reactions-popup.scssnew file mode 100644index 00000000000..cb6fa2ae5eb--- /dev/null+++ b/app/assets/stylesheets/common/modal/discourse-reactions-popup.scss@@ -0,0 +1,201 @@+@use "lib/viewport";++// specific d-modal overrules+.fk-d-menu-modal.discourse-reactions-users-menu-content {+ .d-modal {+ &__container {+ height: clamp(50dvh, 50dvh, 60dvh);+ }++ &__body {+ padding-top: 0;+ }+ }+}++.post-users-popup {+ width: 300px;+ background: var(--secondary);+ color: var(--primary);+ line-height: normal;++ @include viewport.until(sm) {+ width: 100%;+ }++ &__title {+ padding: 0 var(--space-4) var(--space-4);+ text-align: center;+ font-weight: 700;+ border-bottom: 1px solid var(--primary-low);++ @include viewport.until(sm) {+ padding-top: var(--space-3);+ padding-bottom: var(--space-3);+ }+ }++ &__sticky-header {+ position: sticky;+ top: 0;+ background: var(--secondary);+ }++ &__header {+ display: flex;+ align-items: center;+ gap: var(--space-1);+ padding: var(--space-2) var(--space-4);+ overflow-x: auto;+ -webkit-overflow-scrolling: touch;++ @include viewport.from(sm) {+ padding: var(--space-2) var(--space-3);+ border-bottom: 1px solid var(--primary-low);+ }++ &::-webkit-scrollbar {+ display: none;+ }+ }++ &__filter {+ display: inline-flex;+ align-items: center;+ gap: var(--space-1);+ padding: var(--space-2) var(--space-3);++ @include viewport.from(sm) {+ padding: var(--space-1) var(--space-2);+ }+ border: none;+ border-radius: var(--d-border-radius);+ background: transparent;+ color: var(--primary-medium);+ font-size: var(--font-down-1);+ cursor: pointer;+ white-space: nowrap;+ transition: background 0.15s;++ .emoji {+ width: 1.15em;+ height: 1.15em;++ @include viewport.until(sm) {+ width: 1.25em;+ height: 1.25em;+ }+ }++ &:hover {+ .discourse-no-touch & {+ background: var(--primary-very-low);+ }++ .discourse-touch & {+ background: transparent;+ }+ }++ &.is-active {+ background: var(--tertiary-low);+ color: var(--primary);+ }+ }++ &__body {+ overflow-y: auto;++ @include viewport.from(sm) {+ overscroll-behavior: contain;+ height: auto;+ max-height: 320px;+ }+ }++ &__item {+ display: flex;+ align-items: center;+ gap: var(--space-3);+ padding: var(--space-2) var(--space-4);++ @include viewport.from(sm) {+ padding: var(--space-2) var(--space-3);+ font-size: var(--font-down-1-rem);+ }++ &:hover {+ .discourse-no-touch & {+ background: var(--primary-very-low);+ }++ .discourse-touch & {+ background: transparent;+ }+ }+ }++ &__avatar-link {+ flex-shrink: 0;+ display: flex;++ .avatar {+ @include viewport.until(sm) {+ width: 32px;+ height: 32px;+ }+ }+ }++ &__user-info {+ flex: 1;+ min-width: 0;+ display: flex;+ flex-direction: column;+ align-items: flex-start;+ }++ &__name {+ @include ellipsis;+ color: var(--primary) !important;+ max-width: 100%;+ }++ &__username {+ color: var(--primary-medium) !important;+ font-size: var(--font-down-2);+ text-decoration: none;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;++ &:hover {+ text-decoration: underline;+ }+ }++ &__reaction {+ color: var(--danger);+ flex-shrink: 0;+ margin-left: auto;++ &.emoji {+ width: 1.15em;+ height: 1.15em;++ @include viewport.until(sm) {+ width: 1.25em;+ height: 1.25em;+ }+ }+ }++ .loading-container {+ display: flex;+ justify-content: center;++ .spinner {+ margin: var(--space-3);+ }+ }+}diff --git a/frontend/discourse/app/components/post/menu/post-users-menu.gjs b/frontend/discourse/app/components/post/menu/post-users-menu.gjsindex 27499f21d05..cd20212e812 100644--- a/frontend/discourse/app/components/post/menu/post-users-menu.gjs+++ b/frontend/discourse/app/components/post/menu/post-users-menu.gjs@@ -2,7 +2,9 @@ import Component from "@glimmer/component";import { tracked } from "@glimmer/tracking";import { action } from "@ember/object";import didInsert from "@ember/render-modifiers/modifiers/did-insert";+import { schedule } from "@ember/runloop";import { service } from "@ember/service";+import { trustHTML } from "@ember/template";import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";import LoadMore from "discourse/components/load-more";import UserAvatar from "discourse/components/user-avatar";@@ -18,6 +20,7 @@ export default class PostUsersMenu extends Component {@tracked users = [];@tracked loading = false;@tracked canLoadMore = true;+ @tracked bodyMinHeight = null;displayName = (user) => {if (user.name && !this.siteSettings.prioritize_username_in_ux) {@@ -33,9 +36,22 @@ export default class PostUsersMenu extends Component {};#page = 0;+ get bodyStyle() {+ if (this.bodyMinHeight) {+ return trustHTML(`min-height: ${this.bodyMinHeight}px`);+ }+ return null;+ }+@action- async loadInitial() {+ async loadInitial(element) {await this.#loadMore();+ if (this.site.mobileView) {+ return;+ }+ schedule("afterRender", () => {+ this.bodyMinHeight = element.offsetHeight;+ });}@action@@ -73,7 +89,11 @@ export default class PostUsersMenu extends Component {{{yield this.resetAndReload to="header"}}</div>- <div class="post-users-popup__body" {{didInsert this.loadInitial}}>+ <div+ class="post-users-popup__body"+ style={{this.bodyStyle}}+ {{didInsert this.loadInitial}}+ ><LoadMore@action={{this.loadMore}}@enabled={{this.canLoadMore}}diff --git a/plugins/discourse-reactions/config/locales/client.en.yml b/plugins/discourse-reactions/config/locales/client.en.ymlindex c48102a4f44..854bbbfc5c7 100644--- a/plugins/discourse-reactions/config/locales/client.en.yml+++ b/plugins/discourse-reactions/config/locales/client.en.yml@@ -23,8 +23,8 @@ en:users_popup:all: "All"title:- one: "%{count} reaction"- other: "%{count} reactions"+ one: "%{count} Reaction"+ other: "%{count} Reactions"counter:aria_label:one: "%{count} reaction"