Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ce9d31a

Browse files
committed
Add Room List join rooms prompt
1 parent fa9490b commit ce9d31a

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

src/components/views/rooms/RoomList.tsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,28 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
368368

369369
public render() {
370370
let explorePrompt: JSX.Element;
371-
if (!this.props.isMinimized && RoomListStore.instance.getFirstNameFilterCondition()) {
372-
explorePrompt = <div className="mx_RoomList_explorePrompt">
373-
<div>{_t("Can't see what you’re looking for?")}</div>
374-
<AccessibleButton kind="link" onClick={this.onExplore}>
375-
{_t("Explore all public rooms")}
376-
</AccessibleButton>
377-
</div>;
371+
if (!this.props.isMinimized) {
372+
if (RoomListStore.instance.getFirstNameFilterCondition()) {
373+
explorePrompt = <div className="mx_RoomList_explorePrompt">
374+
<div>{_t("Can't see what you’re looking for?")}</div>
375+
<AccessibleButton kind="link" onClick={this.onExplore}>
376+
{_t("Explore all public rooms")}
377+
</AccessibleButton>
378+
</div>;
379+
} else if (Object.values(this.state.sublists).some(list => list.length > 0)) {
380+
const unfilteredLists = RoomListStore.instance.unfilteredLists
381+
const unfilteredRooms = unfilteredLists[DefaultTagID.Untagged] || [];
382+
const unfilteredHistorical = unfilteredLists[DefaultTagID.Archived] || [];
383+
// show a prompt to join/create rooms if the user is in 0 rooms and no historical
384+
if (unfilteredRooms.length < 1 && unfilteredHistorical < 1) {
385+
explorePrompt = <div className="mx_RoomList_explorePrompt">
386+
<div>{_t("Use the + to make a new room or explore existing ones below")}</div>
387+
<AccessibleButton kind="link" onClick={this.onExplore}>
388+
{_t("Explore all public rooms")}
389+
</AccessibleButton>
390+
</div>;
391+
}
392+
}
378393
}
379394

380395
const sublists = this.renderSublists();

0 commit comments

Comments
 (0)