Skip to content

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

UX: Show chat indicator on mobile (#35973)

chapoi1c9be4e00d5b
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/header/icon.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/header/icon.gjs
index 9bf78b00f88..9e8abfe6bf8 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/header/icon.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/header/icon.gjs
@@ -91,6 +91,7 @@ export default class ChatHeaderIcon extends Component {
@urgentCount={{@urgentCount}}
@unreadCount={{@unreadCount}}
@indicatorPreference={{@indicatorPreference}}
+ @class="c-unread-indicator__number"
/>
{{/if}}
</DButton>
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/navbar/back-button.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/navbar/back-button.gjs
index 0fa1b9ea4a0..123a5f5a004 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat/navbar/back-button.gjs
+++ b/plugins/chat/assets/javascripts/discourse/components/chat/navbar/back-button.gjs
@@ -3,9 +3,11 @@ import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
+import ChatHeaderIconUnreadIndicator from "discourse/plugins/chat/discourse/components/chat/header/icon/unread-indicator";
export default class ChatNavbarBackButton extends Component {
@service chatStateManager;
+ @service site;
get icon() {
return this.args.icon ?? "chevron-left";
@@ -40,6 +42,13 @@ export default class ChatNavbarBackButton extends Component {
{{else}}
{{icon this.icon}}
{{/if}}
+ {{#if this.site.mobileView}}
+ <ChatHeaderIconUnreadIndicator
+ @urgentCount={{@urgentCount}}
+ @unreadCount={{@unreadCount}}
+ @indicatorPreference={{@indicatorPreference}}
+ />
+ {{/if}}
</LinkTo>
{{else}}
<LinkTo
@@ -52,8 +61,16 @@ export default class ChatNavbarBackButton extends Component {
{{else}}
{{icon this.icon}}
{{/if}}
+ {{#if this.site.mobileView}}
+ <ChatHeaderIconUnreadIndicator
+ @urgentCount={{@urgentCount}}
+ @unreadCount={{@unreadCount}}
+ @indicatorPreference={{@indicatorPreference}}
+ />
+ {{/if}}
</LinkTo>
{{/if}}
+
{{/if}}
</template>
}
diff --git a/plugins/chat/assets/stylesheets/common/chat-channel-name.scss b/plugins/chat/assets/stylesheets/common/chat-channel-name.scss
index 2849887882a..8eae7695f42 100644
--- a/plugins/chat/assets/stylesheets/common/chat-channel-name.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-channel-name.scss
@@ -21,23 +21,4 @@
width: 1em;
vertical-align: middle;
}
-
- .chat-channel-unread-indicator {
- display: flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
-
- @include chat-unread-indicator {
- width: 8px;
- height: 8px;
- }
-
- &.-urgent {
- width: auto;
- height: auto;
- min-width: 0.6em;
- padding: 0.3em 0.5em;
- }
- }
}
diff --git a/plugins/chat/assets/stylesheets/common/chat-navbar.scss b/plugins/chat/assets/stylesheets/common/chat-navbar.scss
index f4e6241cafa..1d3de159adc 100644
--- a/plugins/chat/assets/stylesheets/common/chat-navbar.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-navbar.scss
@@ -15,7 +15,6 @@
display: flex;
align-items: flex-start;
width: 100%;
- gap: 0.25rem;
position: relative;
container-type: inline-size;
diff --git a/plugins/chat/assets/stylesheets/common/chat-unread-indicator.scss b/plugins/chat/assets/stylesheets/common/chat-unread-indicator.scss
index 352b1e25bea..4edf60c9451 100644
--- a/plugins/chat/assets/stylesheets/common/chat-unread-indicator.scss
+++ b/plugins/chat/assets/stylesheets/common/chat-unread-indicator.scss
@@ -1,7 +1,7 @@
@mixin chat-unread-indicator {
@include unselectable;
- width: 14px;
- height: 14px;
+ width: 0.5rem;
+ height: 0.5rem;
border-radius: 1em;
box-sizing: content-box;
-webkit-touch-callout: none;
@@ -16,6 +16,10 @@
&.-urgent {
background: var(--success);
color: var(--secondary);
+ height: 1em;
+ width: min-content;
+ min-width: 0.6em;
+ padding: 0.21em 0.42em;
}
&__number {
@@ -24,6 +28,7 @@
}
}
-.c-unread-indicator {
+.c-unread-indicator,
+.chat-channel-unread-indicator {
@include chat-unread-indicator;
}
diff --git a/plugins/chat/assets/stylesheets/mobile/chat-navbar.scss b/plugins/chat/assets/stylesheets/mobile/chat-navbar.scss
index 052c2243293..4be904d7f80 100644
--- a/plugins/chat/assets/stylesheets/mobile/chat-navbar.scss
+++ b/plugins/chat/assets/stylesheets/mobile/chat-navbar.scss
@@ -1,12 +1,13 @@
.c-navbar {
- gap: 0.5rem;
-
&-container {
max-width: 100vw;
}
&__back-button {
+ justify-content: flex-start;
align-self: stretch;
+ box-sizing: border-box;
+ min-width: calc(2.44em + 1.05rem);
}
&__title {
diff --git a/themes/horizon/scss/chat.scss b/themes/horizon/scss/chat.scss
index 6c6dd4aa457..dbac1c0b71e 100644
--- a/themes/horizon/scss/chat.scss
+++ b/themes/horizon/scss/chat.scss
@@ -8,7 +8,9 @@
background-color: var(--d-content-background);
.full-page-chat & {
- padding: 0 1.5em;
+ @include viewport.from(sm) {
+ padding: 0 1.5em;
+ }
}
.chat-drawer.is-collapsed & {