UX: Chat info area back button + styling tweaks (#24966)

## Back button to navigate out of add-member area

Currently on mobile, once you're in the member area, there is no easy to return to the general settings area, except exiting the settings altogether, which isn't very user friendly. A go-back link solves the problem.

## Styling tweaks

* Removed the background from the leave button
* Added more spacing between the sections on desktop and removed the fixed height for rows

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
chapoi 2023-12-19 17:28:07 +02:00 committed by GitHub
parent b8a36dd870
commit 70f0cb610a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 9 deletions

View File

@ -3,6 +3,7 @@ import { cached, tracked } from "@glimmer/tracking";
import { fn, hash } from "@ember/helper"; import { fn, hash } from "@ember/helper";
import { on } from "@ember/modifier"; import { on } from "@ember/modifier";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { LinkTo } from "@ember/routing";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { modifier } from "ember-modifier"; import { modifier } from "ember-modifier";
import isElementInViewport from "discourse/lib/is-element-in-viewport"; import isElementInViewport from "discourse/lib/is-element-in-viewport";
@ -10,6 +11,7 @@ import DiscourseURL, { userPath } from "discourse/lib/url";
import autoFocus from "discourse/modifiers/auto-focus"; import autoFocus from "discourse/modifiers/auto-focus";
import { INPUT_DELAY } from "discourse-common/config/environment"; import { INPUT_DELAY } from "discourse-common/config/environment";
import icon from "discourse-common/helpers/d-icon"; import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import discourseDebounce from "discourse-common/lib/debounce"; import discourseDebounce from "discourse-common/lib/debounce";
import I18n from "discourse-i18n"; import I18n from "discourse-i18n";
import MessageCreator from "discourse/plugins/chat/discourse/components/chat/message-creator"; import MessageCreator from "discourse/plugins/chat/discourse/components/chat/message-creator";
@ -22,6 +24,7 @@ export default class ChatRouteChannelInfoMembers extends Component {
@service chatApi; @service chatApi;
@service modal; @service modal;
@service loadingSlider; @service loadingSlider;
@service site;
@tracked filter = ""; @tracked filter = "";
@tracked showAddMembers = false; @tracked showAddMembers = false;
@ -122,6 +125,16 @@ export default class ChatRouteChannelInfoMembers extends Component {
} }
<template> <template>
{{#if this.site.mobileView}}
<LinkTo
class="c-back-button"
@route="chat.channel.info.settings"
@model={{@channel}}
>
{{icon "chevron-left"}}
{{i18n "chat.members_view.back_to_settings"}}
</LinkTo>
{{/if}}
{{#if this.showAddMembers}} {{#if this.showAddMembers}}
<MessageCreator <MessageCreator
@mode={{this.addMembersMode}} @mode={{this.addMembersMode}}

View File

@ -13,10 +13,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
margin-bottom: 2rem;
& + .chat-form__section {
margin-top: 1rem;
}
&-title { &-title {
font-weight: 700; font-weight: 700;
@ -71,7 +68,6 @@
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
min-height: 40px;
gap: 0.25rem; gap: 0.25rem;
} }

View File

@ -1,3 +1,8 @@
.c-channel-info {
.c-back-button {
padding-bottom: 1em;
}
}
.c-channel-members { .c-channel-members {
width: 100%; width: 100%;
} }

View File

@ -1,6 +1,25 @@
.chat-form__section { .chat-form {
&__section {
margin-bottom: 0;
&:last-of-type {
.chat-form__section-content {
background: none;
padding-left: 0;
}
}
&-content { &-content {
background: var(--primary-very-low); background: var(--primary-very-low);
padding: 1rem; padding: 1rem;
} }
}
&__section-title {
.chat-form__section:not(:first-of-type) & {
margin-top: 1.5rem;
}
}
&__row-content {
min-height: 40px;
}
} }

View File

@ -312,6 +312,7 @@ en:
members_view: members_view:
filter_placeholder: Find members filter_placeholder: Find members
add_member: Add Member add_member: Add Member
back_to_settings: "Back to settings"
about_view: about_view:
associated_topic: Linked topic associated_topic: Linked topic

View File

@ -102,4 +102,14 @@ RSpec.describe "Channel - Info - Members page", type: :system do
) )
end end
end end
context "when on mobile", mobile: true do
it "has a link to the settings" do
chat_page.visit_channel_members(channel_1)
expect(page).to have_css(
".c-back-button[href='/chat/c/#{channel_1.slug}/#{channel_1.id}/info/settings']",
)
end
end
end end