mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
UX: Muted style for entire chat section link when muted (#18852)
This commit is contained in:

committed by
GitHub

parent
391a456443
commit
d446ad3290
@ -24,6 +24,7 @@
|
|||||||
{{#each customSection.links as |link|}}
|
{{#each customSection.links as |link|}}
|
||||||
<Sidebar::SectionLink
|
<Sidebar::SectionLink
|
||||||
@linkName={{link.name}}
|
@linkName={{link.name}}
|
||||||
|
@class={{link.classNames}}
|
||||||
@route={{link.route}}
|
@route={{link.route}}
|
||||||
@model={{link.model}}
|
@model={{link.model}}
|
||||||
@models={{link.models}}
|
@models={{link.models}}
|
||||||
|
@ -9,6 +9,13 @@ export default class BaseCustomSidebarSectionLink {
|
|||||||
this._notImplemented();
|
this._notImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {string} The classnames of the section link.
|
||||||
|
*/
|
||||||
|
get classNames() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string} The Ember route which the section link should link to.
|
* @returns {string} The Ember route which the section link should link to.
|
||||||
*/
|
*/
|
||||||
|
@ -69,6 +69,10 @@ acceptance("Sidebar - Plugin API", function (needs) {
|
|||||||
return "random-channel";
|
return "random-channel";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get classNames() {
|
||||||
|
return "my-class-name";
|
||||||
|
}
|
||||||
|
|
||||||
get route() {
|
get route() {
|
||||||
return "topic";
|
return "topic";
|
||||||
}
|
}
|
||||||
@ -243,6 +247,11 @@ acceptance("Sidebar - Plugin API", function (needs) {
|
|||||||
"displays first link with correct text"
|
"displays first link with correct text"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
assert.ok(
|
||||||
|
exists(".sidebar-section-link.my-class-name"),
|
||||||
|
"sets the custom class name for the section link"
|
||||||
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
links[0].title,
|
links[0].title,
|
||||||
"random channel title",
|
"random channel title",
|
||||||
|
@ -61,6 +61,12 @@ export default {
|
|||||||
return dasherize(slugifyChannel(this.title));
|
return dasherize(slugifyChannel(this.title));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get classNames() {
|
||||||
|
return this.channel.current_user_membership.muted
|
||||||
|
? "sidebar-section-link--muted"
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
|
||||||
get route() {
|
get route() {
|
||||||
return "chat.channel";
|
return "chat.channel";
|
||||||
}
|
}
|
||||||
@ -108,12 +114,6 @@ export default {
|
|||||||
? "urgent"
|
? "urgent"
|
||||||
: "unread";
|
: "unread";
|
||||||
}
|
}
|
||||||
|
|
||||||
get contentCSSClass() {
|
|
||||||
return this.channel.current_user_membership.muted
|
|
||||||
? "sidebar-section-link-content-muted"
|
|
||||||
: "";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const SidebarChatChannelsSection = class extends BaseCustomSidebarSection {
|
const SidebarChatChannelsSection = class extends BaseCustomSidebarSection {
|
||||||
@ -243,6 +243,12 @@ export default {
|
|||||||
return slugifyChannel(this.title);
|
return slugifyChannel(this.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get classNames() {
|
||||||
|
return this.channel.current_user_membership.muted
|
||||||
|
? "sidebar-section-link--muted"
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
|
||||||
get route() {
|
get route() {
|
||||||
return "chat.channel";
|
return "chat.channel";
|
||||||
}
|
}
|
||||||
@ -307,12 +313,6 @@ export default {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
get contentCSSClass() {
|
|
||||||
return this.channel.current_user_membership.muted
|
|
||||||
? "sidebar-section-link-content-muted"
|
|
||||||
: "";
|
|
||||||
}
|
|
||||||
|
|
||||||
get suffixType() {
|
get suffixType() {
|
||||||
return "icon";
|
return "icon";
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-section-link-content-muted {
|
.sidebar-section-link--muted {
|
||||||
opacity: 0.65;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,9 +310,9 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists(
|
exists(
|
||||||
".sidebar-section-chat-dms .sidebar-section-link-sam .sidebar-section-link-content-muted"
|
".sidebar-section-chat-dms .sidebar-section-link-sam.sidebar-section-link--muted"
|
||||||
),
|
),
|
||||||
"muted direct chat channel has right CSS class configured"
|
"muted direct chat channel section link has right classname configured"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -321,9 +321,9 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
|
|||||||
|
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists(
|
exists(
|
||||||
".sidebar-section-chat-channels .sidebar-section-link-random .sidebar-section-link-content-muted"
|
".sidebar-section-chat-channels .sidebar-section-link-random.sidebar-section-link--muted"
|
||||||
),
|
),
|
||||||
"muted random chat channel has right CSS class configured"
|
"muted random chat channel section link has right classname configured"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user