Iterate the filtering prompt

pull/21833/head
Michael Telatynski 2020-11-11 13:21:20 +00:00
parent d3fee540c5
commit a481f3bdf1
3 changed files with 40 additions and 5 deletions

View File

@ -33,7 +33,6 @@ limitations under the License.
div:first-child { div:first-child {
font-weight: $font-semi-bold; font-weight: $font-semi-bold;
margin-bottom: 8px;
} }
.mx_AccessibleButton { .mx_AccessibleButton {
@ -41,6 +40,7 @@ limitations under the License.
position: relative; position: relative;
padding: 0 0 0 24px; padding: 0 0 0 24px;
font-size: inherit; font-size: inherit;
margin-top: 8px;
&::before { &::before {
content: ''; content: '';
@ -53,6 +53,13 @@ limitations under the License.
mask-position: center; mask-position: center;
mask-size: contain; mask-size: contain;
mask-repeat: no-repeat; mask-repeat: no-repeat;
}
&.mx_RoomList_explorePrompt_startChat::before {
mask-image: url('$(res)/img/element-icons/feedback.svg');
}
&.mx_RoomList_explorePrompt_explore::before {
mask-image: url('$(res)/img/element-icons/roomlist/explore.svg'); mask-image: url('$(res)/img/element-icons/roomlist/explore.svg');
} }
} }

View File

@ -284,6 +284,10 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
} }
}; };
private onStartChat = () => {
dis.dispatch({action: "view_create_chat"});
};
private onExplore = () => { private onExplore = () => {
dis.fire(Action.ViewRoomDirectory); dis.fire(Action.ViewRoomDirectory);
}; };
@ -335,8 +339,9 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
return p; return p;
}, [] as TagID[]); }, [] as TagID[]);
// show a skeleton UI if the user is in no rooms // show a skeleton UI if the user is in no rooms and they are not filtering
const showSkeleton = Object.values(RoomListStore.instance.unfilteredLists).every(list => !list?.length); const showSkeleton = !this.state.isNameFiltering &&
Object.values(RoomListStore.instance.unfilteredLists).every(list => !list?.length);
for (const orderedTagId of tagOrder) { for (const orderedTagId of tagOrder) {
const orderedRooms = this.state.sublists[orderedTagId] || []; const orderedRooms = this.state.sublists[orderedTagId] || [];
@ -376,7 +381,18 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
if (this.state.isNameFiltering) { if (this.state.isNameFiltering) {
explorePrompt = <div className="mx_RoomList_explorePrompt"> explorePrompt = <div className="mx_RoomList_explorePrompt">
<div>{_t("Can't see what youre looking for?")}</div> <div>{_t("Can't see what youre looking for?")}</div>
<AccessibleButton kind="link" onClick={this.onExplore}> <AccessibleButton
className="mx_RoomList_explorePrompt_startChat"
kind="link"
onClick={this.onStartChat}
>
{_t("Start a new chat")}
</AccessibleButton>
<AccessibleButton
className="mx_RoomList_explorePrompt_explore"
kind="link"
onClick={this.onExplore}
>
{_t("Explore all public rooms")} {_t("Explore all public rooms")}
</AccessibleButton> </AccessibleButton>
</div>; </div>;
@ -388,7 +404,18 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
if (unfilteredRooms.length < 1 && unfilteredHistorical < 1) { if (unfilteredRooms.length < 1 && unfilteredHistorical < 1) {
explorePrompt = <div className="mx_RoomList_explorePrompt"> explorePrompt = <div className="mx_RoomList_explorePrompt">
<div>{_t("Use the + to make a new room or explore existing ones below")}</div> <div>{_t("Use the + to make a new room or explore existing ones below")}</div>
<AccessibleButton kind="link" onClick={this.onExplore}> <AccessibleButton
className="mx_RoomList_explorePrompt_startChat"
kind="link"
onClick={this.onStartChat}
>
{_t("Start a new chat")}
</AccessibleButton>
<AccessibleButton
className="mx_RoomList_explorePrompt_explore"
kind="link"
onClick={this.onExplore}
>
{_t("Explore all public rooms")} {_t("Explore all public rooms")}
</AccessibleButton> </AccessibleButton>
</div>; </div>;

View File

@ -1391,6 +1391,7 @@
"Historical": "Historical", "Historical": "Historical",
"Custom Tag": "Custom Tag", "Custom Tag": "Custom Tag",
"Can't see what youre looking for?": "Can't see what youre looking for?", "Can't see what youre looking for?": "Can't see what youre looking for?",
"Start a new chat": "Start a new chat",
"Explore all public rooms": "Explore all public rooms", "Explore all public rooms": "Explore all public rooms",
"Use the + to make a new room or explore existing ones below": "Use the + to make a new room or explore existing ones below", "Use the + to make a new room or explore existing ones below": "Use the + to make a new room or explore existing ones below",
"%(count)s results|other": "%(count)s results", "%(count)s results|other": "%(count)s results",