UX: Improve composer presence-display positioning (#15235)

Previously the discourse-presence plugin was using a `position: absolute` hack to display the 'replying...' users in the top right of the composer. This commit adds a more suitable plugin outlet, and updates the discourse-presence styling so it slots into the flex-box layout at the top of the composer
This commit is contained in:
David Taylor 2021-12-08 16:18:49 +00:00 committed by GitHub
parent d8fe0f4199
commit a6230b8138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 33 deletions

View File

@ -44,6 +44,9 @@
{{/if}}
</div>
{{/unless}}
{{plugin-outlet name="before-composer-controls" args=(hash model=model) tagName="" connectorTagName=""}}
{{composer-toggles
composeState=model.composeState
showToolbar=showToolbar

View File

@ -7,6 +7,7 @@ import Component from "@ember/component";
import { inject as service } from "@ember/service";
export default Component.extend({
tagName: "",
presence: service(),
composerPresenceManager: service(),

View File

@ -12,10 +12,14 @@
{{~else~}}
{{i18n "presence.editing" count=presenceUsers.length}}
{{~/if}}
</span>{{!-- (using comment to stop whitespace)
--}}</span>{{!--
--}}<span class="wave">
<span class="dot">.</span><span class="dot">.</span><span class="dot">.</span>
{{~""~}}
</span>
{{~""~}}
<span class="wave">
{{~""~}}
<span class="dot">.</span><span class="dot">.</span><span class="dot">.</span>
{{~""~}}
</span>
</span>
</div>
{{/if}}

View File

@ -52,32 +52,15 @@
}
.composer-fields .presence-users {
position: absolute;
top: 20px;
right: 95px;
@media screen and (max-width: $small-width) {
max-width: 318px;
.presence-avatars {
flex-wrap: nowrap;
}
overflow: hidden;
flex-shrink: 1;
.presence-avatars {
flex-wrap: nowrap;
}
}
.mobile-view {
.presence-users {
font-size: $font-down-1;
}
.composer-fields .presence-users {
top: 7px;
right: 65px;
max-width: 70px;
.presence-avatars {
flex-wrap: nowrap;
}
.description {
display: none;
}
}
.mobile-view .composer-fields .presence-users .description {
display: none;
}
// TMP: RTL overrides

View File

@ -193,12 +193,7 @@ acceptance("Discourse Presence Plugin", function (needs) {
await click("#topic-footer-buttons .btn.create");
assert.ok(exists(".d-editor-input"), "the composer input is visible");
const avatarSelector =
".composer-fields-outlet.presence .presence-avatars .avatar";
assert.ok(
exists(".composer-fields-outlet.presence"),
"includes the presence component"
);
const avatarSelector = ".composer-fields .presence-avatars .avatar";
assert.strictEqual(count(avatarSelector), 0, "no avatars displayed");
await joinChannel("/discourse-presence/reply/280", {